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. Problems in mainwindow.ui
Forum Updated to NodeBB v4.3 + New Features

Problems in mainwindow.ui

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 299 Views 1 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.
  • V Offline
    V Offline
    Vittorio61
    wrote on last edited by
    #1

    Hi all,
    I'm developing some custom widgets and normally they seem to work as expected. I have a problem with one of them: I have 2 very similar properties and when I save the project that uses that widget and reload it, one of this properties still has the saved value but the other lost it. I opened the mainwindow.ui and the content is similar for the 2 properties but is different if I "edit" the mainwindow.ui inside QTCreator.
    In the external editor ...
    (...)
    <property name="tag">
    <url>
    <string>MyString1</string>
    </url>
    </property>
    <property name="tagEnab">
    <url>
    <string>MyString2</string>
    </url>
    </property>
    (...)

    Inside the QTCreator ...
    (...)
    <property name="tag">
    <url>
    </string>
    </url>
    </property>
    <property name="tagEnab">
    <url>
    <string>MyString2</string>
    </url>
    </property>
    (...)

    ... <string>MyString1 ... has been removed !
    So the second property works fine, the first one not.
    If I exit from QTCreator and edit the mainwindow.ui with a text editor the file is still perfect !
    Any ideas ?
    Tanks in advance.
    Vittorio

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      Im not really sure what that could be.
      Would it be possible to name the propery something other than tag and see if
      its some sort of name clash.

      Are both tag and tagEnab declared the same way in .h `?

      1 Reply Last reply
      0
      • V Offline
        V Offline
        Vittorio61
        wrote on last edited by
        #3

        Thanks mrjj for your suggestion.
        I changed the property 'tag' to 'txg', but I still have the problem.
        (tag and tagEnabled are declared in the same way ...)

        mrjjM 1 Reply Last reply
        0
        • V Vittorio61

          Thanks mrjj for your suggestion.
          I changed the property 'tag' to 'txg', but I still have the problem.
          (tag and tagEnabled are declared in the same way ...)

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Vittorio61

          Hi
          Ok it was worth a shot.

          Would it be possible to make a smaller test project containing the custom widgets
          so we can test it out our self ?

          I really have no idea why it would eat one property but it often helps to fiddle with the code directly.

          1 Reply Last reply
          0
          • V Offline
            V Offline
            Vittorio61
            wrote on last edited by
            #5

            Thanks again,
            following your hint I reduced the custom widget at minimum (3 properties) and the problem was still there. Then I added some outputs with qDebug and I realized that my property write method (setTag, setTagEnab, ...) were called twice when I opened the form where the widget are placed. The first time before the paintEvent, the second after it. This caused me a problem so I didn't assign the 'tag' value to the corresponding private variable 'm_tag' that is returned in the 'property get' reoutine. To bypass the problem I set a variable in the painEvent to distinguish between the first and the second 'property set' call and the problem has been solved.
            Just an annotation: in the setTag routine I read a file from the resources and it looks like the resources are not fully available before the paintEvent. It's just an impression: consider that I'm a newbie ... ;-)
            Thanks a lot four your support !

            1 Reply Last reply
            1

            • Login

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