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. Change one object name in UI Designer and get an error in signals.
Qt 6.11 is out! See what's new in the release blog

Change one object name in UI Designer and get an error in signals.

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 4.8k 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.
  • A Offline
    A Offline
    AlvaroGJ
    wrote on last edited by
    #1

    Hello everyone and thanks for reading this topic!

    I´m a little bit confused with Qt Designer. I have a button that produces some signals with its pertinent slots.
    Let´s think for example that this button is called "MyButton". So the slot´s name for a clicked signal would be:

    onMyButtonClicked()

    Okey, then lets change the button´s name in Designer to "AnotherNameButton". Obviously the slots name should change in the way they should be seen like this:

    onAnotherNameButtonClicked()

    But this is not happening and so I am getting some errors in the file: moc_gui.cpp because there is no reference for the previous slot!

    The question is, how can I refactor all slots and signals name that depends on a widget(button or whatever) when I change it from Qt Designer?

    Thanks a lot!

    1 Reply Last reply
    0
    • A Offline
      A Offline
      asanka424
      wrote on last edited by
      #2

      I don't think its possible.

      1 Reply Last reply
      0
      • Ni.SumiN Offline
        Ni.SumiN Offline
        Ni.Sumi
        wrote on last edited by Ni.Sumi
        #3

        Hello @AlvaroGJ ,

        Let´s think for example that this button is called "MyButton". So the slot´s name for a clicked signal would be: onMyButtonClicked();
        -> These are names given by default from Qt Designer.

        Okey, then lets change the button´s name in Designer to "AnotherNameButton". Obviously the slots name should change in the way they should be seen like this: onAnotherNameButtonClicked()

        -> Changing name of the button can not do "renaming the slot name". If you are doing it on the same button "MYButton".
        To my knowledge , you have to do it manually. Change the QObject name in the ui file. and then in code use the "refactor."It will rename in all files of the project.
        If your are changing the only SLOT name , right click on "onMyButtonClicked();" ->Refactor->Rename symbol under cursor , will change.

        Have to be very careful when you are renaming ui files, or widgets in .ui .

        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