┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews/kitemlistview.cpp
diff options
context:
space:
mode:
authorFrank Reininghaus <[email protected]>2014-05-13 18:42:05 +0200
committerFrank Reininghaus <[email protected]>2014-05-13 18:42:05 +0200
commit4cf04b91dd8804f2536fc31ae2f1b486bfc8cf9c (patch)
tree75aee505fe55fabedf33fa202cc4b4e4f6481a71 /src/kitemviews/kitemlistview.cpp
parent7e92abb4ea2c2b269d21973bc9f2e76da5fb9114 (diff)
parent5780fab172e02c3dd44082aa10d37cd87a98e29b (diff)
Merge remote-tracking branch 'origin/master' into frameworks
Since the master branch had never been merged into frameworks since the creation of the frameworks branch, I had to fix a couple of merge conflicts and make another change in order to make it build - I hope I did not get anything wrong. We should probably merge master into frameworks on a regular basis from now on. CCMAIL:[email protected] Conflicts: dolphin/src/dolphinmainwindow.cpp dolphin/src/search/dolphinfacetswidget.cpp dolphin/src/statusbar/dolphinstatusbar.cpp dolphin/src/views/dolphinview.cpp
Diffstat (limited to 'src/kitemviews/kitemlistview.cpp')
-rw-r--r--src/kitemviews/kitemlistview.cpp44
1 files changed, 39 insertions, 5 deletions
diff --git a/src/kitemviews/kitemlistview.cpp b/src/kitemviews/kitemlistview.cpp
index abde53904..0090f8620 100644
--- a/src/kitemviews/kitemlistview.cpp
+++ b/src/kitemviews/kitemlistview.cpp
@@ -765,7 +765,8 @@ void KItemListView::setStyleOption(const KItemListStyleOption& option)
updateGroupHeaderHeight();
}
- if (animate && previousOption.maxTextSize != option.maxTextSize) {
+ if (animate &&
+ (previousOption.maxTextLines != option.maxTextLines || previousOption.maxTextWidth != option.maxTextWidth)) {
// Animating a change of the maximum text size just results in expensive
// temporary eliding and clipping operations and does not look good visually.
animate = false;
@@ -898,11 +899,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);
}
@@ -955,6 +968,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()) {