1
0
mirror of https://github.com/KDE/latte-dock.git synced 2024-12-24 05:33:50 +03:00

improve alignments for layouts delegates

This commit is contained in:
Michail Vourlakos 2020-03-16 14:47:42 +02:00
parent 9a3918763b
commit 92f37eef8c
3 changed files with 8 additions and 8 deletions

View File

@ -47,7 +47,7 @@ void CheckBox::paint(QPainter *painter, const QStyleOptionViewItem &option, cons
QStyleOptionViewItem adjustedOption = option; QStyleOptionViewItem adjustedOption = option;
//! Remove the focus dotted lines //! Remove the focus dotted lines
adjustedOption.state = (adjustedOption.state & ~QStyle::State_HasFocus); adjustedOption.state = (adjustedOption.state & ~QStyle::State_HasFocus);
adjustedOption.displayAlignment = Qt::AlignHCenter; adjustedOption.displayAlignment = Qt::AlignHCenter | Qt::AlignVCenter;
bool isSharedCapable = index.data(Model::Layouts::LAYOUTISSHAREDROLE).toBool() && index.data(Model::Layouts::INMULTIPLELAYOUTSROLE).toBool(); bool isSharedCapable = index.data(Model::Layouts::LAYOUTISSHAREDROLE).toBool() && index.data(Model::Layouts::INMULTIPLELAYOUTSROLE).toBool();

View File

@ -122,7 +122,7 @@ void LayoutName::paint(QPainter *painter, const QStyleOptionViewItem &option, co
//! Lock Icon //! Lock Icon
QIcon firstIcon = isLocked && !showTwoIcons ? QIcon::fromTheme("object-locked") : QIcon::fromTheme("document-share"); QIcon firstIcon = isLocked && !showTwoIcons ? QIcon::fromTheme("object-locked") : QIcon::fromTheme("document-share");
QIcon::Mode mode = selected ? QIcon::Selected : QIcon::Normal; QIcon::Mode mode = selected && (Latte::colorGroup(option) == QPalette::Active) ? QIcon::Selected : QIcon::Normal;
if (qApp->layoutDirection() == Qt::RightToLeft) { if (qApp->layoutDirection() == Qt::RightToLeft) {
painter->drawPixmap(QRect(option.rect.x(), option.rect.y(), thick, thick), firstIcon.pixmap(thick, thick, mode)); painter->drawPixmap(QRect(option.rect.x(), option.rect.y(), thick, thick), firstIcon.pixmap(thick, thick, mode));

View File

@ -230,19 +230,19 @@ QVariant Layouts::headerData(int section, Qt::Orientation orientation, int role)
break; break;
case BACKGROUNDCOLUMN: case BACKGROUNDCOLUMN:
if (role == Qt::DisplayRole) { if (role == Qt::DisplayRole) {
return QString("");//(i18nc("column for layout background", "Background")); return QIcon::fromTheme("games-config-background");//(i18nc("column for layout background", "Background"));
} else if (role == Qt::DecorationRole) { } else if (role == Qt::DecorationRole) {
return QIcon::fromTheme("games-config-background");//QString();//QIcon::fromTheme("games-config-background"); return QString("");//QIcon::fromTheme("games-config-background");//QString();//QIcon::fromTheme("games-config-background");
} else if (role == Qt::TextAlignmentRole ){ }/* else if (role == Qt::TextAlignmentRole ){
return QVariant::fromValue(Qt::AlignHCenter | Qt::AlignVCenter); return QVariant::fromValue(Qt::AlignHCenter | Qt::AlignVCenter);
} }*/
break; break;
case NAMECOLUMN: case NAMECOLUMN:
if (role == Qt::DisplayRole) { if (role == Qt::DisplayRole) {
return QString(i18nc("column for layout name", "Name")); return QString(i18nc("column for layout name", "Name"));
} else if (role == Qt::TextAlignmentRole) { }/* else if (role == Qt::TextAlignmentRole) {
return QVariant::fromValue(Qt::AlignLeft | Qt::AlignVCenter); return QVariant::fromValue(Qt::AlignLeft | Qt::AlignVCenter);
} }*/
break; break;
case MENUCOLUMN: case MENUCOLUMN:
if (role == Qt::DisplayRole) { if (role == Qt::DisplayRole) {