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 "ui_iconchooser.h"
|
||||
#include "mainapplication.h"
|
||||
#include "proxystyle.h"
|
||||
#include "qztools.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
@ -115,8 +117,12 @@ void IconChooserDelegate::paint(QPainter* painter, const QStyleOptionViewItem &o
|
||||
const QStyle* style = w ? w->style() : QApplication::style();
|
||||
|
||||
// Draw background
|
||||
// Use PanelItemViewRow, because of Qt5's Fusion style incorrectly renders PanelItemViewItem
|
||||
style->drawPrimitive(QStyle::PE_PanelItemViewRow, &opt, painter, w);
|
||||
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
|
||||
QIcon icon = index.data(Qt::DecorationRole).value<QIcon>();
|
||||
|
@ -16,6 +16,8 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* ============================================================ */
|
||||
#include "listitemdelegate.h"
|
||||
#include "mainapplication.h"
|
||||
#include "proxystyle.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QPainter>
|
||||
@ -65,7 +67,12 @@ void ListItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem &opti
|
||||
|
||||
// Draw background
|
||||
// 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
|
||||
QRect iconRect(opt.rect.left() + (opt.rect.width() - m_iconSize) / 2, topPosition, m_iconSize, m_iconSize);
|
||||
|
Loading…
Reference in New Issue
Block a user