forked from qt-creator/qt-creator
ThemeEditor: Fix some style issues
Change-Id: I43e96ec0633cfbc3606969af3e44e2dd994c49ff Reviewed-by: Thorben Kroeger <thorbenkroeger@gmail.com> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
97e9760a9a
commit
0c95024c9b
@@ -87,15 +87,10 @@ QWidget *ThemeSettingsItemDelegate::createColorEditor(QWidget *parent, const QSt
|
|||||||
const bool isUnnamed = colorRole->colorVariable()->variableName().isEmpty();
|
const bool isUnnamed = colorRole->colorVariable()->variableName().isEmpty();
|
||||||
const QColor currentColor = colorRole->colorVariable()->color();
|
const QColor currentColor = colorRole->colorVariable()->color();
|
||||||
|
|
||||||
int k = 0;
|
cb->addItem(makeIcon(currentColor),
|
||||||
if (isUnnamed) {
|
isUnnamed ? tr("<Unnamed> (Current)")
|
||||||
cb->addItem(makeIcon(currentColor), tr("<Unnamed> (Current)"));
|
: colorRole->colorVariable()->variableName() + tr(" (Current)"));
|
||||||
++k;
|
int k = 1;
|
||||||
} else {
|
|
||||||
cb->addItem(makeIcon(currentColor),
|
|
||||||
colorRole->colorVariable()->variableName()+QString(tr(" (Current)")));
|
|
||||||
++k;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (ColorVariable::Ptr namedColor, model->m_colors->colorVariables()) {
|
foreach (ColorVariable::Ptr namedColor, model->m_colors->colorVariables()) {
|
||||||
if (namedColor->variableName().isEmpty())
|
if (namedColor->variableName().isEmpty())
|
||||||
@@ -148,16 +143,13 @@ QWidget *ThemeSettingsItemDelegate::createEditor(QWidget *parent, const QStyleOp
|
|||||||
m_comboBox = cb;
|
m_comboBox = cb;
|
||||||
return cb;
|
return cb;
|
||||||
}
|
}
|
||||||
case ThemeSettingsTableModel::SectionColors: {
|
case ThemeSettingsTableModel::SectionColors:
|
||||||
return createColorEditor(parent, option, index);
|
return createColorEditor(parent, option, index);
|
||||||
}
|
case ThemeSettingsTableModel::SectionFlags:
|
||||||
case ThemeSettingsTableModel::SectionFlags: {
|
|
||||||
return QStyledItemDelegate::createEditor(parent, option, index);
|
return QStyledItemDelegate::createEditor(parent, option, index);
|
||||||
}
|
default:
|
||||||
default: {
|
|
||||||
qWarning("unhandled section");
|
qWarning("unhandled section");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
} // switch
|
} // switch
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -166,7 +158,7 @@ void ThemeSettingsItemDelegate::setEditorData(QWidget *editor, const QModelIndex
|
|||||||
QStyledItemDelegate::setEditorData(editor, index);
|
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<ThemeSettingsTableModel *>(sourceModel(model));
|
ThemeSettingsTableModel *themeSettingsModel = qobject_cast<ThemeSettingsTableModel *>(sourceModel(model));
|
||||||
|
|
||||||
|
@@ -58,7 +58,7 @@ class ThemeSettingsItemDelegate : public QStyledItemDelegate
|
|||||||
public:
|
public:
|
||||||
ThemeSettingsItemDelegate(QObject *parent);
|
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 setEditorData(QWidget *editor, const QModelIndex &index) const Q_DECL_OVERRIDE;
|
||||||
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const Q_DECL_OVERRIDE;
|
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user