Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Solved Layout Issue?

    General and Desktop
    3
    7
    1126
    Loading More Posts
    • 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.
    • ModelTech
      ModelTech last edited by ModelTech

      I am trying to layout my widgets but I seem to do something wrong. There is this scribbled text next to the word "Scenario". I am trying to layout this text below the text "Controls Data Consumptions Data Productions using a QGridLayout. For some reason, I don't get it right. Any suggestions in which direction I have to look for the problem. I don't see a way to put all the relevant code here as it is rather a lot...

      alt text

      A 1 Reply Last reply Reply Quote 0
      • A
        ambershark @ModelTech last edited by ambershark

        @ModelTech Just show us the creation code for the layout for the right pane, or even just the bottom of the right side pane.

        And my off the cuff guess is that you didn't get that text that is messed up in a layout at all.

        My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

        1 Reply Last reply Reply Quote 0
        • SGaist
          SGaist Lifetime Qt Champion last edited by

          Hi,

          Looks like a work for QVBoxLayout and QHBoxLayout as well as QSplitter. QGridLayout might also be used.

          Do you have any particular problem ?

          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 Reply Quote 1
          • ModelTech
            ModelTech last edited by

            As said, it is rather complicated. The lower part of the QSplitter is a Widget that I called BehaviorEditor. The Layout of BehaviorEditor consists of a QVBoxLayout separating the top part with QLabel "Scenario" and the QLineEdit "BL". The bottom part is build up as a QHBoxLayout, of which here three Widgets are shown (it contains a forth which is set to invisible in this particular screenshot). Each of these three Widgets (called Collapsable) consists again of a QVBoxLayout, where the top contains the labels "Controls", "Data Consumptions" and "Data Productions" respectively. The problem is however with the bottom part of each of these three "Collapsable"s, which consists of a Widget with a QGridLayout. Somehow the QLabel Widgets in this QGridLayout-based Widget are not positioned at the right location, but at the LH top corner of BehaviorEditor.

            I have no clue where to start looking for the problem. What constructor code would be best to share?

            1 Reply Last reply Reply Quote 0
            • ModelTech
              ModelTech last edited by ModelTech

              I am already discovering that the problem is not in the constructors... I have to replace these bottom widgets of Collapsable and that seems to cause the problem somehow. So, how do you generally replace a Widget in some Layout by another Widget (of the same class)?

              A 1 Reply Last reply Reply Quote 0
              • A
                ambershark @ModelTech last edited by ambershark

                @ModelTech said in Layout Issue?:

                I am already discovering that the problem is not in the constructors... I have to replace these bottom widgets of Collapsable and that seems to cause the problem somehow. So, how do you generally replace a Widget in some Layout by another Widget (of the same class)?

                I don't think replacing them is the right approach. It still seems like you have a broken layout somewhere. This will be tough without seeing code, but I'll give it a shot.

                It looks like you have a broken layout which is why all the stuff scrunches together like that. From your description it is in the 4th widget. I'll just name it X since I don't know what it's called.

                Your widget Collapsable has the QVBoxLayout with the 3 labels and then below that it has the X widget. That X widget has it's own layout. So first things first, you can test that widget by itself and see if it's layout is broken. Simple test is:

                int main(int ac, char **av)
                {
                   QApplication app(ac, av);
                   X x;
                   x->show();
                   return app.exec();
                }
                

                If that widget looks ok then the problem will be in the vboxlayout of the whole Collapsable widget. If it doesn't then your layout issue is in the X widget. Show me the layout construction for that widget if that's the case.

                If not the place where you add the Collapsable's to a layout will be a good place to show some code.

                My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

                1 Reply Last reply Reply Quote 0
                • ModelTech
                  ModelTech last edited by

                  Ok, I found a way to solve it for now. The problem was that not all widgets were added to a layout...

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post