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. Convert QWidget back to QLayout
Forum Updated to NodeBB v4.3 + New Features

Convert QWidget back to QLayout

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 696 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.
  • M Offline
    M Offline
    mimamrafi
    wrote on last edited by
    #1

    Hi, everyone, I have converted QLayout to QWidget with morph into in my .UI , now I want this QWidget back to QLayout. is there any idea?
    12f0f1a9-ade9-4b4a-a7ac-04427d6762d5-image.png

    JonBJ 1 Reply Last reply
    0
    • M mimamrafi

      Hi, everyone, I have converted QLayout to QWidget with morph into in my .UI , now I want this QWidget back to QLayout. is there any idea?
      12f0f1a9-ade9-4b4a-a7ac-04427d6762d5-image.png

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @mimamrafi
      (So far as I know) Morph into morphs between widgets, not layouts, so don't know what you mean. QLayouts are not QWidgets.

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mimamrafi
        wrote on last edited by
        #3

        thanks for your reply. I've been layouting the widgets, and then I morph that layout into QWidget. after that I want that QWidget back to layout again, but it seems impossible. so I manage that I can group the widgets with morph into QGroupBox. It is newbie's issue, hehe

        JonBJ 1 Reply Last reply
        0
        • M mimamrafi

          thanks for your reply. I've been layouting the widgets, and then I morph that layout into QWidget. after that I want that QWidget back to layout again, but it seems impossible. so I manage that I can group the widgets with morph into QGroupBox. It is newbie's issue, hehe

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by JonB
          #4

          @mimamrafi said in Convert QWidget back to QLayout:

          and then I morph that layout into QWidget.

          after that I want that QWidget back to layout again

          Again, sorry, but Morph into just does not do that. It does not morph layouts, only some QWidget type into some other QWidget type. See e.g. https://stackoverflow.com/questions/6533329/what-is-the-use-of-morph-into-in-qt

          The practical use is to quickly convert widgets into other, similar widgets.

          So I don't know how to answer. But I presume morphing is "one-way", I don't think you can "un-morph" back to what you started with, though not certain. It behoves you to keep a copy of the .ui file before you Morph into, in case you want to go back!

          I will say one other from your screenshot. From what I can see you have 8 identical lines/rows of (pretty complex) multiple widgets. If these are all individual widgets I suspect you will find it "inconvenient" when you come to address each of these in your code. I would be designing one of these as its own widget, and then either creating multiple copies dynamically at runtime or possibly using Designer's Promote to ... to make it possible to design a container widget with 8 of them. The top-level container might then be, say, a QListWidget to hold any number of rows of these.

          However, I'm afraid I am not offering to hold your hand through that. Maybe you will find that too complex at present and would prefer to continue with your single, "big" widget. If so feel free to ignore this suggestion :)

          M 1 Reply Last reply
          2
          • JonBJ JonB

            @mimamrafi said in Convert QWidget back to QLayout:

            and then I morph that layout into QWidget.

            after that I want that QWidget back to layout again

            Again, sorry, but Morph into just does not do that. It does not morph layouts, only some QWidget type into some other QWidget type. See e.g. https://stackoverflow.com/questions/6533329/what-is-the-use-of-morph-into-in-qt

            The practical use is to quickly convert widgets into other, similar widgets.

            So I don't know how to answer. But I presume morphing is "one-way", I don't think you can "un-morph" back to what you started with, though not certain. It behoves you to keep a copy of the .ui file before you Morph into, in case you want to go back!

            I will say one other from your screenshot. From what I can see you have 8 identical lines/rows of (pretty complex) multiple widgets. If these are all individual widgets I suspect you will find it "inconvenient" when you come to address each of these in your code. I would be designing one of these as its own widget, and then either creating multiple copies dynamically at runtime or possibly using Designer's Promote to ... to make it possible to design a container widget with 8 of them. The top-level container might then be, say, a QListWidget to hold any number of rows of these.

            However, I'm afraid I am not offering to hold your hand through that. Maybe you will find that too complex at present and would prefer to continue with your single, "big" widget. If so feel free to ignore this suggestion :)

            M Offline
            M Offline
            mimamrafi
            wrote on last edited by
            #5

            @JonB yes, I have tried that previously. But there's some rows that i have to make it custom. But It Solved now with QGroupBox. Thanks for your answers again

            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