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

settings QGridLayout spacing 0 causes QCheckBox and QLabel to overlap

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P4: Low
    • Some future release
    • 4.7.0, 5.4.2
    • Widgets: Layout
    • None
    • Qt 4.7 Carbon on OSX 10.6
    • macOS

    Description

      Setting QGridLayout::spacing to 0 causes the labels of a checkbox (on left) and a QLabel (on the right) to overlap slightly. My best guess is that QCheckBox is not requesting how much space it actually needs.

      #include <QtGui>
      
      int main( int argc, char **argv )
      {
        QApplication a(argc, argv);
      
        QCheckBox* w1 = new QCheckBox("When placed very closely");
        QLabel* w2 = new QLabel("labels begin to overlap with Qt/Carbon 4.7");
        QWidget* cntr = new QWidget();
      QGridLayout* grid = new QGridLayout(cntr);
      grid->addWidget(w1, 0,0);
      grid->addWidget(w2, 0,1);
      grid->setColumnStretch(2,1);
      grid->setSpacing(0);
      
      cntr->show();
      a.exec();
      
      return 0;
      }
      

      Attachments

        1. checkBoxLabel_001.png
          checkBoxLabel_001.png
          7 kB
        2. cramped.png
          cramped.png
          33 kB
        3. main.cpp
          0.4 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Unassigned Unassigned
            wstokes Will Stokes
            Votes:
            3 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes