Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Designer not listing slots in sub-classed controls
QtWS25 Last Chance

Designer not listing slots in sub-classed controls

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
3 Posts 3 Posters 158 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.
  • PerdrixP Offline
    PerdrixP Offline
    Perdrix
    wrote on last edited by Perdrix
    #1

    I have a subclass of QWidget that has a public slot declared in the header file:

    public slots:
        void on_fourCorners_clicked(bool)
        {
            m_fourCorners = !m_fourCorners;
            drawOnPixmap();
            update();
        }
    

    I have a ui file that uses this control and I promoted the QWidget to be a DSS::ImageView object:

    Why doesn't the Signals/Slots configuration list this slot? It knows the name of the header file so it should be able to see that there's a slot declared there...

    I manually edited the ui file to add that connection, but surely I shouldn't need to descend to that level!
    David

    JonBJ 1 Reply Last reply
    0
    • PerdrixP Perdrix

      I have a subclass of QWidget that has a public slot declared in the header file:

      public slots:
          void on_fourCorners_clicked(bool)
          {
              m_fourCorners = !m_fourCorners;
              drawOnPixmap();
              update();
          }
      

      I have a ui file that uses this control and I promoted the QWidget to be a DSS::ImageView object:

      Why doesn't the Signals/Slots configuration list this slot? It knows the name of the header file so it should be able to see that there's a slot declared there...

      I manually edited the ui file to add that connection, but surely I shouldn't need to descend to that level!
      David

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

      @Perdrix
      No idea. But nearly all "experienced" Qt users will not even attempt to use the signals/slots interface provided by Creator and its requirement on slot names. Since you are now a "serious" Qt programmer I suggest you think about doing the same.

      1 Reply Last reply
      0
      • Chris KawaC Offline
        Chris KawaC Offline
        Chris Kawa
        Lifetime Qt Champion
        wrote on last edited by
        #3

        @Perdrix Promotion is for simple replacement of type when generating the C++ code. It does not expose your custom type to the editor i.e. signals, slots, properties etc. If you want a full support for custom type you have to create a designer plugin. Don't hack the .ui file manually. This may work now and silently break at any time in the future, as it's not a supported feature.

        1 Reply Last reply
        3

        • Login

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