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. MenuBar show Menu or Hide
Qt 6.11 is out! See what's new in the release blog

MenuBar show Menu or Hide

Scheduled Pinned Locked Moved General and Desktop
17 Posts 3 Posters 9.0k Views 1 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.
  • Q Offline
    Q Offline
    QtTommy
    wrote on last edited by
    #2

    Hello Alex, at the moment I try to understand what you try to do. In my opinion you are trying to make the menubar items available and the opposite in dependence of the current userlevel. Do you have a screenshot of your application?

    1 Reply Last reply
    0
    • N Offline
      N Offline
      nickvan86
      wrote on last edited by
      #3

      Hallo,

      ja genau so meinte ich das. Ich habe ein Menü das je nach Usergroupe verschiedene Teile zu sehen sind.

      Qt 5.2.1 Creator 3.0.1 Windows 7 64bit

      1 Reply Last reply
      0
      • N Offline
        N Offline
        nickvan86
        wrote on last edited by
        #4

        http://imagizer.imageshack.us/a/img196/633/5k5d.png

        Hier ist das Bild. Ist leider nur 9 Tage online

        Qt 5.2.1 Creator 3.0.1 Windows 7 64bit

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #5

          Hi guys,

          Please keep the thread in English, it's the official language to communicate on the forum (except for the regional sub-forums)

          As for your problem, it looks more like hiding a menu itself rather than the menu bar, or did I understand wrong ?

          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
          0
          • N Offline
            N Offline
            nickvan86
            wrote on last edited by
            #6

            I will from the menuBar individual menue Heiden or shown.
            I will See file and hide settings and about also Show in the Bar. When the if is true i will See Database in the Menu and the admin menu

            Qt 5.2.1 Creator 3.0.1 Windows 7 64bit

            1 Reply Last reply
            0
            • Q Offline
              Q Offline
              QtTommy
              wrote on last edited by
              #7

              Oh I'm sorry! that was my mistake! I thought maybe it is easier for him to describe his problem in a familiar language but I forgot that other people could have the same problem whose are not familiar with the german language.

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #8

                There's always the "german forum":http://qt-project.org/forums/viewforum/30/ for that :)

                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
                0
                • Q Offline
                  Q Offline
                  QtTommy
                  wrote on last edited by
                  #9

                  Is the problem that you cannot hide the menuitems or is the problem that you have no idea how to handle the logic of hiding and showing the items in general?

                  1 Reply Last reply
                  0
                  • N Offline
                    N Offline
                    nickvan86
                    wrote on last edited by
                    #10

                    I can hide the completly menu, but i will not hide all of this items.
                    I have no idea with the Right Way :-(
                    I try a lot of but nothing whas what i want.

                    Sorry for my terrible english

                    Alex

                    Qt 5.2.1 Creator 3.0.1 Windows 7 64bit

                    1 Reply Last reply
                    0
                    • Q Offline
                      Q Offline
                      QtTommy
                      wrote on last edited by
                      #11

                      Don't worry abour your english ;) Ok, I think the easiest way to realize it is

                      @int iUserLevel = 0;

                      enum UserLevel
                      {
                          eUSER = 0,
                          eADMIN,
                      };
                      

                      int checkUserlevel()
                      {
                      if(iUserLevel == eADMIN)
                      {
                      ui->menu_Datei ->setEnabled(true);
                      ui->menu_Bearbeiten ->setEnabled(true);
                      ui->menu_Datenbank ->setEnabled(true);

                      }
                      else if(iUserLevel == eUSER)
                      {
                          ui->menu_Datei      ->setEnabled(true);
                          ui->menu_Bearbeiten ->setEnabled(true);
                          ui->menu_Datenbank  ->setEnabled(false);
                      }
                      

                      return 0;
                      }
                      @

                      Or is it a problem if the user can see the database item? I prefer to work with enumerations for the userlevel because it is better to handle than strings.

                      1 Reply Last reply
                      0
                      • N Offline
                        N Offline
                        nickvan86
                        wrote on last edited by
                        #12

                        Hello,

                        this idea:

                        @ui->menu_Datei ->setEnabled(true);
                        ui->menu_Bearbeiten ->setEnabled(true);
                        ui->menu_Datenbank ->setEnabled(false);@

                        is not bad. This idea is god and the User can´t clicked the menuItem, but in another program i will the user can´t see the database item.
                        Okay. I must look what i do for this problem. But this is a start in the right way.

                        Thanks for help :-)

                        Alex

                        Qt 5.2.1 Creator 3.0.1 Windows 7 64bit

                        1 Reply Last reply
                        0
                        • SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on last edited by
                          #13

                          Then you can change setEnabled by setVisible for the items that should be invisible to the user

                          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
                          0
                          • N Offline
                            N Offline
                            nickvan86
                            wrote on last edited by
                            #14

                            When i use this code:

                            @ui->menuDatenbank->setVisible(false);@

                            or:

                            @ui->menuDatenbank->setVisible(true);@

                            it doesn´t work correctly.
                            I can use Datenbank item every time still with this code

                            Qt 5.2.1 Creator 3.0.1 Windows 7 64bit

                            1 Reply Last reply
                            0
                            • SGaistS Offline
                              SGaistS Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on last edited by
                              #15

                              With the menu not visible ? How do you do that ?

                              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
                              0
                              • N Offline
                                N Offline
                                nickvan86
                                wrote on last edited by
                                #16

                                When i use setVisible(true) i have the downMenu from Datenbank in the left corner :-D

                                Qt 5.2.1 Creator 3.0.1 Windows 7 64bit

                                1 Reply Last reply
                                0
                                • SGaistS Offline
                                  SGaistS Offline
                                  SGaist
                                  Lifetime Qt Champion
                                  wrote on last edited by
                                  #17

                                  Can you show an image of what you get both with setVisible(true) and setVisible(false) ?

                                  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
                                  0

                                  • Login

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