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. QSplitter size problems of widgets
Forum Updated to NodeBB v4.3 + New Features

QSplitter size problems of widgets

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.5k Views 1 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.
  • H Offline
    H Offline
    haney
    wrote on last edited by
    #1

    Hi,
    I have two customwidgets ie panel, textedit. I added them in a splitter like below:
    @
    Splitter::Splitter(QWidget *parent)
    : QWidget(parent)
    {
    this->panel = new CalcPanel(this);
    this->textEdit = new TextEdit(this);

    QSplitter *splitter1 = new QSplitter(Qt::Horizontal, this);
     splitter1->addWidget(this->panel);
     splitter1->addWidget(this->textEdit);
    this->setFixedSize(761,851); // set fixed size for splitter
    

    }
    @

    But how do I set proper sizes for panel and textedit.
    BOTH these widgets appear very small in splitter. Please share your views. Thanks for your support.

    Thanks,
    Haney.

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

      Hi,

      Right now you are only resizing the widget containing the splitter

      You should add a layout to your widget (QHBoxLayout or QVBoxLayout) and then add your splitter to that layout.

      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
      • H Offline
        H Offline
        haney
        wrote on last edited by
        #3

        Thanks for the reply. It worked.

        As of now, splitter can be moved horizontally till column width = 0 ie no content is shown. HOw do I ensure that minimum column width of contents to be shown.

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

          The answer is in the "doc":http://qt-project.org/doc/qt-4.8/qsplitter.html#childrenCollapsible-prop

          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