Re: [Development] Issues with QFormBuilder - All properties modified & Invalid UI
I agree with Giuseppe and I would like to add to it the fact that properties are restored in what I could guess as alphabetical order, which in itself already causes problems for custom widgets. That said, when developing custom widgets developers must pay attention to this fact of properties that are somewhat interlinked. It comes as a surprise that the core Qt code does not take that into consideration. More and more this looks to me like a bug that should be addressed. Even if not using the QFormBuilder and a user change all the properties at a widget using the Qt Designer we are subject to the same issue, aren't we? On Tue, Oct 29, 2019 at 4:14 AM Giuseppe D'Angelo via Development < development@qt-project.org> wrote: > On 29/10/2019 11:32, Jaroslaw Kobus wrote: > > Take any of QWidget's properties, e.g. sizePolicy, grep through qt > sources > > and search where setSizePolicy is used - > QAbstractSlider::setOrientation(), > > so "orientation" property of abstract slider influences "sizePolicy" - > non-orthogonality detected. > > If you store both properties, and then read them - the result depend on > the read order. > > Sorry, I'm lost now. If you store them both and apply them in either > order, shouldn't the result be correct no matter what? > > == > > If this is not true for some case: we have an API problem, and we can > debate whether it's in the class featuring interlinked properties, or in > the meta property system that is not clearly reflecting the > dependencies, thus making a (de)serializer of such properties impossible > to write correctly. And the latter has way more profound implications > than just serializing the state of a QObject (e.g. thinking of IPC like > DBus, QtRO, etc.). > > Thanks, > -- > Giuseppe D'Angelo | giuseppe.dang...@kdab.com | Senior Software Engineer > KDAB (France) S.A.S., a KDAB Group company > Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com > KDAB - The Qt, C++ and OpenGL Experts > > ___ > Development mailing list > Development@qt-project.org > https://lists.qt-project.org/listinfo/development > ___ Development mailing list Development@qt-project.org https://lists.qt-project.org/listinfo/development
Re: [Development] Issues with QFormBuilder - All properties modified & Invalid UI
In this case why keep it around? Keeping something that does not work only generates more confusion (like this post). Could at least a note at the official documentation be added stating that the method generates an invalid UI file and it must not be used? On Mon, Oct 28, 2019 at 1:07 AM Friedemann Kleint wrote: > Hi, > > >Just a little follow up. Can this (invalid widget being generated by > QFormBuilder.save ) be considered a Qt issue and fixed?The "all > properties changed" is not a big deal, the incorrect form is. > > This cannot realistically be supported, I am afraid. Simply changing all > properties from bottom to top may hit on a number of corner cases where > properties are not orthogonal and have interactions causing misbehavior. > > Regards, Friedemann > > -- > > Friedemann Kleint > The Qt Company GmbH > > ___ > Development mailing list > Development@qt-project.org > https://lists.qt-project.org/listinfo/development > ___ Development mailing list Development@qt-project.org https://lists.qt-project.org/listinfo/development
Re: [Development] Issues with QFormBuilder - All properties modified & Invalid UI
Hi, Just a little follow up. Can this (invalid widget being generated by QFormBuilder.save ) be considered a Qt issue and fixed? The "all properties changed" is not a big deal, the incorrect form is. Thank you, Hugo ___ Development mailing list Development@qt-project.org https://lists.qt-project.org/listinfo/development
Re: [Development] Issues with QFormBuilder - All properties modified & Invalid UI
Hi Friedemann, So can this be considered a bug and fixed at Qt? Please note that even with all properties modified, which is not really a problem, the result display is invalid and does not work like the input display. At Qt forum post I uploaded two images that shows the difference between the original and result UI files. Thank you, Hugo On Mon, Oct 21, 2019 at 3:41 AM Friedemann Kleint wrote: > Hi, > > > 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. > > QFormBuilder writes out all properties since plain Qt properties do not > store whether they were modified. The book-keeping required for this > only exists in Qt Designer. > > Some unsupported properties/flags may then be encountered. > > > Is there a better approach to save QWidgets as ".ui" from code? > > No, unfortunately. > > Regards, Friedemann > > -- > Friedemann Kleint > The Qt Company GmbH > > ___ > Development mailing list > Development@qt-project.org > https://lists.qt-project.org/listinfo/development > -- Hugo Slepicka *hhslepi...@gmail.com * *+1 631 855 5717* ___ Development mailing list Development@qt-project.org https://lists.qt-project.org/listinfo/development
[Development] Issues with QFormBuilder - All properties modified & Invalid UI
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 #include #include #include MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { QFormBuilder builder; QFile file(":/myform.ui"); file.open(QFile::ReadOnly); QWidget *myWidget = builder.load(, 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(, 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 ___ Development mailing list Development@qt-project.org https://lists.qt-project.org/listinfo/development