Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-47200

Clarify QSplitter sizes documentation

    XMLWordPrintable

Details

    Description

      Customer request is to get better documentation with example or hint how to initialize widgets sizes.

      Background for the request is that if widget has bigger minimumsize hint than given size then it it won't set the size. That cause some confusion if it's wanted to use relative small sizes, like (1,2,3)

      It's documented, http://doc.qt.io/qt-5/qsplitter.html#setSizes:
      "If you specify a size of 0, the widget will be invisible. The size policies of the widgets are preserved. That is, a value smaller than the minimal size hint of the respective widget will be replaced by the value of the hint."

      So the hint/example would be to set widgets minimumsize before calling splitter setSizes:

              for(int i=0;i<3;i++) {
                  QTextEdit *widget = new QTextEdit();
                  widget->setMinimumSize(1,1); // set minimum size 1
                  splitter->addWidget(widget);
              }
              splitter->setSizes(QList<int>() << 1 << 2 << 100); // relative sizes
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            docteam Qt Documentation Team
            qtcomsupport Qt Support
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes