X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/c2fa8ae9ab0df08781b7d032e99d7b8f220c10e0..8fda69892284144a8aea3845d2aad844021c99d2:/src/kitemviews/kstandarditemlistgroupheader.cpp diff --git a/src/kitemviews/kstandarditemlistgroupheader.cpp b/src/kitemviews/kstandarditemlistgroupheader.cpp index 062b20e90..28497ddfc 100644 --- a/src/kitemviews/kstandarditemlistgroupheader.cpp +++ b/src/kitemviews/kstandarditemlistgroupheader.cpp @@ -1,23 +1,10 @@ -/*************************************************************************** - * Copyright (C) 2011 by Peter Penz * - * * - * Based on the Itemviews NG project from Trolltech Labs * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2011 Peter Penz + * + * Based on the Itemviews NG project from Trolltech Labs + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #include "kstandarditemlistgroupheader.h" @@ -30,8 +17,7 @@ KStandardItemListGroupHeader::KStandardItemListGroupHeader(QGraphicsWidget* pare m_text(), m_pixmap() { - m_text.setTextFormat(Qt::PlainText); - m_text.setPerformanceHint(QStaticText::AggressiveCaching); + } KStandardItemListGroupHeader::~KStandardItemListGroupHeader() @@ -50,7 +36,7 @@ void KStandardItemListGroupHeader::paintRole(QPainter* painter, const QRectF& ro { if (m_pixmap.isNull()) { painter->setPen(color); - painter->drawStaticText(roleBounds.topLeft(), m_text); + painter->drawText(roleBounds, 0, m_text); } else { painter->drawPixmap(roleBounds.topLeft(), m_pixmap); } @@ -68,7 +54,11 @@ void KStandardItemListGroupHeader::paintSeparator(QPainter* painter, const QColo if (scrollOrientation() == Qt::Horizontal) { painter->drawLine(0, 0, 0, size().height() - 1); } else { - painter->drawLine(0, 0, size().width() - 1, 0); + if (layoutDirection() == Qt::LeftToRight) { + painter->drawLine(0, 0, size().width() - 1, 0); + } else { + painter->drawLine(1, 0, size().width(), 0); + } } } @@ -88,7 +78,7 @@ void KStandardItemListGroupHeader::dataChanged(const QVariant& current, const QV void KStandardItemListGroupHeader::resizeEvent(QGraphicsSceneResizeEvent* event) { - QGraphicsWidget::resizeEvent(event); + KItemListGroupHeader::resizeEvent(event); m_dirtyCache = true; } @@ -100,7 +90,7 @@ void KStandardItemListGroupHeader::updateCache() const qreal maxWidth = size().width() - 4 * styleOption().padding; if (role() == "rating") { - m_text.setText(QString()); + m_text = QString(); const qreal height = styleOption().fontMetrics.ascent(); const QSizeF pixmapSize(qMin(height * 5, maxWidth), height); @@ -117,7 +107,7 @@ void KStandardItemListGroupHeader::updateCache() QFontMetricsF fontMetrics(font()); const QString text = fontMetrics.elidedText(data().toString(), Qt::ElideRight, maxWidth); - m_text.setText(text); + m_text = text; } }