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. Attempting to add QLayout "" to myWidget "myWidget", which already has a layout
QtWS25 Last Chance

Attempting to add QLayout "" to myWidget "myWidget", which already has a layout

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 1.6k 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.
  • D Offline
    D Offline
    deleted396
    wrote on last edited by
    #1

    Hello friends.

    I am developing a interface to my program. I have some widget implemented. I am using Graphics form to develop the widget and always I place the objects with graphics layout, not with code.

    When I finish a new widget, I always use the option "Lay Out in a Grid" in the main QWidget to place all the objects in the middle ( With spacers in top,bot,left and right side) and keep the objects in the same place when i select the fullscreen.

    Now I have created a new widget, I did the same that in the others but i receive the message "Attempting to add QLayout "" to myWidget "myWidget", which already has a layout".

    Solutions?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      What's the base class of myWidget ? If it's a QMainWindow, then it already has a layout that does all the magic that you get with that class (dock widget, toolbars, etc.).

      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
      0
      • Christian EhrlicherC Offline
        Christian EhrlicherC Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #3

        You're doing something like

        QWidget *w1 = new QWidget;
        QHBoxLayout *lay = new QHBoxLayout(w1);
        QHBoxLayout *lay2 = new QHBoxLayout(<whatever>);
        w1->setLayout(lay2);
        

        See also https://bugreports.qt.io/browse/QTBUG-69761

        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

        • Login

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