qmenubar

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

天涯浪子 提交于 2019-12-24 07:09:57
问题 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 text? 回答1: Call menuBar()->adjustSize(); after setting the text on the button. 回答2: I resolved it by setting the same corner widget into QMenuBar again after changing button text. 来源: https://stackoverflow.com/questions/15422439/how-to-auto-change

Qt: Change application QMenuBar contents on Mac OS X

江枫思渺然 提交于 2019-12-21 22:59:54
问题 My application uses a QTabWidget for multiple 'pages', where the top-level menu changes depending on what page the user is on. My issue is that attempting to re-create the contents of the menu bar results in major display issues. It works as expected with the first and third style (haven't tested second, but I'd rather not use that style) on all platforms except for Mac OS X. The first menu is created in the way I create most in the application, and they receive the correct title, but

MenuBar Not Showing for Simple QMainWindow Code, Qt Creator Mac OS

匆匆过客 提交于 2019-12-19 00:58:48
问题 I have been having problems adding a menu item to the built in menu bar in a Qt desktop application. I copied the code provided in the QMainWindow class reference documentation for creating a menu to a very simple application. Unfortunately, it did not show up when the code was run. I am simply trying to add a “File” menu to the menu bar. I am running Mac OSX 10.9.3 and Qt Creator 5.3.1. The screenshots of my code are below. I tried both the uncommented and commented code in the mainwindow

How to add a QWidget to a QMenuBar?

与世无争的帅哥 提交于 2019-12-12 03:49:59
问题 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 order to simulate a loading circle to indicate that the application is running. How can I add a QWidget to a QMenuBar, or is there some alternative to my ultimate goal? I am using Qt 5.6 with Qt Designer 回答1: A widget can be added to the end of

Menubar is only shown after app/desktop switch on MacOS using Qt5

孤人 提交于 2019-12-10 15:54:20
问题 Using the following example code the native menu on MacOS 10.9.5 using Qt 5.3.2 does not show up when starting the application. The former menu remains visible but no actions can be performed with this toolbar. If I switch to another application or to another desktop, the menu of this application becomes visible and usable as expected. My questions is pretty much the same as the following one, but the answer does not work for my code: Qt menubar not showing There is another very similar

Stacking QPushButtons on the other side of a QMenuBar

梦想与她 提交于 2019-12-07 05:54:05
问题 I want to stack some QPushButton objects on the other side of my QMenuBar . This is how my window looks now: And this is how I want it to look like (I've photoshopped the image): I know that in the motif widget style, the help menu is aligned to the right, but I'm sticking with plastique , so it's not a problem for me. I'm using Qt4.8. Any ideas? 回答1: QMenuBar has a setCornerWidget function, that sets a widget (that may include a whole layout) as the cornet widget. 回答2: QMainWindow:

QMenuBar and QMenu doesn't show in Mac OS X

谁说我不能喝 提交于 2019-12-06 08:33:17
问题 I'm using Qt 4.7.4 on Mac OS X 10.7.4 , and I'm trying to add a QMenuBar and a QMenu to my application without success. When looking for examples, I found the Basic Layouts and the screenshot of the interface on Windows displays the File menu, which is what I'm trying to do: However , running this example on Mac OS X doesn't show the File menu inside the application window: and it also doesn't show in the top Mac OS X bar: It seems that this is either a bug of Qt 4.7.4 on Mac OS X, or we are

Stacking QPushButtons on the other side of a QMenuBar

▼魔方 西西 提交于 2019-12-05 10:24:18
I want to stack some QPushButton objects on the other side of my QMenuBar . This is how my window looks now: And this is how I want it to look like (I've photoshopped the image): I know that in the motif widget style, the help menu is aligned to the right, but I'm sticking with plastique , so it's not a problem for me. I'm using Qt4.8. Any ideas? QMenuBar has a setCornerWidget function, that sets a widget (that may include a whole layout) as the cornet widget. QMainWindow::setMenuWidget() can be used to set any widget as the main window's menu bar widget. Using an appropriate layout, you can

Qt: Change application QMenuBar contents on Mac OS X

Deadly 提交于 2019-12-04 16:53:45
My application uses a QTabWidget for multiple 'pages', where the top-level menu changes depending on what page the user is on. My issue is that attempting to re-create the contents of the menu bar results in major display issues. It works as expected with the first and third style (haven't tested second, but I'd rather not use that style) on all platforms except for Mac OS X. The first menu is created in the way I create most in the application, and they receive the correct title, but disappear as soon as the menu is re-created. The second menu appears both on the initial population and the re

QMenuBar and QMenu doesn't show in Mac OS X

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-04 12:05:33
I'm using Qt 4.7.4 on Mac OS X 10.7.4 , and I'm trying to add a QMenuBar and a QMenu to my application without success. When looking for examples, I found the Basic Layouts and the screenshot of the interface on Windows displays the File menu, which is what I'm trying to do: However , running this example on Mac OS X doesn't show the File menu inside the application window: and it also doesn't show in the top Mac OS X bar: It seems that this is either a bug of Qt 4.7.4 on Mac OS X, or we are required to do some tweaks on the source code to make it work on Mac. How can I fix this problem? I've