fixed an annoying OSX-specific bug where checkboxes in the render settings dialog did not get saved

metadata
Wenzel Jakob 2014-07-23 23:12:57 +02:00
parent ae865e7dfa
commit a97731c9f7
2 changed files with 25 additions and 16 deletions

View File

@ -546,24 +546,31 @@ QString PropertyDelegate::displayText(const QVariant &value, const QLocale &loca
return QStyledItemDelegate::displayText(value, locale);
}
void PropertyDelegate::updateWidgetData() {
emit commitData((QWidget *) sender());
}
QWidget *PropertyDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option,
const QModelIndex &index) const {
if (index.data().type() == QVariant::Bool) {
#if defined(BOOLEAN_AS_COMBOBOXES)
QComboBox *cbox = new QComboBox(parent);
/* Nicer boolean editor -- by default, Qt creates a True/False combo box */
cbox->addItem(tr("No"));
cbox->addItem(tr("Yes"));
return cbox;
#else
return new QCheckBox(parent);
QCheckBox *box = new QCheckBox(parent);
connect(box, SIGNAL(toggled(bool)), this, SLOT(updateWidgetData()));
return box;
#endif
}
QWidget *widget;
if (index.data().type() == QVariant::Double)
widget = new BetterDoubleSpinBox(parent);
else
widget = QStyledItemDelegate::createEditor(parent, option, index);
#if defined(__OSX__)
/* Don't draw focus halos on OSX, they're really distracting */
if (widget != NULL && widget->testAttribute(Qt::WA_MacShowFocusRect))

View File

@ -40,6 +40,8 @@ public:
const QModelIndex &index) const;
void updateEditorGeometry(QWidget *editor,
const QStyleOptionViewItem &option, const QModelIndex &index) const;
protected slots:
void updateWidgetData();
};
class RenderSettingsDialog : public QDialog {