mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 10:46:35 +01:00
[ListItems] Apply workaround only for Fusion style
It actually breaks other styles ...
Fixes 2105b48ca4
This commit is contained in:
parent
dab7c82ae8
commit
0da5bf7994
@ -17,6 +17,8 @@
|
|||||||
* ============================================================ */
|
* ============================================================ */
|
||||||
#include "iconchooser.h"
|
#include "iconchooser.h"
|
||||||
#include "ui_iconchooser.h"
|
#include "ui_iconchooser.h"
|
||||||
|
#include "mainapplication.h"
|
||||||
|
#include "proxystyle.h"
|
||||||
#include "qztools.h"
|
#include "qztools.h"
|
||||||
|
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
@ -115,8 +117,12 @@ void IconChooserDelegate::paint(QPainter* painter, const QStyleOptionViewItem &o
|
|||||||
const QStyle* style = w ? w->style() : QApplication::style();
|
const QStyle* style = w ? w->style() : QApplication::style();
|
||||||
|
|
||||||
// Draw background
|
// Draw background
|
||||||
// Use PanelItemViewRow, because of Qt5's Fusion style incorrectly renders PanelItemViewItem
|
if (mApp->proxyStyle()->name() == QLatin1String("fusion")) {
|
||||||
style->drawPrimitive(QStyle::PE_PanelItemViewRow, &opt, painter, w);
|
style->drawPrimitive(QStyle::PE_PanelItemViewRow, &opt, painter, w);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
style->drawPrimitive(QStyle::PE_PanelItemViewItem, &opt, painter, w);
|
||||||
|
}
|
||||||
|
|
||||||
// Draw icon
|
// Draw icon
|
||||||
QIcon icon = index.data(Qt::DecorationRole).value<QIcon>();
|
QIcon icon = index.data(Qt::DecorationRole).value<QIcon>();
|
||||||
|
@ -16,6 +16,8 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* ============================================================ */
|
* ============================================================ */
|
||||||
#include "listitemdelegate.h"
|
#include "listitemdelegate.h"
|
||||||
|
#include "mainapplication.h"
|
||||||
|
#include "proxystyle.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
@ -65,7 +67,12 @@ void ListItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem &opti
|
|||||||
|
|
||||||
// Draw background
|
// Draw background
|
||||||
// Use PanelItemViewRow, because of Qt5's Fusion style incorrectly renders PanelItemViewItem
|
// Use PanelItemViewRow, because of Qt5's Fusion style incorrectly renders PanelItemViewItem
|
||||||
style->drawPrimitive(QStyle::PE_PanelItemViewRow, &opt, painter);
|
if (mApp->proxyStyle()->name() == QLatin1String("fusion")) {
|
||||||
|
style->drawPrimitive(QStyle::PE_PanelItemViewRow, &opt, painter, w);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
style->drawPrimitive(QStyle::PE_PanelItemViewItem, &opt, painter, w);
|
||||||
|
}
|
||||||
|
|
||||||
// Draw icon
|
// Draw icon
|
||||||
QRect iconRect(opt.rect.left() + (opt.rect.width() - m_iconSize) / 2, topPosition, m_iconSize, m_iconSize);
|
QRect iconRect(opt.rect.left() + (opt.rect.width() - m_iconSize) / 2, topPosition, m_iconSize, m_iconSize);
|
||||||
|
Loading…
Reference in New Issue
Block a user