Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to customize the QScrollBar "corner" area?
Forum Updated to NodeBB v4.3 + New Features

How to customize the QScrollBar "corner" area?

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 577 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Daniella
    wrote on last edited by
    #1

    In CSS this area (6) can be style with -webkit-scrollbar-corner
    300ae3b3-07d9-408e-8bc8-6fb9a0bd56b1-image.png

    The area where the horizontal and vertical scrollbars match:

    ec433271-9dae-41ee-b2ae-319f775f3832-image.png

    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.

    Pl45m4P 1 Reply Last reply
    0
    • D Daniella

      In CSS this area (6) can be style with -webkit-scrollbar-corner
      300ae3b3-07d9-408e-8bc8-6fb9a0bd56b1-image.png

      The area where the horizontal and vertical scrollbars match:

      ec433271-9dae-41ee-b2ae-319f775f3832-image.png

      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.

      Pl45m4P Offline
      Pl45m4P Offline
      Pl45m4
      wrote on last edited by
      #2

      @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;}");
      

      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      D 1 Reply Last reply
      0
      • Pl45m4P Pl45m4

        @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;}");
        
        D Offline
        D Offline
        Daniella
        wrote on last edited by Daniella
        #3

        @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;} also max-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()));
        
        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved