summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin T. H. Sandsmark <martin.sandsmark@kde.org>2016-07-24 14:59:34 (GMT)
committerMartin T. H. Sandsmark <martin.sandsmark@kde.org>2016-07-24 14:59:34 (GMT)
commitad8b35a69008d708c7163c76f7f0170c2c8d5373 (patch)
treee420f4133854fa4f033a5c0a566e17b0d07d901b
parent06edec49fd681cb6abe024df65d66b06f45dbf8f (diff)
Fix updating of palette in sidebar
-rw-r--r--ui/sidebar.cpp12
-rw-r--r--ui/sidebar.h1
2 files changed, 4 insertions, 9 deletions
diff --git a/ui/sidebar.cpp b/ui/sidebar.cpp
index 72803d8..4e207e7 100644
--- a/ui/sidebar.cpp
+++ b/ui/sidebar.cpp
@@ -77,12 +77,14 @@ class SidebarDelegate : public QAbstractItemDelegate
void setShowText( bool show );
bool isTextShown() const;
- void updateBrushCache();
// from QAbstractItemDelegate
void paint( QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index ) const;
QSize sizeHint( const QStyleOptionViewItem &option, const QModelIndex &index ) const;
+ private slots:
+ void updateBrushCache();
+
private:
bool m_showText;
QScopedPointer<KStatefulBrush> m_windowBackground;
@@ -97,6 +99,7 @@ SidebarDelegate::SidebarDelegate( QObject *parent )
m_selectionBackground( 0 ), m_selectionForeground( 0 )
{
updateBrushCache();
+ connect(qApp, &QGuiApplication::paletteChanged, this, &SidebarDelegate::updateBrushCache);
}
SidebarDelegate::~SidebarDelegate()
@@ -502,8 +505,6 @@ Sidebar::Sidebar( QWidget *parent )
connect(d->list, &SidebarListWidget::customContextMenuRequested, this, &Sidebar::listContextMenu);
connect(d->splitter, &QSplitter::splitterMoved, this, &Sidebar::splitterMoved);
- connect(KGlobalSettings::self(), &KGlobalSettings::appearanceChanged, this, &Sidebar::appearanceChanged);
-
setCollapsed( true );
setFocusProxy( d->list );
}
@@ -798,11 +799,6 @@ void Sidebar::iconSizeChanged( QAction *action )
Okular::Settings::self()->save();
}
-void Sidebar::appearanceChanged()
-{
- d->sideDelegate->updateBrushCache();
-}
-
void Sidebar::dragEnterEvent( QDragEnterEvent* event )
{
event->setAccepted( event->mimeData()->hasUrls() );
diff --git a/ui/sidebar.h b/ui/sidebar.h
index f337a40..14b165e 100644
--- a/ui/sidebar.h
+++ b/ui/sidebar.h
@@ -58,7 +58,6 @@ class Sidebar : public QWidget
void listContextMenu( const QPoint & );
void showTextToggled( bool );
void iconSizeChanged( QAction *action );
- void appearanceChanged();
private:
void setIndexEnabled( int index, bool enabled );