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. QtCreator - Custom widget plugin and mouse click event

QtCreator - Custom widget plugin and mouse click event

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
7 Posts 3 Posters 2.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.
  • deleted57D Offline
    deleted57D Offline
    deleted57
    wrote on last edited by
    #1

    Hi all

    I'm developing a custom widget plugin for QtCreator. My widget is container type, very similar to QTabWidget, this mean accept pages and so on. I developed the plugin and all is working well. The only "feature" I can not add yet is the mouse click inside the QtDesigner window panel. If you add the QTabWidget inside the QtDesigner target window you can move between QTabWidget pages by directly click over the tab of the control. I would to obtain the same result but it seem QtCreator filter all mouse down events and doesn't allow to reach the widget managed by the plugin. I checked all examples but still not found a way, someone can suggest a a solution?
    Thank you

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

      Unfortunately there's no interface to do what you want. Designer plugins are quite limited in what they can do.
      Note that all they do is provide an xml description of your widget's properties in .ui file and, as such, can't do anything that uic doesn't understand.
      A plugin is pretty much a list of properties of very limited QVariant types subset.
      The only difference of a container plugin is that it allows designer to set a layout (a single one) and add child widgets to it. That is pretty useless for a tabwidget-like plugin, since it would need a layout for each tab.

      1 Reply Last reply
      0
      • deleted57D Offline
        deleted57D Offline
        deleted57
        wrote on last edited by
        #3

        Hi
        Thank you for your reply. However why QTabWidget "component" work in different way and allow to manage click events? I guess the reply is this component is not managed by a plugin but is in some way part of QtCreator main code and have a different possibilities, is this correct? I tried to get the QtDesigner sources but still didn't fine the code managing this windget...

        1 Reply Last reply
        0
        • deleted57D Offline
          deleted57D Offline
          deleted57
          wrote on last edited by
          #4

          If someone is interested the solution to this problem can be found here:

          http://falsinsoft.blogspot.com/2016/02/qt-designer-develop-custom-widget.html

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

            This is an implementation detail of a private API. You shouldn't be using this in your plugins. It's not documented and it may change in future versions unannounced.
            Besides, as I mentioned earlier, getting mouse events is not enough to implement a tabwidget-like plugin. Modifications of the .ui format and uic tool would be needed.

            1 Reply Last reply
            0
            • deleted57D Offline
              deleted57D Offline
              deleted57
              wrote on last edited by
              #6

              After added this prefix to object name as explained in the article I was able to develop a plugin workig in the exacly same way of QTabWidget without any specific change in the widget code. By the way, just for try to clarify to myself, I tried to made some search and I found the same object name prefix is used in the official Qt example here:

              http://doc.qt.io/qt-5/qtdesigner-containerextension-example.html

              However there is no info regarding this prefix but if this trick is reported in an example of Qt package I guess it will be keep in the future. In case of change I'll modify my plugin too based to the new way...

              1 Reply Last reply
              1
              • Aleksey_KA Offline
                Aleksey_KA Offline
                Aleksey_K
                wrote on last edited by
                #7

                Thanks to find this article - very useful!

                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