Public Member Functions | Protected Slots | Protected Attributes

QmitkLoadPresetDialog Class Reference
[Classes related to rigid registration]

Dialog for QmitkRigidRegistration. More...

#include <QmitkLoadPresetDialog.h>

List of all members.

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

Detailed Description

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.


Constructor & Destructor Documentation

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.

{
}

Member Function Documentation

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
  }
}

Member Data Documentation

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]

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines