A simple selection dialog based on a QListView. More...
#include <global.h>


Public Member Functions | |
| SimpleViewSelectionDialog (const QString &title, QAbstractItemModel *model, QWidget *parent=0) | |
| QModelIndex | selection () |
A simple selection dialog based on a QListView.
| SimpleViewSelectionDialog::SimpleViewSelectionDialog | ( | const QString & | title, | |
| QAbstractItemModel * | model, | |||
| QWidget * | parent = 0 | |||
| ) | [inline] |
: QDialog(parent){ setWindowTitle(title); view = new QListView(this); view->setSelectionMode(QAbstractItemView::SingleSelection); view->setModel(model); buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this); buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); connect(view->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)), this, SLOT(selectionChanged(QItemSelection, QItemSelection))); setLayout(new QVBoxLayout()); layout()->addWidget(view); layout()->addWidget(buttonBox); }
| QModelIndex SimpleViewSelectionDialog::selection | ( | ) | [inline] |
Referenced by SensorUnitEditor::onAddButtonPress().
{
return view->selectionModel()->selectedIndexes().first();
}
1.7.1