Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Is it possible to make the two widgets in a QSplitter of fixed size
Forum Updated to NodeBB v4.3 + New Features

Is it possible to make the two widgets in a QSplitter of fixed size

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
7 Posts 3 Posters 1.9k Views 2 Watching
  • 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.
  • Q Offline
    Q Offline
    Qt Enthusiast
    wrote on last edited by
    #1

    I have a layout and QWidget and I have QSplitter with Vertical Orientation

    QVBoxLayout *container_layout = new QVBoxLayout;
    container_layout->addWidget(d_horSplitter);

    QWidget     *container =        new QWidget;
    container->setLayout(container_layout);
    d_verSplitter->setOrientation(Qt::Vertical);
    d_verSplitter->addWidget(container);
    d_verSplitter->addWidget(bottomWidget);
    

    I want to make container and bottomWidget of fixed size . Is it possible to make to widgets addWidgets in QSplitter as fixed size

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mvuori
      wrote on last edited by
      #2

      Yes it is, as you probably already know by now, because adding the fixed size to your already existing widgets is a one-liner.

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

        Hi,

        Out of curiosity, why use a splitter if you want to fixe the size of your widgets ?

        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
        • Q Offline
          Q Offline
          Qt Enthusiast
          wrote on last edited by
          #4

          It is requirement from our marketing and could you let me know what is that one liner code . because I do not know yet

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

            So they basically want an unusable splitter ?

            You would already have that answer by searching fixed in the documentation.

            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
            • Q Offline
              Q Offline
              Qt Enthusiast
              wrote on last edited by
              #6

              @SGaist said:

              searching setWindowTitle(title);

              //creating two splitters
              
              d_horSplitter =   new QSplitter;
              d_verSplitter =   new QSplitter;
              
              
              /* creating the refresh button at the bottom*/
              QWidget *bottomWidget = new QWidget;
              /* to make the refresh button as of fixed size*/
              bottomWidget->setMaximumHeight(50);
              bottomWidget->setMinimumHeight(50);
              
              d_verSplitter->setOrientation(Qt::Vertical);
              d_verSplitter->addWidget(container);
              d_verSplitter->addWidget(bottomWidget);
              

              and it is working .

              <My question is that the correct way to do the same or is there a better to make the vertical splitter locked

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

                setFixedHeight would be cleaner.

                It's the only solution I know but like I wrote: having a locked splitter is counter intuitive and will make your users pretty angry.

                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

                • Login

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