[Development] Issues with QFormBuilder - All properties modified & Invalid UI

Hugo Slepicka hhslepicka at gmail.com
Fri Oct 18 21:22:58 CEST 2019


Hi Qt Developers,

Thank you for your amazing work at this library.

This message is a cross-posting with the Qt Forum (
https://forum.qt.io/topic/107830/issues-with-qformbuilder-all-properties-modified-invalid-ui)
more detailed information can be found there as well as pictures showcasing
the Designer and Creator display of the generated UIs.

I am trying to use the QFormBuilder to load and later save a ".ui" file.
The issue is that the generated file shows all properties as modified but
the code just open the file and save it with a new name.

Here is the code part that matters: (i can upload all the needed files to a
Gist)

#include "mainwindow.h"#include <QFormBuilder>#include <QFile>#include
<QMessageBox>#include <QVBoxLayout>

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
{
    QFormBuilder builder;
    QFile file(":/myform.ui");
    file.open(QFile::ReadOnly);
    QWidget *myWidget = builder.load(&file, this);
    if (myWidget == nullptr) {
        QString msg = tr("Loading UI file failed:
%1").arg(builder.errorString());
        QMessageBox::critical(this, tr("Error"), msg, QMessageBox::Ok,
QMessageBox::NoButton);
    }
    file.close();

    // Save the form as a UI file.
    QFile saveFile("savedform.ui");
    saveFile.open(QFile::WriteOnly);
    builder.save(&saveFile, myWidget);
    saveFile.close();
}

Also, when loading the new ".ui" file with the QtDesigner the widgets are
not displayed properly.
Is there a better approach to save QWidgets as ".ui" from code?

Other user at the Forum tested the same approach with Qt Creator and the Qt
Creator crashed trying to open the UI file generated at first.


The generated ui file should be exactly the same as the ui that was
ingested by the QFormBuilder.

But that is not what happens. Check the output at this [GitHub Gist link] (
https://gist.github.com/hhslepicka/0808febcbd9e301612b40012e0b0037d) (too
big to fit properly here)


Am I misunderstanding the usage of QFormBuilder? Am I missing some
configuration/property to be set so it can properly work?


Another interesting point is that during the "save" phase, the QFormBuilder
prints the following messages:

Designer: Flags property are not supported yet.
Designer: Flags property are not supported yet.
Designer: Flags property are not supported yet.
Designer: Flags property are not supported yet.
Designer: The property document could not be written. The type
QTextDocument* is not supported yet.
Designer: Flags property are not supported yet.
Designer: Flags property are not supported yet.
Designer: Flags property are not supported yet.
Designer: Flags property are not supported yet.
Designer: Flags property are not supported yet.
Designer: Flags property are not supported yet.
Designer: Flags property are not supported yet.
Designer: Flags property are not supported yet.
Designer: Flags property are not supported yet.

Thank you for your support and input.


Cheers,

Hugo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20191018/4d940a69/attachment-0001.html>


More information about the Development mailing list