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. [Bug?] Object name set in Qt Designer isn't set on promoted widget.
QtWS25 Last Chance

[Bug?] Object name set in Qt Designer isn't set on promoted widget.

Scheduled Pinned Locked Moved General and Desktop
6 Posts 2 Posters 1.7k Views
  • 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    Hello,

    Is this a bug? I name my promoted widgets, but their objectNames are empty at run-time.

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      Anyone? I just want to know what to expect, since I'm new to Qt and I have no clue if promoted widgets are supposed to get their Qt Designer names...

      1 Reply Last reply
      0
      • JKSHJ Offline
        JKSHJ Offline
        JKSH
        Moderators
        wrote on last edited by
        #3

        Hi,

        That does sound like a bug indeed. Would you be willing to file a bug report at https://bugreports.qt-project.org ?

        Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #4

          -Yep, thats exactly why I asked ^_^-

          Welp, it seems the name isn't set in the constructor... When thinking about how to fix this, a signal magically appeared... It was calling for my attention, quietly sitting in its little window. I glanced and, ironically, to my surprise, it was called ObjectNameChanged(QString)...

          As such, I went back to coding, enlightened and left completely abash... "Someone may have all ready encountered the exact same issue I currently have", I thought to myself, gazing lightly at my screen.

          I then proceeded to code a little example output, pressed cmd+r, and the universe suddenly woke up. "This would be to easy!", said the universe. "Nobody gets to work quickly when coding". At that instant, the universe decided that the signal would not be called when the object name is set for the first time. I turned and bowed my head, in despair, back to where I was before, looking for a solution to my problem.

          Something along those lines ;)

          1 Reply Last reply
          0
          • JKSHJ Offline
            JKSHJ Offline
            JKSH
            Moderators
            wrote on last edited by
            #5

            Great story :-D

            Anyway, I found out that setupUi() is the function that sets the object names. Make sure you call that before doing anything else in your constructor.

            Note: The signal is emitted in the constructor. The thing is... the slot hasn't been connected yet! That's why you don't receive the first signal.

            Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

            1 Reply Last reply
            0
            • ? Offline
              ? Offline
              A Former User
              wrote on last edited by
              #6

              ah! Thank you very much for the clarification. I guess I can quickly fix it by iterating over my custom widgets and calling ObjectNameChanged() myself after setupUi. A bit "bruteforcish", but will work for now.

              I'll be back with more "stories from the trenches" lol

              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