Stellarium 0.13.2
List of all members | Public Types | Public Slots | Signals | Public Member Functions | Protected Member Functions
StelButton Class Reference

A Button Graphicsitem for use in Stellarium's graphic widgets. More...

#include <StelGuiItems.hpp>

Public Types

enum  { ButtonStateOff = 0, ButtonStateOn = 1, ButtonStateNoChange = 2 }
 Button states. More...
 

Public Slots

void setChecked (int b)
 set whether the button is checked More...
 
void setChecked (bool b)
 

Signals

void toggled (bool)
 Triggered when the button state changes. More...
 
void triggered ()
 Triggered when the button state changes. More...
 
void hoverChanged (bool b)
 Emitted when the hover state change. More...
 

Public Member Functions

 StelButton (QGraphicsItem *parent, const QPixmap &pixOn, const QPixmap &pixOff, const QPixmap &pixHover=QPixmap(), class StelAction *action=NULL, bool noBackground=false)
 Constructor. More...
 
 StelButton (QGraphicsItem *parent, const QPixmap &pixOn, const QPixmap &pixOff, const QPixmap &pixHover=QPixmap(), const QString &actionId=QString(), bool noBackground=false)
 
 StelButton (QGraphicsItem *parent, const QPixmap &pixOn, const QPixmap &pixOff, const QPixmap &pixNoChange, const QPixmap &pixHover=QPixmap(), const QString &actionId=QString(), bool noBackground=false, bool isTristate=true)
 Constructor. More...
 
int isChecked () const
 Get whether the button is checked. More...
 
int getButtonPixmapWidth () const
 Get the width of the button image. More...
 
void setOpacity (double v)
 Set the button opacity. More...
 
void setBackgroundPixmap (const QPixmap &newBackground)
 Set the background pixmap of the button. More...
 

Protected Member Functions

virtual void mousePressEvent (QGraphicsSceneMouseEvent *event)
 
virtual void hoverEnterEvent (QGraphicsSceneHoverEvent *event)
 
virtual void hoverLeaveEvent (QGraphicsSceneHoverEvent *event)
 
virtual void mouseReleaseEvent (QGraphicsSceneMouseEvent *event)
 

Detailed Description

A Button Graphicsitem for use in Stellarium's graphic widgets.

Definition at line 65 of file StelGuiItems.hpp.

Member Enumeration Documentation

anonymous enum

Button states.

Definition at line 99 of file StelGuiItems.hpp.

Constructor & Destructor Documentation

StelButton::StelButton ( QGraphicsItem *  parent,
const QPixmap &  pixOn,
const QPixmap &  pixOff,
const QPixmap &  pixHover = QPixmap(),
class StelAction action = NULL,
bool  noBackground = false 
)

Constructor.

Parameters
parentthe parent item
pixOnthe pixmap to display when the button is toggled
pixOffthe pixmap to display when the button is not toggled
pixHovera pixmap slowly blended when mouse is over the button
actionthe associated action. Connections are automatically done with the signals if relevant.
noBackgrounddefine whether the button background image have to be used
StelButton::StelButton ( QGraphicsItem *  parent,
const QPixmap &  pixOn,
const QPixmap &  pixOff,
const QPixmap &  pixNoChange,
const QPixmap &  pixHover = QPixmap(),
const QString &  actionId = QString(),
bool  noBackground = false,
bool  isTristate = true 
)

Constructor.

Parameters
parentthe parent item
pixOnthe pixmap to display when the button is toggled
pixOffthe pixmap to display when the button is not toggled
pixNoChangethe pixmap to display when the button state of a tristate is not changed
pixHovera pixmap slowly blended when mouse is over the button
actionIdthe associated action. Connections are automatically done with the signals if relevant.
noBackgrounddefine whether the button background image have to be used
isTristatedefine whether the button is a tristate or an on/off button

Member Function Documentation

int StelButton::getButtonPixmapWidth ( ) const
inline

Get the width of the button image.

The width is based on pixOn.

Definition at line 106 of file StelGuiItems.hpp.

void StelButton::hoverChanged ( bool  b)
signal

Emitted when the hover state change.

Parameters
btrue if the mouse entered the button
int StelButton::isChecked ( ) const
inline

Get whether the button is checked.

Definition at line 102 of file StelGuiItems.hpp.

void StelButton::setBackgroundPixmap ( const QPixmap &  newBackground)

Set the background pixmap of the button.

void StelButton::setChecked ( int  b)
slot

set whether the button is checked

void StelButton::setOpacity ( double  v)
inline

Set the button opacity.

Definition at line 109 of file StelGuiItems.hpp.

void StelButton::toggled ( bool  )
signal

Triggered when the button state changes.

void StelButton::triggered ( )
signal

Triggered when the button state changes.


The documentation for this class was generated from the following file: