From 0c95024c9b0603dc245f23987a4bad542437a28a Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Tue, 4 Nov 2014 10:35:25 +0200 Subject: [PATCH] ThemeEditor: Fix some style issues Change-Id: I43e96ec0633cfbc3606969af3e44e2dd994c49ff Reviewed-by: Thorben Kroeger Reviewed-by: Orgad Shaneh --- .../themeeditor/themesettingsitemdelegate.cpp | 24 +++++++------------ .../themeeditor/themesettingsitemdelegate.h | 2 +- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/src/plugins/coreplugin/themeeditor/themesettingsitemdelegate.cpp b/src/plugins/coreplugin/themeeditor/themesettingsitemdelegate.cpp index 062c89445d2..94f2f8dc2bb 100644 --- a/src/plugins/coreplugin/themeeditor/themesettingsitemdelegate.cpp +++ b/src/plugins/coreplugin/themeeditor/themesettingsitemdelegate.cpp @@ -87,15 +87,10 @@ QWidget *ThemeSettingsItemDelegate::createColorEditor(QWidget *parent, const QSt const bool isUnnamed = colorRole->colorVariable()->variableName().isEmpty(); const QColor currentColor = colorRole->colorVariable()->color(); - int k = 0; - if (isUnnamed) { - cb->addItem(makeIcon(currentColor), tr(" (Current)")); - ++k; - } else { - cb->addItem(makeIcon(currentColor), - colorRole->colorVariable()->variableName()+QString(tr(" (Current)"))); - ++k; - } + cb->addItem(makeIcon(currentColor), + isUnnamed ? tr(" (Current)") + : colorRole->colorVariable()->variableName() + tr(" (Current)")); + int k = 1; foreach (ColorVariable::Ptr namedColor, model->m_colors->colorVariables()) { if (namedColor->variableName().isEmpty()) @@ -148,16 +143,13 @@ QWidget *ThemeSettingsItemDelegate::createEditor(QWidget *parent, const QStyleOp m_comboBox = cb; return cb; } - case ThemeSettingsTableModel::SectionColors: { + case ThemeSettingsTableModel::SectionColors: return createColorEditor(parent, option, index); - } - case ThemeSettingsTableModel::SectionFlags: { + case ThemeSettingsTableModel::SectionFlags: return QStyledItemDelegate::createEditor(parent, option, index); - } - default: { + default: qWarning("unhandled section"); return 0; - } } // switch } @@ -166,7 +158,7 @@ void ThemeSettingsItemDelegate::setEditorData(QWidget *editor, const QModelIndex QStyledItemDelegate::setEditorData(editor, index); } -void ThemeSettingsItemDelegate::setModelData (QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const +void ThemeSettingsItemDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const { ThemeSettingsTableModel *themeSettingsModel = qobject_cast(sourceModel(model)); diff --git a/src/plugins/coreplugin/themeeditor/themesettingsitemdelegate.h b/src/plugins/coreplugin/themeeditor/themesettingsitemdelegate.h index 02023284baa..bf0d1b99e0f 100644 --- a/src/plugins/coreplugin/themeeditor/themesettingsitemdelegate.h +++ b/src/plugins/coreplugin/themeeditor/themesettingsitemdelegate.h @@ -58,7 +58,7 @@ class ThemeSettingsItemDelegate : public QStyledItemDelegate public: ThemeSettingsItemDelegate(QObject *parent); - QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const Q_DECL_OVERRIDE; + QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const Q_DECL_OVERRIDE; void setEditorData(QWidget *editor, const QModelIndex &index) const Q_DECL_OVERRIDE; void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const Q_DECL_OVERRIDE;