fixed an annoying OSX-specific bug where checkboxes in the render settings dialog did not get saved
parent
ae865e7dfa
commit
a97731c9f7
|
@ -546,24 +546,31 @@ QString PropertyDelegate::displayText(const QVariant &value, const QLocale &loca
|
||||||
return QStyledItemDelegate::displayText(value, locale);
|
return QStyledItemDelegate::displayText(value, locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PropertyDelegate::updateWidgetData() {
|
||||||
|
emit commitData((QWidget *) sender());
|
||||||
|
}
|
||||||
|
|
||||||
QWidget *PropertyDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option,
|
QWidget *PropertyDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option,
|
||||||
const QModelIndex &index) const {
|
const QModelIndex &index) const {
|
||||||
if (index.data().type() == QVariant::Bool) {
|
if (index.data().type() == QVariant::Bool) {
|
||||||
#if defined(BOOLEAN_AS_COMBOBOXES)
|
#if defined(BOOLEAN_AS_COMBOBOXES)
|
||||||
QComboBox *cbox = new QComboBox(parent);
|
QComboBox *cbox = new QComboBox(parent);
|
||||||
/* Nicer boolean editor -- by default, Qt creates a True/False combo box */
|
|
||||||
cbox->addItem(tr("No"));
|
cbox->addItem(tr("No"));
|
||||||
cbox->addItem(tr("Yes"));
|
cbox->addItem(tr("Yes"));
|
||||||
return cbox;
|
return cbox;
|
||||||
#else
|
#else
|
||||||
return new QCheckBox(parent);
|
QCheckBox *box = new QCheckBox(parent);
|
||||||
|
connect(box, SIGNAL(toggled(bool)), this, SLOT(updateWidgetData()));
|
||||||
|
return box;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget *widget;
|
QWidget *widget;
|
||||||
if (index.data().type() == QVariant::Double)
|
if (index.data().type() == QVariant::Double)
|
||||||
widget = new BetterDoubleSpinBox(parent);
|
widget = new BetterDoubleSpinBox(parent);
|
||||||
else
|
else
|
||||||
widget = QStyledItemDelegate::createEditor(parent, option, index);
|
widget = QStyledItemDelegate::createEditor(parent, option, index);
|
||||||
|
|
||||||
#if defined(__OSX__)
|
#if defined(__OSX__)
|
||||||
/* Don't draw focus halos on OSX, they're really distracting */
|
/* Don't draw focus halos on OSX, they're really distracting */
|
||||||
if (widget != NULL && widget->testAttribute(Qt::WA_MacShowFocusRect))
|
if (widget != NULL && widget->testAttribute(Qt::WA_MacShowFocusRect))
|
||||||
|
|
|
@ -40,6 +40,8 @@ public:
|
||||||
const QModelIndex &index) const;
|
const QModelIndex &index) const;
|
||||||
void updateEditorGeometry(QWidget *editor,
|
void updateEditorGeometry(QWidget *editor,
|
||||||
const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
||||||
|
protected slots:
|
||||||
|
void updateWidgetData();
|
||||||
};
|
};
|
||||||
|
|
||||||
class RenderSettingsDialog : public QDialog {
|
class RenderSettingsDialog : public QDialog {
|
||||||
|
|
Loading…
Reference in New Issue