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. [SOLVED]QToolBox wihout scrollbars
Forum Updated to NodeBB v4.3 + New Features

[SOLVED]QToolBox wihout scrollbars

Scheduled Pinned Locked Moved General and Desktop
8 Posts 3 Posters 6.0k Views 2 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.
  • M Offline
    M Offline
    mbnoimi
    wrote on last edited by
    #1

    Hi All,

    How can I prevent showing scrollbars in QToolBox?

    I googled for this issue a lot but I couldn't find any solution for it.

    1 Reply Last reply
    0
    • B Offline
      B Offline
      Blizzard
      wrote on last edited by
      #2

      Take a look at these 2 docs:
      "QAbstractScrolLArea-Horizontal":http://doc.trolltech.com/4.3/qabstractscrollarea.html#horizontalScrollBarPolicy-prop
      "QAbstractScrollArea -Vertical":http://doc.trolltech.com/4.3/qabstractscrollarea.html#verticalScrollBarPolicy-prop

      Software Engineer | Aerospace & Defence

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mbnoimi
        wrote on last edited by
        #3

        [quote author="Blizzard" date="1330712510"]Take a look at these 2 docs:
        "QAbstractScrolLArea-Horizontal":http://doc.trolltech.com/4.3/qabstractscrollarea.html#horizontalScrollBarPolicy-prop
        "QAbstractScrollArea -Vertical":http://doc.trolltech.com/4.3/qabstractscrollarea.html#verticalScrollBarPolicy-prop[/quote]

        'class QToolBox' has no member named 'setHorizontalScrollBarPolicy'

        1 Reply Last reply
        0
        • B Offline
          B Offline
          Blizzard
          wrote on last edited by
          #4

          doesn't it only show scrollbars when it can't fit all your content? why would you want to remove them?

          Software Engineer | Aerospace & Defence

          1 Reply Last reply
          0
          • M Offline
            M Offline
            mbnoimi
            wrote on last edited by
            #5

            [quote author="Blizzard" date="1330905570"]doesn't it only show scrollbars when it can't fit all your content? why would you want to remove them?[/quote]

            I'm working on creating a sidebar has many categories (QToolBox tabs) similar to "Planner's":https://live.gnome.org/Planner sidebar.
            http://s7.postimage.org/idonwkpzf/screenshot_1.jpg

            1 Reply Last reply
            0
            • M Offline
              M Offline
              mbnoimi
              wrote on last edited by
              #6

              Voila! I fix this issue by using stylesheet as following:

              @QScrollBar:horizontal {
              height: 0px;
              width: 0px;
              }

              QScrollBar:vertical {
              height: 0px;
              width: 0px;
              }@

              1 Reply Last reply
              0
              • B Offline
                B Offline
                Blizzard
                wrote on last edited by
                #7

                Thanks for sharing your solution, how did you go about adding the different categories to the sidebar?

                Software Engineer | Aerospace & Defence

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  andr1312e
                  wrote last edited by
                  #8
                  for (int i = 0; i < count(); ++i) 
                  {
                      QWidget *viewport = widget(i)->parentWidget();//viewport
                      qDebug() << viewport->metaObject()->className();
                      QScrollArea *scrollArea = qobject_cast<QScrollArea*>(viewport->parentWidget());
                       qDebug() << scrollArea->metaObject()->className();
                      Q_CHECK_PTR (scrollArea);
                      scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarPolicy::ScrollBarAlwaysOff);
                      scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarPolicy::ScrollBarAlwaysOff);
                  }
                  
                  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