20 #ifndef _STELDIALOG_HPP_ 21 #define _STELDIALOG_HPP_ 24 #include <QGraphicsProxyWidget> 25 #include <QGraphicsSceneResizeEvent> 28 #include "StelApp.hpp" 30 class QAbstractButton;
105 void visibleChanged(
bool);
112 static void connectCheckBox(QAbstractButton* checkBox,
const QString& actionName);
134 static void connectIntProperty(QSlider* slider,
const QString& propName,
int minValue,
int maxValue);
146 static void connectDoubleProperty(QSlider* slider,
const QString& propName,
double minValue,
double maxValue);
159 void installKineticScrolling(QList<QWidget *> addscroll);
164 void updateNightModeProperty();
171 CustomProxy(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0) : QGraphicsProxyWidget(parent, wFlags)
173 setFocusPolicy(Qt::StrongFocus);
184 signals:
void sizeChanged(QSizeF);
187 virtual bool event(QEvent* event)
189 if (
StelApp::getInstance().getSettings()->value(
"gui/flag_use_window_transparency",
true).toBool())
191 switch (event->type())
193 case QEvent::WindowDeactivate:
194 widget()->setWindowOpacity(0.4);
196 case QEvent::WindowActivate:
197 case QEvent::GrabMouse:
198 widget()->setWindowOpacity(0.9);
204 return QGraphicsProxyWidget::event(event);
206 virtual void resizeEvent(QGraphicsSceneResizeEvent *event)
208 if (event->newSize() !=
event->oldSize())
210 emit sizeChanged(event->newSize());
212 QGraphicsProxyWidget::resizeEvent(event);
215 #endif // _STELDIALOG_HPP_ void handleDialogSizeChanged(QSizeF size)
Stores dialog sizes into config.ini; should be connected from the proxy.
void handleMovedTo(QPoint newPos)
Adds dialog location to config.ini; should be connected in createDialogContent()
void close()
Closes the window (the window widget is not deleted, just not visible).
static void connectBoolProperty(QAbstractButton *checkBox, const QString &propName)
Helper function to connect a checkbox to a bool StelProperty.
void paintWindowFrame(QPainter *, const QStyleOptionGraphicsItem *, QWidget *)
Reimplement this method to add windows decorations. Currently there are invisible 2 px decorations...
static void connectIntProperty(QSpinBox *spinBox, const QString &propName)
Helper function to connect a QSpinBox to an integer StelProperty.
virtual void createDialogContent()=0
Initialize the dialog widgets and connect the signals/slots.
Base class for all the GUI windows in Stellarium.
static void connectCheckBox(QAbstractButton *checkBox, const QString &actionName)
Helper function to connect a checkbox to the StelAction with the specified name.
void setVisible(bool)
On the first call with "true" populates the window contents.
static void connectDoubleProperty(QDoubleSpinBox *spinBox, const QString &propName)
Helper function to connect a QDoubleSpinBox to an double or float StelProperty.
Wrapper around an argumentless QObject slot or a bool Q_PROPERTY with WRITE method, allowing the slot to be called/property to be toggled using this action object.
QString dialogName
The name should be set in derived classes' constructors and can be used to store and retrieve the pan...
static StelApp & getInstance()
Get the StelApp singleton instance.
QWidget * dialog
The main dialog.
virtual void retranslate()=0
Retranslate the content of the dialog.
bool visible() const
Returns true if the dialog contents have been constructed and are currently shown.