20 #ifndef _STELDIALOG_HPP_ 21 #define _STELDIALOG_HPP_ 24 #include <QGraphicsProxyWidget> 25 #include <QGraphicsSceneResizeEvent> 28 #include "StelApp.hpp" 30 class QAbstractButton;
107 void visibleChanged(
bool);
114 static void connectCheckBox(QAbstractButton* checkBox,
const QString& actionName);
136 static void connectIntProperty(QSlider* slider,
const QString& propName,
int minValue,
int maxValue);
148 static void connectDoubleProperty(QSlider* slider,
const QString& propName,
double minValue,
double maxValue);
161 void installKineticScrolling(QList<QWidget *> addscroll);
167 void updateNightModeProperty();
174 CustomProxy(QGraphicsItem *parent = Q_NULLPTR, Qt::WindowFlags wFlags = 0) : QGraphicsProxyWidget(parent, wFlags)
176 setFocusPolicy(Qt::StrongFocus);
187 signals:
void sizeChanged(QSizeF);
190 virtual bool event(QEvent* event)
192 if (
StelApp::getInstance().getSettings()->value(
"gui/flag_use_window_transparency",
true).toBool())
194 switch (event->type())
196 case QEvent::WindowDeactivate:
197 widget()->setWindowOpacity(0.4);
199 case QEvent::WindowActivate:
200 case QEvent::GrabMouse:
201 widget()->setWindowOpacity(0.9);
207 return QGraphicsProxyWidget::event(event);
209 virtual void resizeEvent(QGraphicsSceneResizeEvent *event)
211 if (event->newSize() !=
event->oldSize())
213 emit sizeChanged(event->newSize());
215 QGraphicsProxyWidget::resizeEvent(event);
218 #endif // _STELDIALOG_HPP_ 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...
virtual void handleDialogSizeChanged(QSizeF size)
Stores dialog sizes into config.ini; should be connected from the proxy.
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.