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 remove or hide scrollbars when delete the widget of qscrollarea?
Forum Update on Monday, May 27th 2025

How to remove or hide scrollbars when delete the widget of qscrollarea?

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 1.5k Views
  • 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.
  • R Offline
    R Offline
    RonaldViscarraL
    wrote on 10 Dec 2019, 18:47 last edited by
    #1

    Hi, I have this code:

    QWidget *w = ui->scrollArea->takeWidget();
    delete w;
    

    and the inner widget of qscrollarea is deleted correctly, but the scrollbars remain. How can I hide or remove this scrollbars in this case?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 10 Dec 2019, 20:47 last edited by
      #2

      Hi,

      I am surprised they do not disappear however you can access them directly and hide them. See for example horizontalScrollBar and its vertical friend.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • R Offline
        R Offline
        RonaldViscarraL
        wrote on 10 Dec 2019, 23:09 last edited by
        #3

        Thanks, I updated the code to:

        QWidget *w = ui->scrollArea->takeWidget();
        delete w;
        ui.scrollArea->verticalScrollBar()->hide();
        

        it works fine.

        1 Reply Last reply
        0

        1/3

        10 Dec 2019, 18:47

        • Login

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