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. Create top level widgets in QT application (draggable)
Forum Updated to NodeBB v4.3 + New Features

Create top level widgets in QT application (draggable)

Scheduled Pinned Locked Moved Solved General and Desktop
14 Posts 3 Posters 860 Views 3 Watching
  • 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.
  • M Offline
    M Offline
    mrjj
    Lifetime Qt Champion
    wrote on 7 Jul 2021, 21:15 last edited by
    #3

    Hi
    Doing this is QWidgets is not so easy as floating a widget over all widgets will have some
    issues.

    1 Reply Last reply
    0
    • S SGaist
      7 Jul 2021, 19:57

      Hi,

      Maybe the PieMenu will fit your needs.

      T Offline
      T Offline
      Thank You
      wrote on 8 Jul 2021, 10:28 last edited by
      #4

      @SGaist
      Yes That's good.
      But It would be great if I got some thing like this in Widgets
      @mrjj
      I guess I should shift to QML now. πŸ˜‚πŸ˜‚

      Let's make QT free or It will go forever

      TRUE AND FALSE <3

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SGaist
        Lifetime Qt Champion
        wrote on 8 Jul 2021, 18:34 last edited by
        #5

        There's an old Qt Quarterly article which covers pie menu. It's from a time where QtQuick was not even an idea yet.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        2
        • M Offline
          M Offline
          mrjj
          Lifetime Qt Champion
          wrote on 8 Jul 2021, 19:35 last edited by
          #6

          Hi
          I download the code from @SGaist link and discovered it was based on something called
          QtPieMenu.
          I then goggled
          https://github.com/mola/QtPieMenu

          Which just needed some include fixed and then it ran

          alt text

          ps . i added as it was undefined and not in either math and cmath

          #ifndef M_PI
              #define M_PI 3.14159265358979323846
          #endif
          
          
          T 1 Reply Last reply 11 Jul 2021, 05:35
          3
          • M mrjj
            8 Jul 2021, 19:35

            Hi
            I download the code from @SGaist link and discovered it was based on something called
            QtPieMenu.
            I then goggled
            https://github.com/mola/QtPieMenu

            Which just needed some include fixed and then it ran

            alt text

            ps . i added as it was undefined and not in either math and cmath

            #ifndef M_PI
                #define M_PI 3.14159265358979323846
            #endif
            
            
            T Offline
            T Offline
            Thank You
            wrote on 11 Jul 2021, 05:35 last edited by Thank You 7 Nov 2021, 05:40
            #7

            @mrjj
            Yes I built it succesfully
            with these improvements

            //#include <QtGui/QApplication>
            #include<QApplication>
            #include <QtGui/QImage>
            #include <QtGui/QBitmap>
            #include <QtCore/QPointer>
            #include <QtGui/QCursor>
            //#include <QtGui/QStyle>
            #include<QStyle>
            #include <QtGui/QPainter>
            #include <QtGui/QIcon>
            #include <QtGui/QTextLayout>
            //#include <QtGui/QLayout>
            //#include <QtGui/QDesktopWidget>
            

            I just changed some of header files See commented files are not available so I replaced them with others

            347f7ced-9672-4696-b231-47713e3d7aa6-image.png

            b3128073-8fad-4a76-9c32-130180264dd8-image.png

            Another Problem

            • When I click on menus the menu disappears

            See here This is not working what I was expecting

            I am using QT 5.12.8
            and it is built using

            QT 512.8 MSVC 2015

            I define M_PI too as said by @mrjj

            \qtpiemenu.cpp:600: warning: 'screenNumber' is deprecated
            C:\Qt\Qt5.12.8\5.12.8\msvc2015_64\include\QtCore\qcompilerdetection.h:1203: expanded from macro 'Q_DECL_DEPRECATED_X'
            C:\Qt\Qt5.12.8\5.12.8\msvc2015_64\include\QtWidgets\qdesktopwidget.h:77: 
            'screenGeometry' has been explicitly marked deprecated here
            // it says these issues
            

            The menus are not working properly

            Let's make QT free or It will go forever

            TRUE AND FALSE <3

            M 1 Reply Last reply 11 Jul 2021, 07:53
            0
            • T Thank You
              11 Jul 2021, 05:35

              @mrjj
              Yes I built it succesfully
              with these improvements

              //#include <QtGui/QApplication>
              #include<QApplication>
              #include <QtGui/QImage>
              #include <QtGui/QBitmap>
              #include <QtCore/QPointer>
              #include <QtGui/QCursor>
              //#include <QtGui/QStyle>
              #include<QStyle>
              #include <QtGui/QPainter>
              #include <QtGui/QIcon>
              #include <QtGui/QTextLayout>
              //#include <QtGui/QLayout>
              //#include <QtGui/QDesktopWidget>
              

              I just changed some of header files See commented files are not available so I replaced them with others

              347f7ced-9672-4696-b231-47713e3d7aa6-image.png

              b3128073-8fad-4a76-9c32-130180264dd8-image.png

              Another Problem

              • When I click on menus the menu disappears

              See here This is not working what I was expecting

              I am using QT 5.12.8
              and it is built using

              QT 512.8 MSVC 2015

              I define M_PI too as said by @mrjj

              \qtpiemenu.cpp:600: warning: 'screenNumber' is deprecated
              C:\Qt\Qt5.12.8\5.12.8\msvc2015_64\include\QtCore\qcompilerdetection.h:1203: expanded from macro 'Q_DECL_DEPRECATED_X'
              C:\Qt\Qt5.12.8\5.12.8\msvc2015_64\include\QtWidgets\qdesktopwidget.h:77: 
              'screenGeometry' has been explicitly marked deprecated here
              // it says these issues
              

              The menus are not working properly

              M Offline
              M Offline
              mrjj
              Lifetime Qt Champion
              wrote on 11 Jul 2021, 07:53 last edited by mrjj 7 Nov 2021, 08:12
              #8

              @Thank-You
              Hi
              the deprecated warnings you can ignore.
              Just means the function will be removed at some point.

              • The menus are not working properly

              Ok. Sad - It was somewhat close to what you asked- i think :)

              alt text

              It seems to work for me. but I didn't try to insert my own menus to it and
              "not working properly" does really not hint at what you experienced.

              T 1 Reply Last reply 11 Jul 2021, 08:36
              0
              • M mrjj
                11 Jul 2021, 07:53

                @Thank-You
                Hi
                the deprecated warnings you can ignore.
                Just means the function will be removed at some point.

                • The menus are not working properly

                Ok. Sad - It was somewhat close to what you asked- i think :)

                alt text

                It seems to work for me. but I didn't try to insert my own menus to it and
                "not working properly" does really not hint at what you experienced.

                T Offline
                T Offline
                Thank You
                wrote on 11 Jul 2021, 08:36 last edited by
                #9

                @mrjj
                I also didn't insert my own menus too.

                  QVBoxLayout *lt = new QVBoxLayout(ui->centralWidget);
                  lt->addWidget(root);
                  ui->centralWidget->setLayout(lt);
                

                This is the only thing that I added. I forgot to mention this. It was not showing any thing before adding this code here.

                It was just showing blank screen at that time

                And another thing is
                When you click the button it disappears.

                I guess it exists in your video too

                Let's make QT free or It will go forever

                TRUE AND FALSE <3

                M 1 Reply Last reply 11 Jul 2021, 08:39
                0
                • T Thank You
                  11 Jul 2021, 08:36

                  @mrjj
                  I also didn't insert my own menus too.

                    QVBoxLayout *lt = new QVBoxLayout(ui->centralWidget);
                    lt->addWidget(root);
                    ui->centralWidget->setLayout(lt);
                  

                  This is the only thing that I added. I forgot to mention this. It was not showing any thing before adding this code here.

                  It was just showing blank screen at that time

                  And another thing is
                  When you click the button it disappears.

                  I guess it exists in your video too

                  M Offline
                  M Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on 11 Jul 2021, 08:39 last edited by mrjj 7 Nov 2021, 08:55
                  #10

                  Good morning

                  • It was just showing blank screen at that time

                  I have to right click to show it. It then comes where you click

                  • When you click the button it disappears.
                    Yes when you select an End menu (one that has no subitems) , you select it when you click it and then it closes a a menu normally does.

                  Is that what you mean or does it close in odd places also for you ?

                  update:

                  void  QtPieMenu::subMenuSelected()
                  {
                    emit  activated();
                    emit  aboutToHide();
                    //----->>>> hide();   if you take out this it wont close
                  }
                  
                  T 1 Reply Last reply 11 Jul 2021, 09:06
                  0
                  • M mrjj
                    11 Jul 2021, 08:39

                    Good morning

                    • It was just showing blank screen at that time

                    I have to right click to show it. It then comes where you click

                    • When you click the button it disappears.
                      Yes when you select an End menu (one that has no subitems) , you select it when you click it and then it closes a a menu normally does.

                    Is that what you mean or does it close in odd places also for you ?

                    update:

                    void  QtPieMenu::subMenuSelected()
                    {
                      emit  activated();
                      emit  aboutToHide();
                      //----->>>> hide();   if you take out this it wont close
                    }
                    
                    T Offline
                    T Offline
                    Thank You
                    wrote on 11 Jul 2021, 09:06 last edited by
                    #11

                    @mrjj

                    I have to right click to show it. It then comes where you click

                    I didn't know about that. It's working fine in this condition

                    //----->>>> hide(); if you take out this it wont close

                    Yes it is also working. Thanks.

                    But the main problem is styling
                    87df3481-fe99-4d73-b069-b9a778ba8eb1-image.png

                    See when I full screen the application. It seems to come somewhere near it but not like what is in your machine

                    8bb1ce8a-b558-4527-8db6-6f2a898d054e-image.png

                    See this one too. It is not that good

                    Let's make QT free or It will go forever

                    TRUE AND FALSE <3

                    M 1 Reply Last reply 11 Jul 2021, 09:15
                    0
                    • T Thank You
                      11 Jul 2021, 09:06

                      @mrjj

                      I have to right click to show it. It then comes where you click

                      I didn't know about that. It's working fine in this condition

                      //----->>>> hide(); if you take out this it wont close

                      Yes it is also working. Thanks.

                      But the main problem is styling
                      87df3481-fe99-4d73-b069-b9a778ba8eb1-image.png

                      See when I full screen the application. It seems to come somewhere near it but not like what is in your machine

                      8bb1ce8a-b558-4527-8db6-6f2a898d054e-image.png

                      See this one too. It is not that good

                      M Offline
                      M Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on 11 Jul 2021, 09:15 last edited by
                      #12

                      @Thank-You
                      Hi
                      That's comes from you putting in a layout. Then its no longer floating as before and i think
                      it alters how it can show its menus. At least that is my guess as i didn't see the submenus do anything like that.

                      T 1 Reply Last reply 11 Jul 2021, 09:25
                      0
                      • M mrjj
                        11 Jul 2021, 09:15

                        @Thank-You
                        Hi
                        That's comes from you putting in a layout. Then its no longer floating as before and i think
                        it alters how it can show its menus. At least that is my guess as i didn't see the submenus do anything like that.

                        T Offline
                        T Offline
                        Thank You
                        wrote on 11 Jul 2021, 09:25 last edited by Thank You 7 Nov 2021, 09:32
                        #13

                        @mrjj

                        That's comes from you putting in a layout. Then its no longer floating as before and i think

                        Exactly Bro

                        I have to right click to show it. It then comes where you click

                        At first I didn't know about it. It was just blank before So I added it to layout so that it would be shown.

                        So that's the problem in my code.
                        It's working perfectly fine.

                        One thing would be greater.
                        The anti aliasing feature would be great. It doesn't look that much perfectπŸ˜‚πŸ˜‚πŸ˜‚
                        It's just for design issue.

                        And another thing just about this forum.

                        I should have marked answer to post with link but I accidentally clicked another one. Is there way to revert it.

                        https://github.com/mola/QtPieMenu

                        Let's make QT free or It will go forever

                        TRUE AND FALSE <3

                        M 1 Reply Last reply 11 Jul 2021, 09:38
                        0
                        • T Thank You
                          11 Jul 2021, 09:25

                          @mrjj

                          That's comes from you putting in a layout. Then its no longer floating as before and i think

                          Exactly Bro

                          I have to right click to show it. It then comes where you click

                          At first I didn't know about it. It was just blank before So I added it to layout so that it would be shown.

                          So that's the problem in my code.
                          It's working perfectly fine.

                          One thing would be greater.
                          The anti aliasing feature would be great. It doesn't look that much perfectπŸ˜‚πŸ˜‚πŸ˜‚
                          It's just for design issue.

                          And another thing just about this forum.

                          I should have marked answer to post with link but I accidentally clicked another one. Is there way to revert it.

                          https://github.com/mola/QtPieMenu

                          M Offline
                          M Offline
                          mrjj
                          Lifetime Qt Champion
                          wrote on 11 Jul 2021, 09:38 last edited by
                          #14

                          @Thank-You
                          Hi
                          ok. super.

                          • The anti aliasing feature would be great. It doesn't look that much perfect
                            I agree. I think it comes from using the mask and its floating. Then it cant
                            smooth it as much as normally. Could most likely be helped with a thigger line or
                            some tweaking.

                          • I should have marked answer to post with link but I accidentally clicked another one. Is there way to revert it.
                            Im not sure how to undo it as not even admins have options for that. and it has no side menu.

                          1 Reply Last reply
                          0

                          12/14

                          11 Jul 2021, 09:15

                          • Login

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