Stellarium
HEAD
|
Base class for all the GUI windows in Stellarium. More...
#include <StelDialog.hpp>
Public Slots | |
virtual void | styleChanged (const QString &style) |
Apply application style change. | |
virtual void | retranslate ()=0 |
Retranslate the content of the dialog. More... | |
virtual void | setVisible (bool) |
On the first call with "true" populates the window contents. | |
virtual void | close () |
Closes the window (the window widget is not deleted, just not visible). | |
void | handleMovedTo (QPoint newPos) |
Adds dialog location to config.ini; should be connected in createDialogContent() | |
virtual void | handleDialogSizeChanged (QSizeF size) |
Stores dialog sizes into config.ini; should be connected from the proxy. More... | |
Signals | |
void | visibleChanged (bool) |
Public Member Functions | |
StelDialog (const QString &dialogName=QString("Default"), QObject *parent=nullptr) | |
bool | visible () const |
Returns true if the dialog contents have been constructed and are currently shown. | |
QString | getDialogName () const |
Protected Slots | |
bool | askConfirmation (const QString &message=q_("Are you sure? This will delete your customized data.")) |
void | messageBox (const QString &title, const QString &message) |
void | enableKineticScrolling (bool b) |
enable kinetic scrolling. This should be connected to StelApp's StelGui signal flagUseKineticScrollingChanged. | |
void | handleFontChanged () |
connect from StelApp to handle font and font size changes. | |
void | handleColorSchemeChanged () |
connect from StelApp to handle CSS style changes | |
virtual void | updateNightModeProperty (bool n) |
Protected Member Functions | |
virtual void | createDialogContent ()=0 |
Initialize the dialog widgets and connect the signals/slots. | |
Static Protected Member Functions | |
static void | connectCheckBox (QAbstractButton *checkBox, const QString &actionName) |
Helper function to connect a checkbox to the StelAction with the specified name. | |
static void | connectCheckBox (QAbstractButton *checkBox, StelAction *action) |
Helper function to connect a checkbox to the given StelAction. | |
static void | connectIntProperty (QLineEdit *lineEdit, const QString &propName) |
Helper function to connect a QLineEdit to an integer StelProperty. More... | |
static void | connectIntProperty (QSpinBox *spinBox, const QString &propName) |
Helper function to connect a QSpinBox to an integer StelProperty. More... | |
static void | connectIntProperty (QComboBox *comboBox, const QString &propName) |
Helper function to connect a QComboBox to an integer StelProperty. More... | |
static void | connectIntProperty (QSlider *slider, const QString &propName, int minValue, int maxValue) |
Helper function to connect a QSlider to an double or float StelProperty. More... | |
static void | connectDoubleProperty (QDoubleSpinBox *spinBox, const QString &propName) |
Helper function to connect a QDoubleSpinBox to an double or float StelProperty. More... | |
static void | connectDoubleProperty (AngleSpinBox *spinBox, const QString &propName) |
Helper function to connect an AngleSpinBox to a double or float StelProperty representing decimal degrees. More... | |
static void | connectDoubleProperty (QSlider *slider, const QString &propName, double minValue, double maxValue) |
Helper function to connect a QSlider to an double or float StelProperty. More... | |
static void | connectStringProperty (QComboBox *comboBox, const QString &propName) |
Helper function to connect a QComboBox to a QString StelProperty. More... | |
static void | connectStringProperty (QLineEdit *lineEdit, const QString &propName) |
Helper function to connect a QLineEdit to a QString StelProperty. More... | |
static void | connectBoolProperty (QAbstractButton *checkBox, const QString &propName) |
Helper function to connect a checkbox to a bool StelProperty. More... | |
static void | connectBoolProperty (QGroupBox *checkBox, const QString &propName) |
Helper function to connect a groupbox to a bool StelProperty. More... | |
Protected Attributes | |
QWidget * | dialog |
The main dialog. | |
class CustomProxy * | proxy |
QString | dialogName |
The name should be set in derived classes' constructors and can be used to store and retrieve the panel locations. | |
QList< QWidget * > | kineticScrollingList |
A list of widgets where kinetic scrolling can be activated or deactivated The list must be filled once, in the constructor or init() of fillDialog() etc. More... | |
Properties | |
bool | visible |
Base class for all the GUI windows in Stellarium.
Windows in Stellarium are actually basic QWidgets that have to be wrapped in a QGraphicsProxyWidget (CustomProxy) to be displayed by StelMainView (which is derived from QGraphicsView). See the Qt documentation for details.
The base widget needs to be populated with controls in the implementation of the createDialogContent() function. This can be done either manually, or by using a .ui file. See the Qt documentation on using Qt Designer .ui files for details.
The createDialogContent() function itself is called automatically the first time setVisible() is called with "true".
Moving a window is done by dragging its title bar, defined in the TitleBar class. Every derived window class needs a TitleBar object - it has to be either included in a .ui file, or manually instantiated in createDialogContent().
The screen location of the StelDialog can be stored in config.ini. This requires setting dialogName (must be a unique name, should be set in the constructor), and setting a connect() from the TitleBar's movedTo() signal to handleMovedTo() in createDialogContent(). If the dialog is called and the stored location is off-screen, the dialog is shifted to become visible.
The StelDialog base class provides multiple helper functions that allow easy two-way binding of widgets to specific StelAction or StelProperty instances. These functions are:
|
staticprotected |
Helper function to connect a checkbox to a bool StelProperty.
propName
is invalid/unregistered, or cannot be converted to the required datatype, the application will crash
|
staticprotected |
Helper function to connect a groupbox to a bool StelProperty.
propName
is invalid/unregistered, or cannot be converted to the required datatype, the application will crash
|
staticprotected |
Helper function to connect an AngleSpinBox to a double or float StelProperty representing decimal degrees.
propName
is invalid/unregistered, or cannot be converted to the required datatype, the application will crash
|
staticprotected |
Helper function to connect a QDoubleSpinBox to an double or float StelProperty.
propName
is invalid/unregistered, or cannot be converted to the required datatype, the application will crash
|
staticprotected |
Helper function to connect a QSlider to an double or float StelProperty.
slider | The slider which should be connected |
propName | The id of the StelProperty which should be connected |
minValue | the double value associated with the minimal slider position |
maxValue | the double value associated with the maximal slider position |
propName
is invalid/unregistered, or cannot be converted to the required datatype, the application will crash
|
staticprotected |
Helper function to connect a QComboBox to an integer StelProperty.
The property is mapped to the selected index of the combobox.
propName
is invalid/unregistered, or cannot be converted to the required datatype, the application will crash
|
staticprotected |
Helper function to connect a QLineEdit to an integer StelProperty.
propName
is invalid/unregistered, or cannot be converted to the required datatype, the application will crash
|
staticprotected |
Helper function to connect a QSlider to an double or float StelProperty.
slider | The slider which should be connected |
propName | The id of the StelProperty which should be connected |
minValue | the int value associated with the minimal slider position |
maxValue | the int value associated with the maximal slider position |
propName
is invalid/unregistered, or cannot be converted to the required datatype, the application will crash
|
staticprotected |
Helper function to connect a QSpinBox to an integer StelProperty.
propName
is invalid/unregistered, or cannot be converted to the required datatype, the application will crash
|
staticprotected |
Helper function to connect a QComboBox to a QString StelProperty.
The property is mapped to the selected string of the combobox. Make sure the string is available in the Combobox, else the first element may be chosen.
propName
is invalid/unregistered, or cannot be converted to the required datatype, the application will crash
|
staticprotected |
Helper function to connect a QLineEdit to a QString StelProperty.
propName
is invalid/unregistered, or cannot be converted to the required datatype, the application will crash
|
virtualslot |
Stores dialog sizes into config.ini; should be connected from the proxy.
When a subclass needs a size-dependent update, implement such update in the subclass version, but call StelDialog::handleDialogSizeChanged() first.
|
pure virtualslot |
Retranslate the content of the dialog.
Needs to be connected to StelApp::languageChanged(). At the very least, if the window is based on a Qt Designer file (.ui), the implementation needs to call the generated class' retranslateUi() method, like this:
|
protected |
A list of widgets where kinetic scrolling can be activated or deactivated The list must be filled once, in the constructor or init() of fillDialog() etc.
functions.