diff --git a/app/settings/delegates/activitycmbboxdelegate.cpp b/app/settings/delegates/activitycmbboxdelegate.cpp index 3ab35ce3a..bce8d8992 100644 --- a/app/settings/delegates/activitycmbboxdelegate.cpp +++ b/app/settings/delegates/activitycmbboxdelegate.cpp @@ -133,6 +133,8 @@ void ActivityCmbBoxDelegate::updateEditorGeometry(QWidget *editor, const QStyleO void ActivityCmbBoxDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const { QStyleOptionViewItem myOptions = option; + //! Remove the focus dotted lines + myOptions.state = (myOptions.state & ~QStyle::State_HasFocus); painter->save(); QStringList assignedActivities = index.model()->data(index, Qt::UserRole).toStringList(); diff --git a/app/settings/delegates/checkboxdelegate.cpp b/app/settings/delegates/checkboxdelegate.cpp index bf08defa4..d9cebd5f5 100644 --- a/app/settings/delegates/checkboxdelegate.cpp +++ b/app/settings/delegates/checkboxdelegate.cpp @@ -37,10 +37,14 @@ CheckBoxDelegate::CheckBoxDelegate(QObject *parent) void CheckBoxDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const { + QStyleOptionViewItem adjustedOption = option; + //! Remove the focus dotted lines + adjustedOption.state = (adjustedOption.state & ~QStyle::State_HasFocus); + QStandardItemModel *model = (QStandardItemModel *) index.model(); - QStyledItemDelegate::paint(painter, option, model->index(index.row(), HIDDENTEXTCOLUMN)); + QStyledItemDelegate::paint(painter, adjustedOption, model->index(index.row(), HIDDENTEXTCOLUMN)); - QStyledItemDelegate::paint(painter, option, index); + QStyledItemDelegate::paint(painter, adjustedOption, index); } bool CheckBoxDelegate::editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, diff --git a/app/settings/delegates/layoutnamedelegate.cpp b/app/settings/delegates/layoutnamedelegate.cpp index 82f376a47..503418d30 100644 --- a/app/settings/delegates/layoutnamedelegate.cpp +++ b/app/settings/delegates/layoutnamedelegate.cpp @@ -40,9 +40,14 @@ void LayoutNameDelegate::paint(QPainter *painter, const QStyleOptionViewItem &op { bool isLocked = index.data(Qt::UserRole).toBool(); + QStyleOptionViewItem adjustedOption = option; + //! Remove the focus dotted lines + adjustedOption.state = (adjustedOption.state & ~QStyle::State_HasFocus); + if (isLocked) { QStandardItemModel *model = (QStandardItemModel *) index.model(); QString nameText = index.data(Qt::DisplayRole).toString(); + bool selected = ((option.state & QStyle::State_Active) && (option.state & QStyle::State_Selected)); //! font metrics QFontMetrics fm(option.font); @@ -54,9 +59,9 @@ void LayoutNameDelegate::paint(QPainter *painter, const QStyleOptionViewItem &op QRect destinationS(option.rect.x(), option.rect.y(), startWidth, thick); QRect destinationE(option.rect.x() + option.rect.width() - thick, option.rect.y(), endWidth, thick); - QStyleOptionViewItem myOptionS = option; - QStyleOptionViewItem myOptionE = option; - QStyleOptionViewItem myOptionMain = option; + QStyleOptionViewItem myOptionS = adjustedOption; + QStyleOptionViewItem myOptionE = adjustedOption; + QStyleOptionViewItem myOptionMain = adjustedOption; myOptionS.rect = destinationS; myOptionE.rect = destinationE; myOptionMain.rect.setX(option.rect.x() + startWidth); @@ -67,82 +72,22 @@ void LayoutNameDelegate::paint(QPainter *painter, const QStyleOptionViewItem &op //! draw background at edges QStyledItemDelegate::paint(painter, myOptionS, model->index(index.row(), HIDDENTEXTCOLUMN)); - //! Lock Icon 1: Unicode character attempt - /*QString s = QChar(0x2318); - QString s = QChar(0x2757); - myOptionE.text = s;*/ QStyledItemDelegate::paint(painter, myOptionE, model->index(index.row(), HIDDENTEXTCOLUMN)); - //! Lock Icon 2: QIcon attempt that doesn't change color + //! Lock Icon QIcon lockIcon = QIcon::fromTheme("object-locked"); - if (qApp->layoutDirection() == Qt::RightToLeft) { - painter->drawPixmap(destinationS, lockIcon.pixmap(thick, thick)); - } else { - painter->drawPixmap(destinationE, lockIcon.pixmap(thick, thick)); - } - - //! Lock Icon 3: QIcon and change colors attempt - /*QIcon lockIcon = QIcon::fromTheme("object-locked"); - QPixmap origPixmap = lockIcon.pixmap(thick, thick); - QPixmap lockPixmap = origPixmap; - - QBrush nBrush; - - if ((option.state & QStyle::State_Active) && (option.state & QStyle::State_Selected)) { - nBrush = option.palette.brush(QPalette::Active, QPalette::HighlightedText); - } else { - nBrush = option.palette.brush(QPalette::Inactive, QPalette::Text); - } - - lockPixmap.fill(nBrush.color()); - lockPixmap.setMask(origPixmap.createMaskFromColor(Qt::transparent)); - - painter->drawPixmap(destinationE, lockPixmap);*/ + QIcon::Mode mode = selected ? QIcon::Selected : QIcon::Normal; - //! Lock Icon 4: Plasma::Svg and change color group attempt - /*Plasma::Svg svgIcon; - - svgIcon.setStatus(Plasma::Svg::Normal); - svgIcon.setUsingRenderingCache(false); - svgIcon.setDevicePixelRatio(qApp->devicePixelRatio()); - - //! find path - //try to load from iconloader an svg with Plasma::Svg - const auto *iconTheme = KIconLoader::global()->theme(); - QString iconPath; - - if (iconTheme) { - iconPath = iconTheme->iconPath("object-locked" + QLatin1String(".svg") - , thick - , KIconLoader::MatchBest); - - if (iconPath.isEmpty()) { - iconPath = iconTheme->iconPath("object-locked" + QLatin1String(".svgz") - , thick - , KIconLoader::MatchBest); - } + if (qApp->layoutDirection() == Qt::RightToLeft) { + painter->drawPixmap(destinationS, lockIcon.pixmap(thick, thick, mode)); } else { - qWarning() << "KIconLoader has no theme set"; + painter->drawPixmap(destinationE, lockIcon.pixmap(thick, thick, mode)); } - if (!iconPath.isEmpty()) { - svgIcon.setImagePath(iconPath); - - if ((option.state & QStyle::State_Active) && (option.state & QStyle::State_Selected)) { - svgIcon.setColorGroup(Plasma::Theme::ComplementaryColorGroup); - } else { - svgIcon.setColorGroup(Plasma::Theme::NormalColorGroup); - } - - svgIcon.resize(thick, thick); - } - - painter->drawPixmap(destinationE, svgIcon.pixmap());*/ - return; } - QStyledItemDelegate::paint(painter, option, index); + QStyledItemDelegate::paint(painter, adjustedOption, index); } diff --git a/app/settings/settingsdialog.ui b/app/settings/settingsdialog.ui index adef89555..daa73007a 100644 --- a/app/settings/settingsdialog.ui +++ b/app/settings/settingsdialog.ui @@ -6,8 +6,8 @@ 0 0 - 936 - 710 + 850 + 636 @@ -95,6 +95,9 @@ + + true + true @@ -444,8 +447,8 @@ 0 0 - 496 - 575 + 894 + 594