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

@ -184,11 +184,11 @@ void RenderSettingsDialog::setDocumentation(const QString &text) {
ui->groupBox->setTitle(tr("Documentation"));
}
#if defined(__OSX__)
#if defined(__OSX__)
ui->helpViewer->setHtml(comments + "<div style='font-size:12pt'>" + m_currentDocumentation + "</div>");
#else
#else
ui->helpViewer->setHtml(comments + "<div style='font-size:10pt'>" + m_currentDocumentation + "</div>");
#endif
#endif
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(!hasErrors);
}
@ -546,25 +546,32 @@ 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__)
#if defined(__OSX__)
/* Don't draw focus halos on OSX, they're really distracting */
if (widget != NULL && widget->testAttribute(Qt::WA_MacShowFocusRect))
widget->setAttribute(Qt::WA_MacShowFocusRect, false);
@ -572,7 +579,7 @@ QWidget *PropertyDelegate::createEditor(QWidget *parent, const QStyleOptionViewI
widget->setAttribute(Qt::WA_MacMiniSize, true);
widget->setStyleSheet("font-size: 13pt;");
}
#endif
#endif
return widget;
}

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 {