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. how the functions of QanalogClockPlugin has been called in qwidgetplugins.

how the functions of QanalogClockPlugin has been called in qwidgetplugins.

Scheduled Pinned Locked Moved Solved General and Desktop
19 Posts 4 Posters 2.2k 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.
  • H hjohn

    @mrjj it meaans by using functions like name() and CreatWidget() ,plugin connect with that particular widget.
    if so,then if i want to add another widget then i have to just add new values in these two functions.

    QString widgetPlugins::domXml() const{}
    

    Is this function important to implement.?

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

    @hjohn

    Hi
    All the functions showed must be implemented.
    Its not optional. All must be implemented.

    Its possible to have same plugin offer more than one widget.

    So if u have multiple widgets, there is a better way than
    creating multiple plugins for each widget.
    But you should wait with that unless one plugin is ok to handle :)

    H 1 Reply Last reply
    1
    • mrjjM mrjj

      @hjohn

      Hi
      All the functions showed must be implemented.
      Its not optional. All must be implemented.

      Its possible to have same plugin offer more than one widget.

      So if u have multiple widgets, there is a better way than
      creating multiple plugins for each widget.
      But you should wait with that unless one plugin is ok to handle :)

      H Offline
      H Offline
      hjohn
      wrote on last edited by
      #7

      @mrjj yeah thanks..one last question:
      As i know if we work with Widget if have to call

      Widget w;
      w.show();
      

      in main.cpp.
      But here in this example from qtdocument
      http://doc.qt.io/qt-5/qtdesigner-customwidgetplugin-example.html

      they are not including main.cpp file. Is this possible to run and display widget without main.cpp file

      mrjjM 1 Reply Last reply
      0
      • H hjohn

        @mrjj yeah thanks..one last question:
        As i know if we work with Widget if have to call

        Widget w;
        w.show();
        

        in main.cpp.
        But here in this example from qtdocument
        http://doc.qt.io/qt-5/qtdesigner-customwidgetplugin-example.html

        they are not including main.cpp file. Is this possible to run and display widget without main.cpp file

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

        @hjohn
        Hi
        You can show a widget from anywhere.
        But to prevent out of scope issues, you should new it

        Widget* w = new Widget(this);
        w->show();

        But normally, a plugin for Designer DO NOT open other widgets.

        H 1 Reply Last reply
        0
        • mrjjM mrjj

          @hjohn
          Hi
          You can show a widget from anywhere.
          But to prevent out of scope issues, you should new it

          Widget* w = new Widget(this);
          w->show();

          But normally, a plugin for Designer DO NOT open other widgets.

          H Offline
          H Offline
          hjohn
          wrote on last edited by hjohn
          #9

          @mrjj said in how the functions of QanalogClockPlugin has been called in qwidgetplugins.:

          But normally, a plugin for Designer DO NOT open other widgets.

          In example there is only one widget.which is analogclock and that i want to open. In example there is no any w.show();command

          jsulmJ 1 Reply Last reply
          0
          • H hjohn

            @mrjj said in how the functions of QanalogClockPlugin has been called in qwidgetplugins.:

            But normally, a plugin for Designer DO NOT open other widgets.

            In example there is only one widget.which is analogclock and that i want to open. In example there is no any w.show();command

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #10

            @hjohn The application is showing the widget, the plug-in simply creates and returns an instance of it.

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • H Offline
              H Offline
              hjohn
              wrote on last edited by hjohn
              #11

              When run Example of http://doc.qt.io/qt-5/qtdesigner-customwidgetplugin-example.html
              it generate
              0_1529575055613_6b412866-740a-4bee-967c-13bf8d077d73-image.png

              It means that This project is not created in the normal 'Qt-executable' kind format.Maybe because there is no main.cpp file.
              what should i add or how to create project so that is get output as a analogClock .

              jsulmJ 1 Reply Last reply
              0
              • H hjohn

                When run Example of http://doc.qt.io/qt-5/qtdesigner-customwidgetplugin-example.html
                it generate
                0_1529575055613_6b412866-740a-4bee-967c-13bf8d077d73-image.png

                It means that This project is not created in the normal 'Qt-executable' kind format.Maybe because there is no main.cpp file.
                what should i add or how to create project so that is get output as a analogClock .

                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #12

                @hjohn The main.cpp is part of QtDesigner.
                So, it is a normal Qt application which loads plug-ins.
                Again: a plug-in does NOT have a main.cpp, because it is a plug-in which is loaded by an application.
                A plug-in is a library and a library does not have main.cpp.

                https://forum.qt.io/topic/113070/qt-code-of-conduct

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

                  Hi

                  To see the clock there is 2 options.

                  1:
                  Compile it as plugin and COPY the DLL to the Designer plugin folder in your Qt installation folder
                  ( or do make install )
                  Start Creator and then make project as normally with ui and
                  drag the analog clock to the new form.

                  2:
                  Dont use as plugin at all.
                  use the files analogclock.cpp/.h directly in a project
                  and simply NEW a analog clock and show it.

                  If you just started with Qt/programming. Designer plugins are maybe a bit
                  hard topic to start with :)

                  H 2 Replies Last reply
                  3
                  • jsulmJ jsulm

                    @hjohn The main.cpp is part of QtDesigner.
                    So, it is a normal Qt application which loads plug-ins.
                    Again: a plug-in does NOT have a main.cpp, because it is a plug-in which is loaded by an application.
                    A plug-in is a library and a library does not have main.cpp.

                    H Offline
                    H Offline
                    hjohn
                    wrote on last edited by
                    #14

                    @jsulm so how am I supposed to load this plugin?
                    http://doc.qt.io/qt-5/qtdesigner-customwidgetplugin-example.html

                    jsulmJ 1 Reply Last reply
                    1
                    • H hjohn

                      @jsulm so how am I supposed to load this plugin?
                      http://doc.qt.io/qt-5/qtdesigner-customwidgetplugin-example.html

                      jsulmJ Offline
                      jsulmJ Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on last edited by
                      #15

                      @hjohn Please check what @mrjj said.
                      There is one important thing: if you want to use this plug-in in QtDesigner you have to use exactly same Qt version and same compiler as were used to build QtDesigner!

                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0
                      • mrjjM mrjj

                        Hi

                        To see the clock there is 2 options.

                        1:
                        Compile it as plugin and COPY the DLL to the Designer plugin folder in your Qt installation folder
                        ( or do make install )
                        Start Creator and then make project as normally with ui and
                        drag the analog clock to the new form.

                        2:
                        Dont use as plugin at all.
                        use the files analogclock.cpp/.h directly in a project
                        and simply NEW a analog clock and show it.

                        If you just started with Qt/programming. Designer plugins are maybe a bit
                        hard topic to start with :)

                        H Offline
                        H Offline
                        hjohn
                        wrote on last edited by
                        #16
                        This post is deleted!
                        1 Reply Last reply
                        0
                        • mrjjM mrjj

                          Hi

                          To see the clock there is 2 options.

                          1:
                          Compile it as plugin and COPY the DLL to the Designer plugin folder in your Qt installation folder
                          ( or do make install )
                          Start Creator and then make project as normally with ui and
                          drag the analog clock to the new form.

                          2:
                          Dont use as plugin at all.
                          use the files analogclock.cpp/.h directly in a project
                          and simply NEW a analog clock and show it.

                          If you just started with Qt/programming. Designer plugins are maybe a bit
                          hard topic to start with :)

                          H Offline
                          H Offline
                          hjohn
                          wrote on last edited by hjohn
                          #17

                          @mrjj said in how the functions of QanalogClockPlugin has been called in qwidgetplugins.:

                          Start Creator and then make project as normally with ui and
                          drag the analog clock to the new form.

                          hey thanks.Can u elaborate this , It would be great help.

                          mrjjM 1 Reply Last reply
                          0
                          • H hjohn

                            @mrjj said in how the functions of QanalogClockPlugin has been called in qwidgetplugins.:

                            Start Creator and then make project as normally with ui and
                            drag the analog clock to the new form.

                            hey thanks.Can u elaborate this , It would be great help.

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

                            @hjohn
                            Well if on windows.
                            Check what your creator was compiled with.
                            You need to use same compiler and ca. same Qt version.
                            alt text
                            Install visual studio 2015 or 2017 with 32 bit !
                            This is a download from Microsoft site. Not Qt. ( not allowed)
                            ( you cannot use mingw)
                            Install the Qt for visual studio.
                            (mingw version cannot be used)
                            alt text

                            THE ABOVE IS MUST DO! else it wont work.

                            Then compile the plugin in RELEASE mode and 32 Bit. ( not 64)
                            Go to its build folder and copy the DLL to
                            alt text
                            C:\Qt\Tools\QtCreator\bin\plugins\designer
                            alt text

                            Start Creator and go to design mode
                            It will be in list to the left.
                            Scroll down to find it.

                            Note: this is considered intermediate level. :)

                            H 1 Reply Last reply
                            3
                            • mrjjM mrjj

                              @hjohn
                              Well if on windows.
                              Check what your creator was compiled with.
                              You need to use same compiler and ca. same Qt version.
                              alt text
                              Install visual studio 2015 or 2017 with 32 bit !
                              This is a download from Microsoft site. Not Qt. ( not allowed)
                              ( you cannot use mingw)
                              Install the Qt for visual studio.
                              (mingw version cannot be used)
                              alt text

                              THE ABOVE IS MUST DO! else it wont work.

                              Then compile the plugin in RELEASE mode and 32 Bit. ( not 64)
                              Go to its build folder and copy the DLL to
                              alt text
                              C:\Qt\Tools\QtCreator\bin\plugins\designer
                              alt text

                              Start Creator and go to design mode
                              It will be in list to the left.
                              Scroll down to find it.

                              Note: this is considered intermediate level. :)

                              H Offline
                              H Offline
                              hjohn
                              wrote on last edited by
                              #19

                              Thank you very much @mrjj
                              Now I got the clear idea what was the mistake I was making. And thanks a lot for the efforts you did, it was a huge help.Thank you.

                              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