Changeset View
Changeset View
Standalone View
Standalone View
kstyle/breezestyle.cpp
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show First 20 Lines • Show All 54 Lines • ▼ Show 20 Line(s) | |||||
55 | #include <QSplitterHandle> | 55 | #include <QSplitterHandle> | ||
56 | #include <QTextEdit> | 56 | #include <QTextEdit> | ||
57 | #include <QToolBar> | 57 | #include <QToolBar> | ||
58 | #include <QToolBox> | 58 | #include <QToolBox> | ||
59 | #include <QToolButton> | 59 | #include <QToolButton> | ||
60 | #include <QTreeView> | 60 | #include <QTreeView> | ||
61 | #include <QWidgetAction> | 61 | #include <QWidgetAction> | ||
62 | 62 | | |||
63 | #if BREEZE_HAVE_QTQUICK | ||||
64 | #include <QQuickWindow> | ||||
65 | #endif | ||||
66 | | ||||
63 | namespace BreezePrivate | 67 | namespace BreezePrivate | ||
64 | { | 68 | { | ||
65 | 69 | | |||
66 | // needed to keep track of tabbars when being dragged | 70 | // needed to keep track of tabbars when being dragged | ||
67 | class TabBarData: public QObject | 71 | class TabBarData: public QObject | ||
68 | { | 72 | { | ||
69 | 73 | | |||
70 | public: | 74 | public: | ||
▲ Show 20 Lines • Show All 4494 Lines • ▼ Show 20 Line(s) | 4566 | if (!cb->currentIcon.isNull()) { | |||
4565 | if ((cb->state & QStyle::State_Selected) && (cb->state & QStyle::State_Active)) { | 4569 | if ((cb->state & QStyle::State_Selected) && (cb->state & QStyle::State_Active)) { | ||
4566 | mode = QIcon::Selected; | 4570 | mode = QIcon::Selected; | ||
4567 | } else if (cb->state & QStyle::State_Enabled) { | 4571 | } else if (cb->state & QStyle::State_Enabled) { | ||
4568 | mode = QIcon::Normal; | 4572 | mode = QIcon::Normal; | ||
4569 | } else { | 4573 | } else { | ||
4570 | mode = QIcon::Disabled; | 4574 | mode = QIcon::Disabled; | ||
4571 | } | 4575 | } | ||
4572 | 4576 | | |||
4573 | const auto pixmap = cb->currentIcon.pixmap(widget->windowHandle(), cb->iconSize, mode); | 4577 | QWindow *window = nullptr; | ||
4578 | if (widget && widget->window()) { | ||||
4579 | window = widget->window()->windowHandle(); | ||||
4580 | #if BREEZE_HAVE_QTQUICK | ||||
4581 | } else if (QQuickItem *quickItem = qobject_cast<QQuickItem *>(option->styleObject)) { | ||||
4582 | window = quickItem->window(); | ||||
4583 | #endif | ||||
4584 | } | ||||
4585 | | ||||
4586 | const auto pixmap = cb->currentIcon.pixmap(window, cb->iconSize, mode); | ||||
4574 | auto iconRect(editRect); | 4587 | auto iconRect(editRect); | ||
4575 | iconRect.setWidth(cb->iconSize.width() + 4); | 4588 | iconRect.setWidth(cb->iconSize.width() + 4); | ||
4576 | iconRect = alignedRect(cb->direction, | 4589 | iconRect = alignedRect(cb->direction, | ||
4577 | Qt::AlignLeft | Qt::AlignVCenter, | 4590 | Qt::AlignLeft | Qt::AlignVCenter, | ||
4578 | iconRect.size(), editRect); | 4591 | iconRect.size(), editRect); | ||
4579 | if (cb->editable) | 4592 | if (cb->editable) | ||
4580 | painter->fillRect(iconRect, option->palette.brush(QPalette::Base)); | 4593 | painter->fillRect(iconRect, option->palette.brush(QPalette::Base)); | ||
4581 | proxy()->drawItemPixmap(painter, iconRect, Qt::AlignCenter, pixmap); | 4594 | proxy()->drawItemPixmap(painter, iconRect, Qt::AlignCenter, pixmap); | ||
▲ Show 20 Lines • Show All 2662 Lines • Show Last 20 Lines |