Stellarium 0.11.4
Home · All Namespaces · All Classes · Functions · Coding Style · Scripting · Plugins · File Structure

StelButton Class Reference

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

#include <StelGuiItems.hpp>

List of all members.

Public Types

enum  { ButtonStateOff = 0, ButtonStateOn = 1, ButtonStateNoChange = 2 }
 

Button states.

More...

Public Slots

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

Signals

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

Public Member Functions

 StelButton (QGraphicsItem *parent, const QPixmap &pixOn, const QPixmap &pixOff, const QPixmap &pixHover=QPixmap(), QAction *action=NULL, bool noBackground=false)
 Constructor.
 StelButton (QGraphicsItem *parent, const QPixmap &pixOn, const QPixmap &pixOff, const QPixmap &pixNoChange, const QPixmap &pixHover=QPixmap(), QAction *action=NULL, bool noBackground=false, bool isTristate=true)
 Constructor.
int isChecked () const
 Get whether the button is checked.
int getButtonPixmapWidth () const
 Get the width of the button image.
void setOpacity (double v)
 Set the button opacity.
void setRedMode (bool b)
 Activate red mode for this button, i.e. will reduce the non red color component of the icon.
void setBackgroundPixmap (const QPixmap &newBackground)
 Set the background pixmap of the button.

Static Public Member Functions

static QPixmap makeRed (const QPixmap &p)
 Transform the pixmap so that it look red for night vision mode.

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.


Member Enumeration Documentation

anonymous enum

Button states.


Constructor & Destructor Documentation

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

Constructor.

Parameters:
parent the parent item
pixOn the pixmap to display when the button is toggled
pixOff the pixmap to display when the button is not toggled
pixHover a pixmap slowly blended when mouse is over the button
action the associated action. Connections are automatically done with the signals if relevant.
noBackground define 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(),
QAction *  action = NULL,
bool  noBackground = false,
bool  isTristate = true 
)

Constructor.

Parameters:
parent the parent item
pixOn the pixmap to display when the button is toggled
pixOff the pixmap to display when the button is not toggled
pixNoChange the pixmap to display when the button state of a tristate is not changed
pixHover a pixmap slowly blended when mouse is over the button
action the associated action. Connections are automatically done with the signals if relevant.
noBackground define whether the button background image have to be used
isTristate define 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.

void StelButton::hoverChanged ( bool  b  )  [signal]

Emitted when the hover state change.

Parameters:
b true if the mouse entered the button
int StelButton::isChecked (  )  const [inline]

Get whether the button is checked.

static QPixmap StelButton::makeRed ( const QPixmap &  p  )  [static]

Transform the pixmap so that it look red for night vision mode.

void StelButton::setBackgroundPixmap ( const QPixmap &  newBackground  ) 

Set the background pixmap of the button.

A variant for night vision mode (pixBackgroundRed) is automatically generated from the new background.

void StelButton::setChecked ( int  b  )  [slot]

set whether the button is checked

void StelButton::setOpacity ( double  v  )  [inline]

Set the button opacity.

void StelButton::setRedMode ( bool  b  )  [inline]

Activate red mode for this button, i.e. will reduce the non red color component of the icon.

void StelButton::toggled ( bool   )  [signal]

Triggered when the button state changes.

void StelButton::triggered (  )  [signal]

Triggered when the button state changes.

Generated on Sat Aug 25 22:13:32 2012 for Stellarium by  doxygen 1.6.3