How to remove or hide scrollbars when delete the widget of qscrollarea?
Solved
General and Desktop
-
wrote on 10 Dec 2019, 18:47 last edited by
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?
-
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.
-
wrote on 10 Dec 2019, 23:09 last edited by
Thanks, I updated the code to:
QWidget *w = ui->scrollArea->takeWidget(); delete w; ui.scrollArea->verticalScrollBar()->hide();
it works fine.
1/3