Commit c43d958e authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh

ThemeEditor: Enable browsing through built-in themes

Change-Id: I2ce389abdffe99e27992c71ca64a4888c2e7fac5
Reviewed-by: default avatarAlessandro Portale <alessandro.portale@digia.com>
parent ea029b4c
......@@ -45,7 +45,7 @@ ThemeColorsTableView::ThemeColorsTableView(QWidget *parent)
void ThemeColorsTableView::mousePressEvent(QMouseEvent *event)
{
if (event->button() == Qt::LeftButton) {
if ((editTriggers() & NoEditTriggers) && (event->button() == Qt::LeftButton)) {
QModelIndex index = indexAt(event->pos());
if (model()->flags(index) & Qt::ItemIsEditable && index.column() == 1) {
setCurrentIndex(index);
......
......@@ -79,6 +79,8 @@ ThemeEditorWidget::~ThemeEditorWidget()
void ThemeEditorWidget::changeColor(const QModelIndex &index)
{
if (!(m_ui->tableView->editTriggers() & QAbstractItemView::DoubleClicked))
return;
if (m_model->inSectionBody(index.row()) != ThemeSettingsTableModel::SectionColors)
return;
if (index.column() == 1)
......@@ -114,7 +116,9 @@ void ThemeEditorWidget::changeColor(const QModelIndex &index)
void ThemeEditorWidget::setReadOnly(bool readOnly)
{
m_readOnly = readOnly;
m_ui->tableView->setEnabled(!readOnly);
m_ui->tableView->setEditTriggers(
readOnly ? QAbstractItemView::NoEditTriggers
: QAbstractItemView::DoubleClicked | QAbstractItemView::EditKeyPressed);
m_ui->filter->setEnabled(!readOnly);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment