Public Member Functions

SimpleViewSelectionDialog Class Reference

A simple selection dialog based on a QListView. More...

#include <global.h>

Inheritance diagram for SimpleViewSelectionDialog:
Inheritance graph
[legend]
Collaboration diagram for SimpleViewSelectionDialog:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 SimpleViewSelectionDialog (const QString &title, QAbstractItemModel *model, QWidget *parent=0)
QModelIndex selection ()

Detailed Description

A simple selection dialog based on a QListView.


Constructor & Destructor Documentation

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


Member Function Documentation

QModelIndex SimpleViewSelectionDialog::selection (  )  [inline]

Referenced by SensorUnitEditor::onAddButtonPress().

                           {
        return view->selectionModel()->selectedIndexes().first();
    }


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