A Button Graphicsitem for use in Stellarium's graphic widgets.
More...
#include <StelGuiItems.hpp>
|
enum | { ButtonStateOff = 0
, ButtonStateOn = 1
, ButtonStateNoChange = 2
} |
| Button states.
|
|
|
void | setChecked (int b) |
| set whether the button is checked
|
|
void | setChecked (bool b) |
|
|
void | toggled (bool) |
| Triggered when the button state changes.
|
|
void | triggered () |
| Triggered when the button state changes.
|
|
void | triggeredRight () |
|
void | hoverChanged (bool b) |
| Emitted when the hover state change. More...
|
|
|
| StelButton (QGraphicsItem *parent, const QPixmap &pixOn, const QPixmap &pixOff, const QPixmap &pixHover=QPixmap(), class StelAction *action=nullptr, bool noBackground=false, StelAction *otherAction=nullptr) |
| Constructor. More...
|
|
| StelButton (QGraphicsItem *parent, const QPixmap &pixOn, const QPixmap &pixOff, const QPixmap &pixHover, const QString &actionId, bool noBackground=false, const QString &otherActionId="") |
| Constructor. More...
|
|
| StelButton (QGraphicsItem *parent, const QPixmap &pixOn, const QPixmap &pixOff, const QPixmap &pixNoChange, const QPixmap &pixHover, const QString &actionId=QString(), bool noBackground=false, bool isTristate=true) |
| Constructor. More...
|
|
int | isChecked () const |
| Get whether the button is checked.
|
|
int | getButtonPixmapWidth () const |
| Get the width of the button image. More...
|
|
int | getButtonPixmapHeight () const |
|
void | setOpacity (double v) |
| Set the button opacity.
|
|
void | setBackgroundPixmap (const QPixmap &newBackground) |
| Set the background pixmap of the button.
|
|
void | setFocusOnSky (bool b) |
| While configuring buttons, call this with true when after key release focus should go back to the sky (typical for bottom buttons; left buttons call panels which receive focus after button press, so those should be configured with b=false)
|
|
void | setTriggerOnRelease (bool b) |
| Configure the button to trigger its action when the mouse click is released (by default buttons trigger on press event).
|
|
QRectF | boundingRect () const override |
|
|
static double | getInputPixmapsDevicePixelRatio () |
|
|
void | hoverEnterEvent (QGraphicsSceneHoverEvent *event) override |
|
void | hoverLeaveEvent (QGraphicsSceneHoverEvent *event) override |
|
void | mousePressEvent (QGraphicsSceneMouseEvent *event) override |
|
void | mouseReleaseEvent (QGraphicsSceneMouseEvent *event) override |
|
void | paint (QPainter *, const QStyleOptionGraphicsItem *, QWidget *) override |
|
|
class | BottomStelBar |
|
class | LeftStelBar |
|
A Button Graphicsitem for use in Stellarium's graphic widgets.
◆ StelButton() [1/3]
StelButton::StelButton |
( |
QGraphicsItem * |
parent, |
|
|
const QPixmap & |
pixOn, |
|
|
const QPixmap & |
pixOff, |
|
|
const QPixmap & |
pixHover = QPixmap() , |
|
|
class StelAction * |
action = nullptr , |
|
|
bool |
noBackground = false , |
|
|
StelAction * |
otherAction = nullptr |
|
) |
| |
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() [2/3]
StelButton::StelButton |
( |
QGraphicsItem * |
parent, |
|
|
const QPixmap & |
pixOn, |
|
|
const QPixmap & |
pixOff, |
|
|
const QPixmap & |
pixHover, |
|
|
const QString & |
actionId, |
|
|
bool |
noBackground = false , |
|
|
const QString & |
otherActionId = "" |
|
) |
| |
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 |
actionId | the id of the associated action. Connections are automatically done with the signals if relevant. |
noBackground | define whether the button background image have to be used |
◆ StelButton() [3/3]
StelButton::StelButton |
( |
QGraphicsItem * |
parent, |
|
|
const QPixmap & |
pixOn, |
|
|
const QPixmap & |
pixOff, |
|
|
const QPixmap & |
pixNoChange, |
|
|
const QPixmap & |
pixHover, |
|
|
const QString & |
actionId = QString() , |
|
|
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 |
actionId | 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 |
◆ getButtonPixmapWidth()
int StelButton::getButtonPixmapWidth |
( |
| ) |
const |
|
inline |
Get the width of the button image.
The width is based on pixOn.
◆ hoverChanged
void StelButton::hoverChanged |
( |
bool |
b | ) |
|
|
signal |
Emitted when the hover state change.
- Parameters
-
b | true if the mouse entered the button |