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

QFormBuilder::save() does not process QGridLayouts properly

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P4: Low P4: Low
    • 4.8.0
    • 4.6.2
    • Tools: Designer
    • None
    • Suse Linux 9.1; Qt 4.6.2; linked statically using cmake
    • 0402309e1e3fc30e9d7f643e135aa9af26cca99b

      When the QFormBuilder class processes a QGridLayout, it does not save the cell positions (row, col, rowspan, colspan) of individual QLayoutItems living in the grid.
      Thus when rebuilding the widget from the .ui file (or viewing it in the designer tool) it's shaped completely different.

      Examplecode: (see attachment)

      #include <QtGui/QLabel>
      #include <QtGui/QGridLayout>
      #include <QtGui/QApplication>
      #include <QtDesigner/QFormBuilder>

      void
      setupWidget()
      {
      QWidget* pWidget=new QWidget();
      QGridLayout* pLayout=new QGridLayout(pWidget);
      pWidget->setLayout(pLayout);
      //add elements to the layout
      pLayout->addWidget(new QLabel("1/1"),0,0,1,1);
      pLayout->addWidget(new QLabel("1/2"),0,1,1,1);
      pLayout->addWidget(new QLabel("1/3"),0,2,1,1);
      pLayout->addWidget(new QLabel("2/1"),1,0,1,1);
      pLayout->addWidget(new QLabel("2/2+3"),1,1,1,2);
      //show the widget
      pWidget->show();
      //open file for writing
      QFile fOutput("/tmp/out.ui");
      fOutput.open(QIODevice::WriteOnly);
      Q_ASSERT(fOutput.isOpen());
      //save .ui file
      QFormBuilder builder;
      builder.save(&fOutput,pWidget);
      //close file
      fOutput.close();
      }

      int
      main(int argc,char** argv)
      {
      //setup application
      QApplication app(argc,argv);
      //setup and save widget
      setupWidget();
      return app.exec();
      }

        1. QTBUG-13683_100917.patch
          5 kB
        2. out.ui
          27 kB
        3. main.cpp
          0.9 kB
        4. formbuildersave_100917.tgz
          4 kB
        5. designer.png
          designer.png
          3 kB
        6. application.png
          application.png
          3 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            kleint Friedemann Kleint
            asanwax Axel Sanwald
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes