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. Divide a custom vertical layout by a Vertical splitter
QtWS25 Last Chance

Divide a custom vertical layout by a Vertical splitter

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

    Hi,

    I created my layout PlotVLayout inherited from abstract class QLayout
    PlotVLayout vertically sets QwtPlot widgets in a way that all canvases of these plots are one below another. So the main functionality of PlotVLayout is that it calculates the XY coordinates for each QwtPlot
    Now I would like to insert something like a QSplitter between QwtPlot to allow the user to change the height of each QwtPlot. The picture is attached.
    Is there a way to implement such functionality in my PlotVLayout?
    a5c3386f-9275-48a6-a59f-cca2efec49a9-image.png

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

      I don't know what is inside your code so I can't really comment,

      Why a reference rather than a const reference ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

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

        Hi,

        Something is not clear. You seem to have re-invented QVBoxLayout. Is that the case ?

        In any case, a layout does not have a visual presence, they just do positioning. QSplitter is a widget that seem to do what you want directly. Just use it with the right direction.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        Please_Help_me_DP 1 Reply Last reply
        1
        • SGaistS SGaist

          Hi,

          Something is not clear. You seem to have re-invented QVBoxLayout. Is that the case ?

          In any case, a layout does not have a visual presence, they just do positioning. QSplitter is a widget that seem to do what you want directly. Just use it with the right direction.

          Please_Help_me_DP Offline
          Please_Help_me_DP Offline
          Please_Help_me_D
          wrote on last edited by
          #3

          @SGaist no I dont reinvent QVBoxLayout.
          Lets suppose that we need two QwtPlot one below another but the canvas of each plot should have the same X-pos and different Y. So it is like two QwtPlot that share the same X-axis. Like in the picture:
          f794accb-6821-4500-81d2-0e04a73438ee-image.png

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

            I see. In that case you should make a widget that takes advantage of your custom layout and adds a control that works like QSplitter.

            You can check QSplitter's implementation.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            Please_Help_me_DP 1 Reply Last reply
            0
            • SGaistS SGaist

              I see. In that case you should make a widget that takes advantage of your custom layout and adds a control that works like QSplitter.

              You can check QSplitter's implementation.

              Please_Help_me_DP Offline
              Please_Help_me_DP Offline
              Please_Help_me_D
              wrote on last edited by
              #5

              @SGaist I encountered a strange problem...
              I have two custom layouts (PlotVLayout ) and in private variable (QList<QwtPlot *> splitterPlotList;) I store list of widgets of both layouts.

              When I resize the mainwindow I can see that this list changes its size (count of elemetns) from 1 to 2 but it should always be 2 elements in list (I have qDebug() << splitterPlotList.count();)

              I set splitterPlotList by reference via:

              void PlotVLayout::setPlotList(QList<QwtPlot *> &splitterPlotList){
                  this->splitterPlotList = splitterPlotList;
              }
              

              Why this happens?
              I suspect that when I resize the mainwindow my layouts work in parrallel threads and they are trying to achieve the same variable at the same time?

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

                I don't know what is inside your code so I can't really comment,

                Why a reference rather than a const reference ?

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                Please_Help_me_DP 1 Reply Last reply
                0
                • SGaistS SGaist

                  I don't know what is inside your code so I can't really comment,

                  Why a reference rather than a const reference ?

                  Please_Help_me_DP Offline
                  Please_Help_me_DP Offline
                  Please_Help_me_D
                  wrote on last edited by
                  #7

                  @SGaist I just changed to const List<> & and now it works :)
                  thank you!

                  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