summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2015-08-18 10:12:39 +0200
committerMontel Laurent <[email protected]>2015-08-18 10:12:39 +0200
commit3889fcf78733742b17343a4d99f145d6297f52aa (patch)
tree3102e137e72413f546ec50078a24040e4764c6e6
parent7c20e50bb41c4357bbbd338f2d96184467ea03c8 (diff)
Use QEvent::FontChange
-rw-r--r--messagelist/core/themedelegate.cpp4
-rw-r--r--messagelist/core/themedelegate.h9
-rw-r--r--messagelist/core/view.cpp3
-rw-r--r--messagelist/utils/themeeditor.cpp9
-rw-r--r--messagelist/utils/themeeditor.h1
5 files changed, 17 insertions, 9 deletions
diff --git a/messagelist/core/themedelegate.cpp b/messagelist/core/themedelegate.cpp
index 8d165e1..41a8af5 100644
--- a/messagelist/core/themedelegate.cpp
+++ b/messagelist/core/themedelegate.cpp
@@ -33,7 +33,6 @@
#include <QPixmap>
#include <QLinearGradient>
#include <KColorScheme>
-//#include <KGlobalSettings>
#include <QFontDatabase>
using namespace MessageList::Core;
@@ -51,7 +50,6 @@ ThemeDelegate::ThemeDelegate(QAbstractItemView *parent)
{
mItemView = parent;
mTheme = Q_NULLPTR;
- //connect(KGlobalSettings::self(), &KGlobalSettings::kdisplayFontChanged, this, &ThemeDelegate::slotGeneralFontChanged);
}
ThemeDelegate::~ThemeDelegate()
@@ -1654,7 +1652,7 @@ QString ThemeDelegate::itemFontKey(const Theme::ContentItem *ci, const Item *ite
}
// Store the new fontKey when the generalFont changes.
-void ThemeDelegate::slotGeneralFontChanged()
+void ThemeDelegate::generalFontChanged()
{
s_static->mGeneralFontKey = QFontDatabase::systemFont(QFontDatabase::GeneralFont).key();
}
diff --git a/messagelist/core/themedelegate.h b/messagelist/core/themedelegate.h
index 02743f0..5bd9ba2 100644
--- a/messagelist/core/themedelegate.h
+++ b/messagelist/core/themedelegate.h
@@ -49,6 +49,10 @@ class ThemeDelegate : public QStyledItemDelegate
public:
explicit ThemeDelegate(QAbstractItemView *parent);
~ThemeDelegate();
+ /**
+ * Called when the global fonts change (from systemsettings)
+ */
+ void generalFontChanged();
private:
const Theme *mTheme; ///< Shallow pointer to the current theme
@@ -242,11 +246,6 @@ protected:
*/
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const Q_DECL_OVERRIDE;
-private Q_SLOTS:
- /**
- * Called when the global fonts change (from systemsettings)
- */
- void slotGeneralFontChanged();
};
} // namespace Core
diff --git a/messagelist/core/view.cpp b/messagelist/core/view.cpp
index 8a006be..afa805c 100644
--- a/messagelist/core/view.cpp
+++ b/messagelist/core/view.cpp
@@ -2295,8 +2295,9 @@ void View::dropEvent(QDropEvent *e)
void View::changeEvent(QEvent *e)
{
switch (e->type()) {
- case QEvent::PaletteChange:
case QEvent::FontChange:
+ d->mDelegate->generalFontChanged();
+ case QEvent::PaletteChange:
case QEvent::StyleChange:
case QEvent::LayoutDirectionChange:
case QEvent::LocaleChange:
diff --git a/messagelist/utils/themeeditor.cpp b/messagelist/utils/themeeditor.cpp
index b6da944..a4c649c 100644
--- a/messagelist/utils/themeeditor.cpp
+++ b/messagelist/utils/themeeditor.cpp
@@ -282,6 +282,15 @@ ThemePreviewWidget::ThemePreviewWidget(QWidget *parent)
header()->setMovable(false);
}
+void ThemePreviewWidget::changeEvent(QEvent *event)
+{
+ if (event->type() == QEvent::FontChange) {
+ mDelegate->generalFontChanged();
+ }
+ QTreeWidget::changeEvent(event);
+}
+
+
ThemePreviewWidget::~ThemePreviewWidget()
{
}
diff --git a/messagelist/utils/themeeditor.h b/messagelist/utils/themeeditor.h
index 327861d..e6650e5 100644
--- a/messagelist/utils/themeeditor.h
+++ b/messagelist/utils/themeeditor.h
@@ -145,6 +145,7 @@ protected:
void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
void paintEvent(QPaintEvent *e) Q_DECL_OVERRIDE;
void showEvent(QShowEvent *e) Q_DECL_OVERRIDE;
+ void changeEvent(QEvent *event) Q_DECL_OVERRIDE;
private:
void internalHandleDragMoveEvent(QDragMoveEvent *e);