Stellarium 0.15.0
List of all members | Public Slots | Signals | Public Member Functions | Protected Member Functions | Protected Attributes
StelDialog Class Referenceabstract

Base class for all the GUI windows in Stellarium. More...

#include <StelDialog.hpp>

Public Slots

virtual void retranslate ()=0
 Retranslate the content of the dialog. More...
 
void setVisible (bool)
 On the first call with "true" populates the window contents. More...
 
void close ()
 Closes the window (the window widget is not deleted, just not visible). More...
 
void handleMovedTo (QPoint newPos)
 Adds dialog location to config.ini; should be connected in createDialogContent() More...
 

Signals

void visibleChanged (bool)
 

Public Member Functions

 StelDialog (QObject *parent=NULL)
 
bool visible () const
 

Protected Member Functions

virtual void createDialogContent ()=0
 Initialize the dialog widgets and connect the signals/slots. More...
 

Protected Attributes

QWidget * dialog
 The main dialog. More...
 
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. More...
 

Detailed Description

Base class for all the GUI windows in Stellarium.

A local copy of StelDialog, the base class for all the GUI windows in Stellarium, included to allow the plug-in to be loaded dynamically on Windows.

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 BarFrame class. Every derived window class needs a BarFrame 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 BarFrame'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.

(An "Invalid access to memory location" error is thrown otherwise.)

Definition at line 52 of file StelDialog.hpp.

Member Function Documentation

void StelDialog::close ( )
slot

Closes the window (the window widget is not deleted, just not visible).

virtual void StelDialog::createDialogContent ( )
protectedpure virtual
void StelDialog::handleMovedTo ( QPoint  newPos)
slot

Adds dialog location to config.ini; should be connected in createDialogContent()

virtual void StelDialog::retranslate ( )
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:

if (dialog)
ui->retranslateUi(dialog);
void StelDialog::setVisible ( bool  )
slot

On the first call with "true" populates the window contents.

Member Data Documentation

QWidget* StelDialog::dialog
protected

The main dialog.

Definition at line 90 of file StelDialog.hpp.

QString StelDialog::dialogName
protected

The name should be set in derived classes' constructors and can be used to store and retrieve the panel locations.

Definition at line 93 of file StelDialog.hpp.


The documentation for this class was generated from the following file: