summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHuon Imberger <[email protected]>2018-02-26 23:30:24 +0100
committerHenrik Fehlauer <[email protected]>2018-02-26 23:32:50 +0100
commit98459b79673ef571d4e26bc5732f487f26c77afe (patch)
tree504e660b794e771237c12a350b5de230910fab67
parentf87cd4b930fc13b2dc3d94aa35108f1c4cc6710a (diff)
Replace manual palette adjustment with background role (fullscreen info label)
Summary: Instead of customising the palette, then monitoring for changes, we set the background color role of the widget. This has the benefit of keeping the palette inherited, therefore changes to the system palette still propogate. Not to mention we don't need to watch for palette change events. Test Plan: The information label in fullscreen (where the filename is displayed) should not significantly change color. A slight change is expected as we are not manually setting it but using a pre-determined role. Reviewers: #gwenview, rkflx Reviewed By: #gwenview, rkflx Differential Revision: https://phabricator.kde.org/D10781
-rw-r--r--app/fullscreencontent.cpp9
-rw-r--r--app/fullscreencontent.h1
2 files changed, 1 insertions, 9 deletions
diff --git a/app/fullscreencontent.cpp b/app/fullscreencontent.cpp
index 1c66e02..1339b0c 100644
--- a/app/fullscreencontent.cpp
+++ b/app/fullscreencontent.cpp
@@ -129,7 +129,6 @@ void FullScreenContent::init(KActionCollection* actionCollection, QWidget* autoH
mContent->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
mContent->setAutoFillBackground(true);
EventWatcher::install(mContent, QEvent::Show, this, SLOT(updateCurrentUrlWidgets()));
- EventWatcher::install(mContent, QEvent::PaletteChange, this, SLOT(slotPaletteChanged()));
layout->addWidget(mContent);
createOptionsAction();
@@ -156,6 +155,7 @@ void FullScreenContent::init(KActionCollection* actionCollection, QWidget* autoH
mInformationLabel->setContentsMargins(6, 0, 6, 0);
mInformationLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
mInformationLabel->setAutoFillBackground(true);
+ mInformationLabel->setBackgroundRole(QPalette::Mid);
mInformationLabelShadow = new ShadowFilter(mInformationLabel);
// Thumbnail bar
@@ -219,13 +219,6 @@ void FullScreenContent::updateInformationLabel()
mInformationLabel->setText(text);
}
-void FullScreenContent::slotPaletteChanged()
-{
- QPalette pal = mContent->palette();
- pal.setColor(QPalette::Window, pal.color(QPalette::Window).dark(110));
- mInformationLabel->setPalette(pal);
-}
-
void FullScreenContent::updateCurrentUrlWidgets()
{
updateInformationLabel();
diff --git a/app/fullscreencontent.h b/app/fullscreencontent.h
index a077724..12bde9c 100644
--- a/app/fullscreencontent.h
+++ b/app/fullscreencontent.h
@@ -84,7 +84,6 @@ private Q_SLOTS:
void updateInformationLabel();
void updateMetaInfoDialog();
void showImageMetaInfoDialog();
- void slotPaletteChanged();
void slotImageMetaInfoDialogClosed();
void slotPreferredMetaInfoKeyListChanged(const QStringList& list);
void showOptionsMenu();