A dialog box allowing to select study operation to be performed on the module activating. More...
#include <LightApp_ModuleDlg.h>

Public Slots | |
| void | accept () |
Called when any dialog button (except Cancel) is clicked. | |
Public Member Functions | |
| LightApp_ModuleDlg (QWidget *, const QString &, const QPixmap &=QPixmap()) | |
| Constructor. | |
| ~LightApp_ModuleDlg () | |
| Destructor. | |
| int | addButton (const QString &, const int=-1) |
| Add operation button to the dialog box. | |
Private Types | |
| typedef QMap< QPushButton *, int > | ButtonMap |
Private Member Functions | |
| QPushButton * | findButton (const int) const |
| Search button with the specified identifier. | |
Private Attributes | |
| ButtonMap | myButtons |
| QHBoxLayout * | myButtonLayout |
The dialog box is shown when the user tries to activate any module while there is no opened study. The dialog box proposes user to select one of the possible operations which should be done before module activating, for example, create new study or open study from the file. The available operations are assigned by adding the buttons with the unique identifier to the dialog box. When the user clicks any operation button, the dialog box sets its identifier as the return code and closes.
The typical usage of the dialog box:
LightApp_ModuleDlg dlg( desktop() ); dlg.addButton( "New study", NewStudyId ); dlg.addButton( "Open study...", OpenStudyId ); int ret = dlg.exec(); switch( ret ) { case NewStudyId: // create new study createNewStudy(); break; case OpenStudyId: // open study from the file // ... show dialog box to choose the file QString fileName = QFileDialog::getOpenFileName( desktop(), "Open File" ); if ( !fileName.isEmpty() ) openStudy( fileName ); break; default: // operation is cancelled break; }
typedef QMap<QPushButton*,int> LightApp_ModuleDlg.ButtonMap [private] |
| LightApp_ModuleDlg::LightApp_ModuleDlg | ( | QWidget * | parent, |
| const QString & | component, | ||
| const QPixmap & | icon = QPixmap() |
||
| ) |
| parent | parent widget |
| component | module name |
| icon | module icon |
References default_icon, and myButtonLayout.
| LightApp_ModuleDlg::~LightApp_ModuleDlg | ( | ) |
| int LightApp_ModuleDlg::addButton | ( | const QString & | button, |
| const int | id = -1 |
||
| ) |
If the parameter id is equal to -1, then the button identifier is generated automatically.
| button | button text |
| id | button identifier |
References accept(), findButton(), myButtonLayout, and myButtons.
| void LightApp_ModuleDlg::accept | ( | ) | [slot] |
Closes the dialog and sets its result code to the identifier of the button clicked by the user.
References myButtons.
| QPushButton * LightApp_ModuleDlg::findButton | ( | const int | id | ) | const [private] |
ButtonMap LightApp_ModuleDlg.myButtons [private] |
QHBoxLayout* LightApp_ModuleDlg.myButtonLayout [private] |