Solved Delete a QVBoxLayout from the centralWidget
-
Hello, I am new to QT, so sorry if it is a silly question, but:
I want to delete or hide a QVBox-/QHBoxlayout from the centralWidget. I already searched, but I found nothing that really help me. So basically, I have two buttons and one label on my Homescreen. The label is in a QHBoxLayout called "startLabel". The buttons are also in a QHBoxLayout called "buttonsHome". If a click the right button, a QFileDialog opens and from there I can select a file. If I have selected a file, I want that the centralWidget deletes all his children and adds new ones. If I click "Cancel", it should stay at the home screen. How do I delete his children now? I have found no good solution.Thanks!
-
@Tobias88 said in Delete a QVBoxLayout from the centralWidget:
How do I delete his children now?
use findChildren() to get all children of an object but instesad deleting all the widgets you should consider using a QStackedWidget and simply show the other idgets which you want to show after the file was successfully loaded.
-
@Christian-Ehrlicher Thank you! This helped alot and helped me solve my problem!
One more Question.... How do I set my Topic as solved?
Edit: Got it by myself.