Questions tagged [qmenubar]

The QMenuBar class, part of the Qt framework, provides a horizontal menu bar.

Documentation can be found here (Qt4) and here (Qt5).

84 questions
1
vote
1 answer

PyQt Clear the menubar

Is there a quick way to clear the menu bar i.e. Remove all menus in PyQt. The reason I ask is that I am developing a modular application. Each module provides it's own menus and gives a weighting to where that menu should appear. Each module can…
PrestonDocks
  • 4,851
  • 9
  • 47
  • 82
1
vote
2 answers

How to auto change QPushButton width and QMenuBar corner widget width when change text of button?

I set corner widget into QMenuBar that has two QPushButtons. But when I set long text by button's setText, button doesn't change it's weight, so, icon and part of text hiding. So, how to change button's width and width of corner widget when set…
Robotex
  • 1,064
  • 6
  • 17
  • 41
0
votes
1 answer

QtMenubar Call Slot

This is inside a Menu class. The problem is addAction. This works, but there is no connection to slot: QMenu* menu2 = new QMenu("Test"); menu2->addAction("Test"); When I do this: QMenu* menu2 = new QMenu("Test"); menu2->addAction("Test", Menu,…
Calvin Froedge
  • 16,135
  • 16
  • 55
  • 61
0
votes
0 answers

How to integrate QPlainTextEdit::createStandardContextMenu() into QMainWindow::menuBar()?

I did the subject with connecting QPlainTextEdit::cursorPositionChanged() signal into my main window's slot: void MainWindow::onCursorPositionChanged() { if( d->standardEditMenu ) { d->standardEditMenu->deleteLater(); …
Igor Mironchik
  • 582
  • 4
  • 17
0
votes
1 answer

Change highlight color for a specific item (QAction type) on a QMenuBar

I want to mimic the behavior of the window top-right corner actions when hovering over the minimize-maximize-close buttons. So I have created a QMenuBar that contains 3 QActions. class WindowMenuActions(QMenuBar): def __init__(self): …
laurapons
  • 971
  • 13
  • 32
0
votes
0 answers

Add menu bar at the top of the application

I am trying to add a menu bar at the very top of the application, not "inside" of it where it usually wants to add it. Quick example: import sys from PyQt5.QtCore import Qt from PyQt5.QtWidgets import QApplication, QLabel, QMainWindow, QMenu class…
CasualDemon
  • 5,790
  • 2
  • 21
  • 39
0
votes
0 answers

Customize QMenu added to a QMenuBar

So I try, with Qt, to bold the fourth Menu Title "Test" in a QMenuBar (see picture below). QMenuBar* pQMenubar = new QMenuBar(); pQMenubar->addMenu(new QMenu("Fichier")); //Some QMenu, not important pQMenubar->addMenu(new…
0
votes
0 answers

How to set the QMenuBar's actions to multiple rows (new line)

self.menuBar = self.menuBar() self.action1 = QAction('This is\nAction Button', self) self.menuBar.addAction(self.action1) This makes the menuBar multiple lines, but new line doesn't apply.
Mineral
  • 1
  • 1
  • 2
  • 4
0
votes
0 answers

How to properly add a QMenu (and submenu) using a QAction

I have been trying to add a submenu to a QMenu via QAction but it is not working. As you can see below I am able to see the choices via right click on a QTableWidget. However from the menu "Option" I should see the submenu, but I don't see…
Emanuele
  • 2,194
  • 6
  • 32
  • 71
0
votes
2 answers

PyQt5 on MacOs. Custom QMenuBar added to QMainWindow is not clickable

class MenuBarWidget(QMenuBar): sig_new_file = pyqtSignal() sig_open_file = pyqtSignal() sig_save_file = pyqtSignal() sig_page_setup = pyqtSignal() sig_print = pyqtSignal() sig_exit = pyqtSignal() sig_status_bar =…
jihoon
  • 19
  • 5
0
votes
1 answer

Added QMenuBar in QDialog it showing but sub menus dosn't open

i added QMenuBar in QDialog using layout that is set in Designer and then manully adding the QMenuBar , when running the application and the QDialog runs i see the QMenuBar with only the menu header without the opening sub menu : here is my code…
user63898
  • 29,839
  • 85
  • 272
  • 514
0
votes
0 answers

How to prevent QMenu from going out of the main window

I have a QMenubar inside QMainWindow. I have set it to be displayed on the right corner using setCornerWidget. But the menu items are going out of the main window. How can I prevent the menu to be displayed within the window? I have already tried…
0
votes
2 answers

Python PyQt5 how to show the full QMenuBar with a QWidget

I'm getting this weird result when using QMenuBar I've used this exact code before for the QMenuBar and it worked perfectly. But it doesn't show more than 1 QMenu This is my code: from PyQt5.QtWidgets import * from PyQt5.QtCore import * from…
JareBear
  • 467
  • 9
  • 27
0
votes
1 answer

How can I avoid having PyQT5 Central Widget covering up MenuBar?

The central widget in my QMainWindow keeps covering up the QMenuBar I want. How do I avoid this? If I comment out the pushbutton, I can see the menu bar using the code below. from PyQt5 import QtWidgets class Test: def __init__(self): …
Ethan
  • 37
  • 5
0
votes
0 answers

Add a QMenuBar to a QWidget

I'm trying to integrate a QMenubar in a QWidget in Pyside2 in Python3. It seems to be easier to integrate a QMenubar to a QMainWindow but I started the project with a QWidget and not a QMainWindow and this is why I would like to have a solution for…
ecjb
  • 5,169
  • 12
  • 43
  • 79