Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Why is a objects 'pixmap' property not written to ui-file when using QFormBuilder::save(...) ?
Forum Updated to NodeBB v4.3 + New Features

Why is a objects 'pixmap' property not written to ui-file when using QFormBuilder::save(...) ?

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 3 Posters 661 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A.v.OA Offline
    A.v.OA Offline
    A.v.O
    wrote on last edited by
    #1

    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 a QLabel object not written to a ui-file using QFormBuilder::save(...) method?
    The same counts for the icon from the QPushButton 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 method computeProperties(...).
    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 method computeProperties(...) returns.
    Resulting in no change at all in the outcome.

    JonBJ 1 Reply Last reply
    0
    • A.v.OA A.v.O

      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 a QLabel object not written to a ui-file using QFormBuilder::save(...) method?
      The same counts for the icon from the QPushButton 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 method computeProperties(...).
      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 method computeProperties(...) returns.
      Resulting in no change at all in the outcome.

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @A-v-O
      I know nothing about QFormBuilder, 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?

      A.v.OA 1 Reply Last reply
      0
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #3

        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.

        A.v.OA 1 Reply Last reply
        1
        • mrjjM mrjj

          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.

          A.v.OA Offline
          A.v.OA Offline
          A.v.O
          wrote on last edited by A.v.O
          #4

          @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)

          1 Reply Last reply
          0
          • JonBJ JonB

            @A-v-O
            I know nothing about QFormBuilder, 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?

            A.v.OA Offline
            A.v.OA Offline
            A.v.O
            wrote on last edited by
            #5

            @JonB said in Why is a objects 'pixmap' property not written to ui-file when using QFormBuilder::save(...) ?:

            @A-v-O
            I know nothing about QFormBuilder, 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)

            JonBJ 1 Reply Last reply
            0
            • A.v.OA A.v.O

              @JonB said in Why is a objects 'pixmap' property not written to ui-file when using QFormBuilder::save(...) ?:

              @A-v-O
              I know nothing about QFormBuilder, 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)

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by
              #6

              @A-v-O
              Yes, that is the sort of thing I would expect --- as opposed to embedding or encoding the pixmap into the .ui file --- but maybe I misunderstood what you are asking/seeing.

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved