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.
  • RonaldViscarraLR Offline
    RonaldViscarraLR Offline
    RonaldViscarraL
    wrote on 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
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on 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
      • RonaldViscarraLR Offline
        RonaldViscarraLR Offline
        RonaldViscarraL
        wrote on 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

        • Login

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