┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews/kitemlistview.cpp
diff options
context:
space:
mode:
authorEmmanuel Pescosta <[email protected]>2014-02-24 14:17:03 +0100
committerEmmanuel Pescosta <[email protected]>2014-02-24 14:17:03 +0100
commit0d37038b407944a9b7ec05127b5b6d41dc1a496f (patch)
tree17c38052274173f1b0d4c26fb5f7559bef37fd6e /src/kitemviews/kitemlistview.cpp
parentc2887688f102d0412ba93c74facd5ed007185e3a (diff)
Handle font and palette changes in Dolphin list views.
Also update the font of the meta data widget in InformationPanelContent (smallest readable font). BUG: 329186 BUG: 315061 FIXED-IN: 4.13 REVIEW: 115958
Diffstat (limited to 'src/kitemviews/kitemlistview.cpp')
-rw-r--r--src/kitemviews/kitemlistview.cpp41
1 files changed, 37 insertions, 4 deletions
diff --git a/src/kitemviews/kitemlistview.cpp b/src/kitemviews/kitemlistview.cpp
index 82f8a2053..ab420cab1 100644
--- a/src/kitemviews/kitemlistview.cpp
+++ b/src/kitemviews/kitemlistview.cpp
@@ -893,11 +893,23 @@ void KItemListView::onTransactionEnd()
bool KItemListView::event(QEvent* event)
{
- // Forward all events to the controller and handle them there
- if (!m_editingRole && m_controller && m_controller->processEvent(event, transform())) {
- event->accept();
- return true;
+ switch (event->type()) {
+ case QEvent::PaletteChange:
+ updatePalette();
+ break;
+
+ case QEvent::FontChange:
+ updateFont();
+ break;
+
+ default:
+ // Forward all other events to the controller and handle them there
+ if (!m_editingRole && m_controller && m_controller->processEvent(event, transform())) {
+ event->accept();
+ return true;
+ }
}
+
return QGraphicsWidget::event(event);
}
@@ -950,6 +962,27 @@ QList<KItemListWidget*> KItemListView::visibleItemListWidgets() const
return m_visibleItems.values();
}
+void KItemListView::updateFont()
+{
+ if (scene() && !scene()->views().isEmpty()) {
+ KItemListStyleOption option = styleOption();
+ option.font = scene()->views().first()->font();
+ option.fontMetrics = QFontMetrics(option.font);
+
+ setStyleOption(option);
+ }
+}
+
+void KItemListView::updatePalette()
+{
+ if (scene() && !scene()->views().isEmpty()) {
+ KItemListStyleOption option = styleOption();
+ option.palette = scene()->views().first()->palette();
+
+ setStyleOption(option);
+ }
+}
+
void KItemListView::slotItemsInserted(const KItemRangeList& itemRanges)
{
if (m_itemSize.isEmpty()) {