How to customize the QScrollBar "corner" area?
-
In CSS this area (6) can be style with
-webkit-scrollbar-corner
The area where the horizontal and vertical scrollbars match:
I could not find a mention to this area in the documentation neither in the customizing qscrollbar example.
How i could customize this same area in a QScrollBar? using stylesheet or proxy style, etc, anything help.
-
@Daniella said in How to customize the QScrollBar "corner" area?:
How i could customize this same area in a QScrollBar?
This is actually part of
QAbstractScrollArea
(the background area on which the scrollBars are)You can customize it with
// w = your widget which provides the scrollBars w->setStyleSheet("QAbstractScrollArea::corner { background: black;}");
-
@Pl45m4 said in How to customize the QScrollBar "corner" area?:
@Daniella said in How to customize the QScrollBar "corner" area?:
How i could customize this same area in a QScrollBar?
This is actually part of
QAbstractScrollArea
(the background area on which the scrollBars are)You can customize it with
// w = your widget which provides the scrollBars w->setStyleSheet("QAbstractScrollArea::corner { background: black;}");
I have tried "hide" it setting
QAbstractScrollArea::corner { width: 0px; height: 0px;}
alsomax-height: 0;
but its space continue there.I think the corner area can be edited by handling the subElementRect or maybe subControlRect, i found this: PE_PanelScrollAreaCorner
I tried setting a proxy style into the treeview, its viewport and its scrollbar but none of them is calling these elements.
class ProxyStyle : public QProxyStyle { public: ProxyStyle(QStyle *style = nullptr) : QProxyStyle(style){} QRect subElementRect(QStyle::SubElement element, const QStyleOption* option, const QWidget* widget = nullptr) const override { qDebug() << "#e:" << element; qDebug() << QProxyStyle::subElementRect(element, option, widget); return QProxyStyle::subElementRect(element, option, widget); } void drawPrimitive(QStyle::PrimitiveElement element, const QStyleOption* option, QPainter* painter, const QWidget* widget = nullptr) const override { qDebug() << "pe:" << element; return QProxyStyle::drawPrimitive(element, option, painter, widget); } }; QTreeView* treeView = new QTreeView(this); treeView->viewport()->setStyle(new ProxyStyle(treeView->viewport()->style())); treeView->setStyle(new ProxyStyle(treeView->style()));