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 786 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on 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
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on 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
      
      
      Thank YouT 1 Reply Last reply
      3
      • mrjjM mrjj

        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
        
        
        Thank YouT Offline
        Thank YouT Offline
        Thank You
        wrote on last edited by Thank You
        #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

        mrjjM 1 Reply Last reply
        0
        • Thank YouT Thank You

          @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

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by mrjj
          #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.

          Thank YouT 1 Reply Last reply
          0
          • mrjjM mrjj

            @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.

            Thank YouT Offline
            Thank YouT Offline
            Thank You
            wrote on 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

            mrjjM 1 Reply Last reply
            0
            • Thank YouT Thank You

              @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

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by mrjj
              #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
              }
              
              Thank YouT 1 Reply Last reply
              0
              • mrjjM mrjj

                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
                }
                
                Thank YouT Offline
                Thank YouT Offline
                Thank You
                wrote on 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

                mrjjM 1 Reply Last reply
                0
                • Thank YouT Thank You

                  @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

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on 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.

                  Thank YouT 1 Reply Last reply
                  0
                  • mrjjM mrjj

                    @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.

                    Thank YouT Offline
                    Thank YouT Offline
                    Thank You
                    wrote on last edited by Thank You
                    #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

                    mrjjM 1 Reply Last reply
                    0
                    • Thank YouT Thank You

                      @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

                      mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on 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

                      • Login

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