Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
LightApp_ModuleDlg Class Reference

A dialog box allowing to select study operation to be performed on the module activating. More...

#include <LightApp_ModuleDlg.h>

Inheritance diagram for LightApp_ModuleDlg:
Inheritance graph

Public Slots

void accept ()
 Called when any dialog button (except Cancel) is clicked. More...
 

Public Member Functions

 LightApp_ModuleDlg (QWidget *, const QString &, const QPixmap &=QPixmap())
 Constructor. More...
 
 ~LightApp_ModuleDlg ()
 Destructor. More...
 
int addButton (const QString &, const int=-1)
 Add operation button to the dialog box. More...
 

Private Types

typedef QMap< QPushButton *, int > ButtonMap
 

Private Member Functions

QPushButton * findButton (const int) const
 Search button with the specified identifier. More...
 

Private Attributes

ButtonMap myButtons
 
QHBoxLayout * myButtonLayout
 

Detailed Description

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;
}
See Also
addButton()

Member Typedef Documentation

typedef QMap<QPushButton*,int> LightApp_ModuleDlg::ButtonMap
private

Constructor & Destructor Documentation

LightApp_ModuleDlg::LightApp_ModuleDlg ( QWidget parent,
const QString &  component,
const QPixmap &  icon = QPixmap() 
)
Parameters
parentparent widget
componentmodule name
iconmodule icon

References default_icon, and myButtonLayout.

LightApp_ModuleDlg::~LightApp_ModuleDlg ( )

Member Function Documentation

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.

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.

Parameters
buttonbutton text
idbutton identifier
Returns
button identifier

References accept(), findButton(), myButtonLayout, and myButtons.

QPushButton * LightApp_ModuleDlg::findButton ( const int  id) const
private
Parameters
idbutton identifier
Returns
button or 0 if id is invalid

References myButtons.

Member Data Documentation

QHBoxLayout* LightApp_ModuleDlg::myButtonLayout
private
ButtonMap LightApp_ModuleDlg::myButtons
private

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