Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Call for Presentations - Qt World Summit

    Solved how the functions of QanalogClockPlugin has been called in qwidgetplugins.

    General and Desktop
    4
    19
    1626
    Loading More Posts
    • 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.
    • mrjj
      mrjj Lifetime Qt Champion @hjohn last edited by 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 1 Reply Last reply Reply Quote 0
      • H
        hjohn @mrjj last edited by 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

        jsulm 1 Reply Last reply Reply Quote 0
        • jsulm
          jsulm Lifetime Qt Champion @hjohn last edited by

          @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 Reply Quote 0
          • H
            hjohn last edited by 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 .

            jsulm 1 Reply Last reply Reply Quote 0
            • jsulm
              jsulm Lifetime Qt Champion @hjohn last edited by

              @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 Reply Quote 1
              • mrjj
                mrjj Lifetime Qt Champion last edited by

                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 Reply Quote 3
                • H
                  hjohn @jsulm last edited by

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

                  jsulm 1 Reply Last reply Reply Quote 1
                  • jsulm
                    jsulm Lifetime Qt Champion @hjohn last edited by

                    @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 Reply Quote 0
                    • H
                      hjohn @mrjj last edited by

                      This post is deleted!
                      1 Reply Last reply Reply Quote 0
                      • H
                        hjohn @mrjj last edited by 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.

                        mrjj 1 Reply Last reply Reply Quote 0
                        • mrjj
                          mrjj Lifetime Qt Champion @hjohn last edited by 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 1 Reply Last reply Reply Quote 3
                          • H
                            hjohn @mrjj last edited by

                            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 Reply Quote 0
                            • First post
                              Last post