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
0
votes
1 answer

Qt Qmenu set layout direction to right does not work

In Qt I use a QMenuBar and add some menus to it. My program is multi language and when I use a left to right language like English, every thing is OK, and when I choose a language which has right to left direction, I have to add this line to my…
0
votes
1 answer

get QRect of menus in QMenuBar

I am re-implementing the mouseMoveEvent in a QMenuBar to allow me to click-drag a frameless application around (basically just making my own frame around my app). However I am trying to disable this behavior whenever the mouse is over a QMenu item,…
Spencer
  • 1,931
  • 1
  • 21
  • 44
0
votes
1 answer

PyQt5: main window shows without any widgets

I'm using PyQt5 to create my application. The problem is that my window appears, but without any widgets (i.e. without my Main class, without any menus, toolbars, etc.) - just still empty. I'm using Python-3.6 and PyQt5, Windows 10…
Y.Berthoud
  • 75
  • 8
0
votes
1 answer

Adding items to a menubar with a for loop - Pyqt5

I have a list of name and from that list, I would like to populate a menubar of my QMainWindow. Below an attempt of code: list_name = ['Miller', 'Johnson', 'Robert'] self.menuName = self.menuBar().addMenu('Name') for i in range(0,3): …
H. Dave
  • 549
  • 3
  • 9
  • 26
0
votes
1 answer

PyQt WebEngineView interferes with MainMenu

I'm trying to create an application that contains a web browser within it, but when I add the web browser my menu bar visually disappears but functionally remains in place. The following are two images, one showing the…
aoh
  • 1,090
  • 2
  • 13
  • 25
0
votes
1 answer

Get QMenu's ActionRect for paint an image

QPainter p(this); for (int i = 0; i < this->actions().count(); ++i) { QAction *action = this->actions().at(i); QRect actionRect = ........... QStyleOptionMenuItem opt; initStyleOption(&opt, action); opt.rect =…
0
votes
0 answers

Valgring issue detected on QMenu on QT-5.7.0

Creating a simple program with only a QMenuBar on top, I managed to get an issue detected by Valgring GBD. Here is my program main.cpp: #include "mainwindow.h" #include int main(int argc, char *argv[]) { QApplication a(argc,…
0
votes
1 answer

Qt stylesheet : set a specific QMenuBar::item background color

I have a QMenuBar with for example two QMenu items. How can I only make the "Floors" item be blue, for example? I know how to change it for ALL the items with: QMenuBar::item { background: ...; } But I can't find a way to color a specific…
Nat
  • 119
  • 5
0
votes
1 answer

menuBar.addAction change the text

I'm using python QtGui. When I want to change the text, I got error. Traceback (most recent call last): File "main2.py", line 140, in ChangeLanguage self.fileMenu2.setText("www") AttributeError: 'QMenu' object has no attribute 'setText' Here is my…
eason
  • 171
  • 3
  • 18
0
votes
1 answer

How to add a QWidget to a QMenuBar?

I want to add a QLabel to a QMenuBar. I was able to add a QLabel to a QMenu using QActionWidget, but I want the QLabel to sit on the QMenuBar (as a substitute for a QMenu) at the right end of my application. I intend to add a movie to this QLabel in…
Dillydill123
  • 693
  • 7
  • 22
0
votes
0 answers

How can I change the style sheet of menu bar in qt?

I want to change the styleSheet of my QmenuBar window. for QPushButton or any thing like this, there are several example like the following links {this} and {this}. But I couldn't find any example for QmenuBar. and I want to change the color of…
s.m
  • 209
  • 2
  • 7
  • 17
0
votes
1 answer

QSystemTrayIcon QMenu Submenu with Qt 5

I have a program which creates QMenu and adds QMenu to first menu. The program runs perfectly on qt4, but when I compile it with qt5, the submenu does not appear. Here is an example code: QMenu *menu = this->menuBar()->addMenu("Menu"); QMenu *menu2…
isamert
  • 482
  • 4
  • 12
0
votes
2 answers

How to change right-arrow icon to access hidden menu items in QMenuBar using PyQt5?

I found no references about this in the documentation.
Danilo
  • 175
  • 1
  • 11
0
votes
1 answer

QMenuBar missing from QMainWindow on Windows 8.1

I am creating a QMainWindow with PyQt4 on Windows 8.1. However, the default QMenuBar fails to show after adding menus to it. Here is my SSCCE: import sys from PyQt4.Qt import * class NoMenuBar(QMainWindow): def __init__(self): …
Joel Christophel
  • 2,604
  • 4
  • 30
  • 49
0
votes
1 answer

How can I make a QMenuBar item appear over its QMenu

First of all, I'm fairly new with Qt and Qt Creator so go easy if this is a stupid question. I was practicing using Qt Creator, playing around with css styles. In particular, I'm trying to get the menubar and its menus to look something like this…
YmFzZTY0
  • 109
  • 1
  • 9