Why is a objects 'pixmap' property not written to ui-file when using QFormBuilder::save(...) ?
-
Context
I'm new to using Qt5 on Linux.
I have been programming in C++ Builder (Windows) years ago where I used to read and write forms from and to file.
As a concept I'm try to accomplish the same using Qt.Question
Why is the
pixmap
property of aQLabel
object not written to a ui-file usingQFormBuilder::save(...)
method?
The same counts for theicon
from theQPushButton
object but maybe for a different reason.My Goal
I'm trying to read and write a ui-file at runtime.
My Findings
The
pixmap
property is not written to file from the objects in the form.My Attempt at Fixing
I used a new derived
QFormBuilder
class with overridden methodcomputeProperties(...)
.
What I discovered is that the 'pixmap' (QPixmap
) property is not in the initial list of properties.
I appended the property to the list (QList<DomProperty*>
) which methodcomputeProperties(...)
returns.
Resulting in no change at all in the outcome. -
Context
I'm new to using Qt5 on Linux.
I have been programming in C++ Builder (Windows) years ago where I used to read and write forms from and to file.
As a concept I'm try to accomplish the same using Qt.Question
Why is the
pixmap
property of aQLabel
object not written to a ui-file usingQFormBuilder::save(...)
method?
The same counts for theicon
from theQPushButton
object but maybe for a different reason.My Goal
I'm trying to read and write a ui-file at runtime.
My Findings
The
pixmap
property is not written to file from the objects in the form.My Attempt at Fixing
I used a new derived
QFormBuilder
class with overridden methodcomputeProperties(...)
.
What I discovered is that the 'pixmap' (QPixmap
) property is not in the initial list of properties.
I appended the property to the list (QList<DomProperty*>
) which methodcomputeProperties(...)
returns.
Resulting in no change at all in the outcome. -
Hi
Welcome to the forums.
Qt differs from C++ Builder in the way such resources are handled.
They are not saved with the UI file but are instead kept as files or as embedded
binary linked to the app.
https://doc.qt.io/qt-5/resources.html
This allows all buttons to share the same icon etc.
Resources can be linked-to app or library or loaded at runtime. -
Hi
Welcome to the forums.
Qt differs from C++ Builder in the way such resources are handled.
They are not saved with the UI file but are instead kept as files or as embedded
binary linked to the app.
https://doc.qt.io/qt-5/resources.html
This allows all buttons to share the same icon etc.
Resources can be linked-to app or library or loaded at runtime.@mrjj said in Why is a objects 'pixmap' property not written to ui-file when using QFormBuilder::save(...) ?:
Hi
Welcome to the forums.
Qt differs from C++ Builder in the way such resources are handled.
They are not saved with the UI file but are instead kept as files or as embedded
binary linked to the app.
https://doc.qt.io/qt-5/resources.html
This allows all buttons to share the same icon etc.
Resources can be linked-to app or library or loaded at runtime.I created an ui-file using the qt-designer which I read into the application and then write to file again.
The 'pixmap' property references a qt resource as shown below.<widget class="QLabel" name="label"> ... <property name="pixmap"> <pixmap>:/image/ecosystem</pixmap> </property> ... </widget>
The writing is the problem as explained. (the pixmap property is somehow omitted)
-
@A-v-O
I know nothing aboutQFormBuilder
, but at a wild guess it won't save pixmaps or icons etc. because they are large, binary blobs. Wouldn't you expect them to go into an external file, or embedded in a Qt resource file?@JonB said in Why is a objects 'pixmap' property not written to ui-file when using QFormBuilder::save(...) ?:
@A-v-O
I know nothing aboutQFormBuilder
, but at a wild guess it won't save pixmaps or icons etc. because they are large, binary blobs. Wouldn't you expect them to go into an external file, or embedded in a Qt resource file?No not a binary blob but a reference to an embedded resource. (see ui-file)
-
@JonB said in Why is a objects 'pixmap' property not written to ui-file when using QFormBuilder::save(...) ?:
@A-v-O
I know nothing aboutQFormBuilder
, but at a wild guess it won't save pixmaps or icons etc. because they are large, binary blobs. Wouldn't you expect them to go into an external file, or embedded in a Qt resource file?No not a binary blob but a reference to an embedded resource. (see ui-file)