Dialog for QmitkRigidRegistration. More...
#include <QmitkLoadPresetDialog.h>
Public Member Functions | |
QmitkLoadPresetDialog (QWidget *parent, Qt::WindowFlags f, const char *name, std::list< std::string > presets) | |
virtual | ~QmitkLoadPresetDialog () |
std::string | GetPresetName () |
Protected Slots | |
void | onPresetImmediatelySelected (QListWidgetItem *item) |
Protected Attributes | |
QLabel * | lblPrompt |
QListWidget * | lstPresets |
QPushButton * | btnOk |
Dialog for QmitkRigidRegistration.
This dialog is used to ask a user about a preset with transform, metric, optimizer and interpolator parameters to load.
Definition at line 39 of file QmitkLoadPresetDialog.h.
QmitkLoadPresetDialog::QmitkLoadPresetDialog | ( | QWidget * | parent, |
Qt::WindowFlags | f, | ||
const char * | name, | ||
std::list< std::string > | presets | ||
) |
Definition at line 25 of file QmitkLoadPresetDialog.cpp.
References btnOk, lblPrompt, lstPresets, and onPresetImmediatelySelected().
:QDialog(parent, f) { QDialog::setMinimumSize(250, 300); this->setObjectName(name); QBoxLayout * verticalLayout = new QVBoxLayout( this ); verticalLayout->setMargin(5); verticalLayout->setSpacing(5); // list of all presets lblPrompt = new QLabel( "Which preset do you want to load?", this ); verticalLayout->addWidget( lblPrompt ); lstPresets = new QListWidget( this ); verticalLayout->addWidget( lstPresets ); std::list<std::string>::iterator iter; for( iter = presets.begin(); iter != presets.end(); iter++ ) { std::string preset = *iter; new QListWidgetItem(preset.c_str(), lstPresets); } lstPresets->setCurrentItem(0); // select first Item by default (might turn out to be a stupid descision) connect( lstPresets, SIGNAL(itemDoubleClicked (QListWidgetItem *)), this, SLOT(onPresetImmediatelySelected(QListWidgetItem *)) ); // buttons for closing the dialog btnOk = new QPushButton( tr("Ok"), this); btnOk->setObjectName("btnOk" ); btnOk->setDefault(true); connect( btnOk, SIGNAL(clicked()), this, SLOT(accept()) ); QPushButton* btnCancel = new QPushButton( tr("Cancel"), this); btnCancel->setObjectName("btnCancel" ); connect( btnCancel, SIGNAL(clicked()), this, SLOT(reject()) ); QWidget* buttonWidget = new QWidget(this); QBoxLayout * horizontalLayout = new QHBoxLayout( buttonWidget ); horizontalLayout->setSpacing(5); horizontalLayout->addStretch(); horizontalLayout->addWidget( btnOk ); horizontalLayout->addWidget( btnCancel ); verticalLayout->addWidget(buttonWidget); }
QmitkLoadPresetDialog::~QmitkLoadPresetDialog | ( | ) | [virtual] |
Definition at line 71 of file QmitkLoadPresetDialog.cpp.
{ }
std::string QmitkLoadPresetDialog::GetPresetName | ( | ) |
Definition at line 75 of file QmitkLoadPresetDialog.cpp.
References lstPresets.
Referenced by QmitkRigidRegistrationSelectorView::DoLoadRigidRegistrationParameter().
{ std::string presetName = std::string(lstPresets->currentItem()->text().toAscii()); return presetName; }
void QmitkLoadPresetDialog::onPresetImmediatelySelected | ( | QListWidgetItem * | item ) | [protected, slot] |
Definition at line 81 of file QmitkLoadPresetDialog.cpp.
References lstPresets.
Referenced by QmitkLoadPresetDialog().
{ if ( (signed)(lstPresets->row(lstPresets->currentItem())) != (signed)(lstPresets->count()-1) ) { accept(); // close } else { // dont close } }
QPushButton* QmitkLoadPresetDialog::btnOk [protected] |
Definition at line 63 of file QmitkLoadPresetDialog.h.
Referenced by QmitkLoadPresetDialog().
QLabel* QmitkLoadPresetDialog::lblPrompt [protected] |
Definition at line 60 of file QmitkLoadPresetDialog.h.
Referenced by QmitkLoadPresetDialog().
QListWidget* QmitkLoadPresetDialog::lstPresets [protected] |
Definition at line 61 of file QmitkLoadPresetDialog.h.
Referenced by GetPresetName(), onPresetImmediatelySelected(), and QmitkLoadPresetDialog().