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. Creating a Double Scrollbar
Forum Updated to NodeBB v4.3 + New Features

Creating a Double Scrollbar

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 3 Posters 107 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.
  • traevT Offline
    traevT Offline
    traev
    wrote last edited by traev
    #1

    Hello! I'm using a tool which changes my system-wide Qt theme (qt6ct), which is also capable of using the Qt Style Sheets.

    I am a big fan of the "double scrollbar" style which can be used within Haiku (the scrollbar style beneath the one outlined in blue):
    730b3f9a-3109-43b0-ac37-e96e162037f3-image.png

    My question is whether or not I can replicate this type of scrollbar style using Style Sheets alone. So far, I have only found configuration examples which change the shape and/or color of those add-line and sub-line buttons.

    I have added an example Style Sheet below. Attempting to add two subcontrol entries simply causes the bottom one to override the first one, it seems.

    QScrollBar::sub-line:vertical {
        background: magenta;
        height: 16px;
        subcontrol-position: top;
        subcontrol-origin: margin;
        border: 2px solid black;
    }
    
    QScrollBar::sub-line:vertical {
        background: magenta;
        height: 16px;
        subcontrol-position: bottom;
        subcontrol-origin: margin;
        border: 2px solid black;
        position: absolute;
        bottom: 20px;
    }
    

    Any help would be appreciated!
    (Qt Ver. 6.8.3 on Gentoo Linux.)

    1 Reply Last reply
    0
    • Axel SpoerlA Offline
      Axel SpoerlA Offline
      Axel Spoerl
      Moderators
      wrote last edited by
      #2

      Please provide a minimal compilable reproducer as described here.

      Software Engineer
      The Qt Company, Oslo

      traevT 1 Reply Last reply
      0
      • Axel SpoerlA Axel Spoerl

        Please provide a minimal compilable reproducer as described here.

        traevT Offline
        traevT Offline
        traev
        wrote last edited by
        #3

        @Axel-Spoerl, forgive me. I noticed the example I've provided wasn't enough to replicate the issue. I have added a new one below which changes the vertical scrollbar.

        The two "sub-line" parts should demonstrate the issue I'm trying to explain in regard to a vertical scrollbar. The sub-line at the bottom of the code (with a blue background) causes a blue button to appear below the scrollbar. Making it to where the sub-line with a magenta background is at the bottom of the code instead simply overrides the blue one, causing the blue button to not appear.

        QScrollBar:vertical {
            border: 2px solid green;
            background: cyan;
            width: 15px;
            margin: 20px 0px 40px 0px;
        }
        
        QScrollBar::add-line:vertical {
            background: gray;
            height: 16px;
            subcontrol-position: bottom;
            subcontrol-origin: margin;
            border: 2px solid black;
        }
        
        QScrollBar::sub-line:vertical {
            background: magenta;
            height: 16px;
            subcontrol-position: bottom;
            subcontrol-origin: margin;
            border: 2px solid black;
            position: absolute;
            bottom: 20px;
        }
        
        QScrollBar::sub-line:vertical {
            background: blue;
            height: 16px;
            subcontrol-position: top;
            subcontrol-origin: margin;
            border: 2px solid black;
        }
        
        

        Although it may not be possible, I'm wondering if both the blue and magenta scrollbar buttons can exist simultaneously.

        1 Reply Last reply
        0
        • Axel SpoerlA Offline
          Axel SpoerlA Offline
          Axel Spoerl
          Moderators
          wrote last edited by
          #4

          Hi @traev,
          I think we are misunderstanding each other.
          A style sheet is posted, but we actually need a very small program to reproduce the issue, i.e. creating the UI attached. The link I posted above leads to a guideline on how to report bugs and reproducers. Please read the section "Attachment / Reproducer". In a nutshell: Please make it short and sweet. No ui files, no subclassing, just the bare minimum to reproduce the issue.
          Jusr by looking at the style sheet, nobody can tell you what is wrong.

          Software Engineer
          The Qt Company, Oslo

          1 Reply Last reply
          0
          • Christian EhrlicherC Online
            Christian EhrlicherC Online
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote last edited by
            #5

            It's not possible with Qt at all since the styles don't support more than one 'action rect' for a subcontrol.

            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
            Visit the Qt Academy at https://academy.qt.io/catalog

            traevT 1 Reply Last reply
            1
            • Christian EhrlicherC Christian Ehrlicher

              It's not possible with Qt at all since the styles don't support more than one 'action rect' for a subcontrol.

              traevT Offline
              traevT Offline
              traev
              wrote last edited by
              #6

              @Christian-Ehrlicher, thanks for the explanation. That is totally fine; I was just wondering if I could create a style similar to it, since most of my desktop is made up of Qt widgets and programs, but a single add-line and sub-line will still do, of course.
              Thank you both nonetheless.

              1 Reply Last reply
              0
              • traevT traev has marked this topic as solved

              • Login

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