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. Delete a QVBoxLayout from the centralWidget

Delete a QVBoxLayout from the centralWidget

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 228 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.
  • T Offline
    T Offline
    Tobias88
    wrote on last edited by
    #1

    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!

    Christian EhrlicherC 1 Reply Last reply
    0
    • T Tobias88

      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!

      Christian EhrlicherC Online
      Christian EhrlicherC Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @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.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      1
      • T Offline
        T Offline
        Tobias88
        wrote on last edited by Tobias88
        #3

        @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.

        1 Reply Last reply
        1

        • Login

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