Don't allow the Cylinder option be edited in PLAN / ADD mode

This sets the combobox to disabled if the profile is in
any mode besides PROFILE.

Fixes #824

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2015-02-03 20:53:25 -02:00 committed by Dirk Hohndel
parent 636376f591
commit 3671c991e8

View file

@ -87,6 +87,7 @@ struct CurrSelected {
QWidget *ComboBoxDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
MainWindow *m = MainWindow::instance();
QComboBox *comboDelegate = new QComboBox(parent);
comboDelegate->setModel(model);
comboDelegate->setEditable(true);
@ -95,6 +96,8 @@ QWidget *ComboBoxDelegate::createEditor(QWidget *parent, const QStyleOptionViewI
comboDelegate->completer()->setCompletionMode(QCompleter::PopupCompletion);
comboDelegate->view()->setEditTriggers(QAbstractItemView::AllEditTriggers);
comboDelegate->lineEdit()->installEventFilter(const_cast<QObject *>(qobject_cast<const QObject *>(this)));
if ((m->graphics()->currentState != ProfileWidget2::PROFILE))
comboDelegate->lineEdit()->setEnabled(false);
comboDelegate->view()->installEventFilter(const_cast<QObject *>(qobject_cast<const QObject *>(this)));
QAbstractItemView *comboPopup = comboDelegate->lineEdit()->completer()->popup();
comboPopup->setMouseTracking(true);