Navigation

    Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Search
    1. Home
    2. Tags
    3. qmenu
    Log in to post

    • SOLVED QMenuBar not responsive
      General and Desktop • c++ qmenu qmenubar qt 5.9.5 • • Daniel_Contro  

      6
      0
      Votes
      6
      Posts
      42
      Views

      It might be an issue with macOS 10.15. One thing you can do as a workaround is to disable the native macOS menu bar. You will have it on the QMainWindow but it should be usable.
    • UNSOLVED Clicking on QMacToolBar does not close open QMenus
      General and Desktop • qmainwindow qmenu qaction qmacnativewidge qmactoolbar • • SajasKK  

      7
      0
      Votes
      7
      Posts
      67
      Views

      Old lasting bug ... Funny things happen in full screen ... In this screenshots you can see an another bug : the checkmark ✓ doesn't follow the font size of the menu.
    • UNSOLVED pop up menu from unit test
      General and Desktop • qmenu qtest • • eleventy  

      3
      0
      Votes
      3
      Posts
      83
      Views

      @Christian-Ehrlicher The widget that needs to show the context menu is a QTableView, not a QComboBox.
    • SOLVED Context menu QMenu not showing up when using popup(). Only showing on exec().
      General and Desktop • qmenu exec context menu popup • • dante77  

      3
      0
      Votes
      3
      Posts
      317
      Views

      Thank you @SGaist ! I figured it was something along those lines but couldn't put my finger on it.
    • SOLVED Can't change margins of items inside QMenuBar
      General and Desktop • qmenu qmenubar • • RBLL  

      3
      0
      Votes
      3
      Posts
      177
      Views

      QMenuBar { spacing: 0px; } That did it! Thank you very much!
    • UNSOLVED QMenu - 2 + columns of items
      General and Desktop • qmenu • • Dariusz  

      4
      0
      Votes
      4
      Posts
      192
      Views

      @dariusz Well the QMenu will still treat it as one item so its also kinda pretending :) I agree. you could also make a complete custom popup (like the drop down in ComboBox) type of menu and open it from a button but its harder to integrated with the rest of the QMenu if you have such one.
    • UNSOLVED QMenu & QAction get sender button/widget?
      General and Desktop • qmenu qaction • • Dariusz  

      4
      0
      Votes
      4
      Posts
      734
      Views

      @mrjj said in QMenu & QAction get sender button/widget?: Hi Why do you need to know the parent? QAction can be shared so the same function can be activated from multiple sources. But normally action does the same regardless from where is was triggered. I need to adjust action command parameters depending on the parent widget. I tried action->parentWidget() but it did not return anything I could use . Esentially I can have action that does A+B, and if the action is in global widget it would do just that, but if its in local widget then I will need localA + localB... more or less... thus the need to have a way to knowing parent widget while sending command to work. @Chris-Kawa said in QMenu & QAction get sender button/widget?: Instead of starting with the action you can connect to the menu's triggered signal. In the slot sender() will give you the menu and you can go up the parents with parentWidget() to find the toolbar if you need. Hmmmmm that looks very tempting!!! Will give it a go thanks! I was about to write my own action system to handle my needs but perhaps with Chris Kawa reply I can utilize native qt ones ! Thanks! BRB testing. Ok so this gets me half way there. I can now do quite a bit nice stuff with menu & actions, like changing menu default action to do something else based on action clicked and all that - yay ! But... how do I find out that menu parent - QToolbar or QToolButton? Is there a path down from there? And it looks like the toolButton has thesame triggered signal... hmmmm yep this is beautifull, it propagates all the way to toolButton where I can do what I want with the action and its data. Amazing, whoever designed that system is my hero.
    • SOLVED How to use Qt classes defined accross multiple files?
      General and Desktop • desktop qmainwindow qmenu gui developer • • MakingTheEight  

      8
      0
      Votes
      8
      Posts
      794
      Views

      @jsulm @mrjj @ig Thanks for all the help. I was able to fix the inheritance issue by creating a new FileMenu instance in the main window.
    • SOLVED Cannot connect QAction in a QPushButton menu to a slot
      General and Desktop • qpushbutton qmenu qaction • • fugreh  

      3
      0
      Votes
      3
      Posts
      671
      Views

      Hi, In addition to @MrShawn, the slot can have less arguments than the signal, therefore you can keep their current signature.
    • UNSOLVED Android menu without qml etc.
      Mobile and Embedded • android qmenu options menu • • huw_  

      5
      0
      Votes
      5
      Posts
      1779
      Views

      Hi, for an easy native-styled Android menu (QML-based though), you can also have a look at V-Play Engine, which extends Qt and handles native features and styling for Android and iOS. E.g. for a native styled Navigation, with the V-Play Navigation Components: import VPlayApps 1.0 App { Navigation { NavigationItem { title: "Home" icon: IconType.home NavigationStack { Page { title: "Home" } } } NavigationItem { title: "Favorites" icon: IconType.star NavigationStack { Page { title: "Favorites" } } } } } Best, GTDev
    • UNSOLVED Completely custom menu in QtWidgets
      General and Desktop • qmenu qtwidgets material design context menu • • IMAN4K  

      10
      0
      Votes
      10
      Posts
      4440
      Views

      @IMAN4K Hi Im not sure what "material ripple animation" really is so its hard to say which design i would prefer. Copying Paint of QMenu would be last choice as there might be bugs and its involving to keep in sync. If the items can do all the drawing them self i would go for that. (2 i think :)
    • UNSOLVED Application wide stylesheet with different styles for menu and context menu?
      General and Desktop • stylesheet css qmenu styles • • dentist  

      6
      0
      Votes
      6
      Posts
      3881
      Views

      You can define an accessibleName for your objects and distribute different StyleSheets. either via the designer or QWidget::setAccessibleName(const QString &name); e.g. QPushButton{ background-color: blue; } QPushButton[accessibleName="SpecialButton1"] { background-color: red; }
    • UNSOLVED How to trigger QMenu on right click.
      General and Desktop • qt4 qmenu qaction • • tokafr  

      3
      0
      Votes
      3
      Posts
      2285
      Views

      Hi Just as a note. No (dropdown) menus I have ever used can be triggered by right clicking. ( some offer properties this way) so can I ask why you need that?
    • UNSOLVED Dynamic changed text of sub menu is cutting off
      General and Desktop • qwidget qlabel qmenu qmenubar qwidgetaction • • Zee_07  

      13
      0
      Votes
      13
      Posts
      3530
      Views

      I helped myself to set a minimum size ->setMinimumSize(300) I also had to problem that at first pop up, my text was cut off. Nothing of the workarrounds mentioned here helped.
    • SOLVED How to update geometry on QAction visibility change in QMenu::aboutToShow?
      General and Desktop • layout qmenu qaction visibility abouttoshow • • Erika  

      3
      0
      Votes
      3
      Posts
      1579
      Views

      Thanks Chris for the singleShot timer idea. In the meanwhile, I've posted a bug report: https://bugreports.qt.io/browse/QTBUG-54421.
    • SOLVED Why is the action from a context menu on a popup dialog not triggered?
      General and Desktop • qt5 qdialog qmenu popup • • Jakob  

      14
      0
      Votes
      14
      Posts
      5692
      Views

      @SGaist According to comments in the bug report the posted code should work in qt 5.6.1, and I have been able to verify this is indeed the case. So I guess I should consider this question as 'answered' then. Thanx for the help
    • UNSOLVED In KDE + Qt 5.5.1 cannot change system tray icon's context menu items
      General and Desktop • qmenu qt 5.5.1 qsystemtrayicon kde • • luipugs  

      3
      0
      Votes
      3
      Posts
      1191
      Views

      I have the same issue with updating the context menu with Qt 5.6 on Ubuntu 16.04 KDE Neo.
    • SOLVED Menu Icons Disappear with gnome Desktop Session
      General and Desktop • qt4 qmenu menubar redhat 6 gnome • • DougyDrumz  

      2
      0
      Votes
      2
      Posts
      800
      Views

      Hi, IIRC, that's part of the GNOME Human Interface Guidelines so there's no much you can do from a Qt point of view.
    • UNSOLVED removing qmenu radiobuttons
      General and Desktop • stylesheet qmenu • • ravas  

      4
      0
      Votes
      4
      Posts
      1017
      Views

      I'm not sure I'm following you correctly. Can you show what you have and what you would like to get ?
    • qmenu icon size
      General and Desktop • stylesheet qmenu • • ravas  

      6
      0
      Votes
      6
      Posts
      4394
      Views

      Whow! I just stumbled across this after all these years. I remember I had this problem once and now again. This time I actually managed to solve it somewhat. It IS kinda weird tho and should receive some love at least documentation-wise. The key is: You need to style QMenu AND QMenu::item If you just set the icon size via: QMenu {icon-size: 40px;} it will remain ignored until you also set something like QMenu::item {background: transparent;} Unfortunately this resets the menu stylesheet and you need to do something about the hover state to make it usable. But well. Seems this works for me. Can someone confirm please?
    • UNSOLVED QTreeView Context Menus
      General and Desktop • qtreeview qmenu • • Suths  

      2
      0
      Votes
      2
      Posts
      2482
      Views

      Hi, Good question but I haven't had the use case. One thing that looks "incorrect" is that you don't add your action to the menu the usual way: m_colourAction = m_contextMenu->addAction(tr("Colour")); If not, then you should also make the menu the parent of your QAction rather than your IModelElement. Out of curiosity, why the two casts one after the other ? You should also rather use qobject_cast since your IModelElement is also a QObject. On a side note, did you take into account the memory consumption of your model ? You are creating as many menus and actions (and also QObjects) as you have elements in your model for a functionality that doesn't really demand it.
    • life time of QMenu as custom context menu
      General and Desktop • qmenu • • derbinger  

      1
      0
      Votes
      1
      Posts
      882
      Views

      No one has replied

    • How to change QMenu behavior
      General and Desktop • qdialog qmenu qtoolbar qaction • • tema_tema  

      10
      0
      Votes
      10
      Posts
      3884
      Views

      For now I found following solution to prevent GUI from freeze: { Q_OBJECT public: QCustomMenu(QObject *parent = 0){}; void showEvent(QShowEvent *) { emit show(); QMenu::closeEvent(new QCloseEven()); QMenu::hideEvent(new QHideEvent()); } signals: void show(); }; And also now I've changed logic: on show() signal I exec() my dialog: QCustomMenu *menu = new QCustomMenu(toolbar); connect(menu, SIGNAL(show()), this, SLOT(execMyMenu())); But after closing my dialog UI waits for mouse click somewhere to start responding for further actions. May be it is possible to make programmatically click somewhere ? I didn't find any solution yet.
    • QMenu blocks mouse events
      General and Desktop • qmenu mouseevent right-click • • m_jero  

      2
      0
      Votes
      2
      Posts
      809
      Views

      @m_jero I don't know why nobody answers this question. Maybe because you didn't supply any code snippets as recommended. Anyway, I suppose you used the exec() function to show the qmenu. Try to use popup() instead and see if it works.
    • QMenu with tearoff enabled and with QWidgetAction
      General and Desktop • qmenu • • TheKodz  

      3
      0
      Votes
      3
      Posts
      1832
      Views

      Thanks SGaist for replay. I took the example itself from Qt : examples\activeqt\menus\main.cpp, menus.cpp I updated menus.cpp and added following code: QMenus::QMenus(QWidget *parent) : QMainWindow(parent, 0) { QAction *action; QMenu *file = new QMenu(this); file->setTearOffEnabled(true); //<= MY CHANGE action = new QAction(QPixmap((const char**)fileopen), "&Open", this); action->setShortcut(tr("CTRL+O")); connect(action, SIGNAL(triggered()), this, SLOT(fileOpen())); file->addAction(action); action = new QAction(QPixmap((const char**)filesave),"&Save", this); action->setShortcut(tr("CTRL+S")); connect(action, SIGNAL(triggered()), this, SLOT(fileSave())); file->addAction(action); //<= MY CHANGE file->addSeparator(); //<= MY CHANGE QWidgetAction* waction1 = new QWidgetAction(this); //<= MY CHANGE QLabel* label = new QLabel("My Data"); //<= MY CHANGE label->setAlignment(Qt::AlignHCenter); //<= MY CHANGE waction1->setDefaultWidget(label); //<= MY CHANGE file->addAction(waction1); //<= MY CHANGE //<= MY CHANGE QWidgetAction* waction2 = new QWidgetAction(this); //<= MY CHANGE QCheckBox* chk = new QCheckBox("Personal Data"); //<= MY CHANGE waction2->setDefaultWidget(chk); //<= MY CHANGE file->addAction(waction2); //<= MY CHANGE So, after tearoff, Label and checkbox are missing/hidden. Further I found following defect which looks to be not addressed yet. https://bugreports.qt.io/browse/QTBUG-1017 I tried 4.8.6 and 5.5. Is there any way out for this?
    • [SOLVED] Context menu for QListView entries
      General and Desktop • qlistview qmenu • • mkolenda  

      5
      0
      Votes
      5
      Posts
      6627
      Views

      Hi and welcome to devnet, Please don't necropost such old thread. In any case, the point is provided by the customContextMenuRequested signal.
    • QMenu opens first time off screen
      General and Desktop • c++ qmenu • • TheBigOnion2  

      5
      0
      Votes
      5
      Posts
      1082
      Views

      I really just need to know if someone has had this same problem and what they did to fix it. Or, what the method/property is on the menu to check/set the starting position.
    • Setting a background color for QMenu through QCSS makes the check mark of the items disappear
      General and Desktop • qmenu qcss • • shackra  

      1
      0
      Votes
      1
      Posts
      479
      Views

      No one has replied

    • QNSView mouseDragged QWarning
      General and Desktop • qmenu mouse macosx qnsview • • mmirsky  

      3
      0
      Votes
      3
      Posts
      1225
      Views

      Hi SGaist, Thanks for the tip. I made a comment on the linked bug. Hopefully, that helps someone!
    • Open QMenu to particular side
      General and Desktop • qmenu • • Anna234  

      6
      0
      Votes
      6
      Posts
      1585
      Views

      I have found the solution btw, if anyone ever gets the same problem. It was quite easy actually: setLayoutDirection( Qt::RightToLeft );
    • QMenu + QToolButton и выравнивание иконок в меню.
      Russian • qmenu qtoolbutton qaligment • • Denis I.  

      1
      0
      Votes
      1
      Posts
      1753
      Views

      No one has replied