Is it possible to change the Application Menu on OSX?
The default application menu looks like the following:
But most applications provide things like the about window in the application menu to not clutter the help menu:
How can this be done in Qt? A solution in QML would be great, but there isn't even a general solution in the project examples.
To force action into the application menu, set a menu role on it:
action->setMenuRole(QAction::ApplicationSpecificRole);
Related
I want to write a simple minesweeper as some practice. I created a dialog and I want to create a class to relate variables to the input for edit box. However when I right clicked the dialog, I cannot select "create a class".
Here is the screenshot. There wasn't any error so I don't know what to provide. If you need any extra information please let me know.
You can't add a class for a dialog of a Windows Desktop application. A Windows Desktop application uses only basic Win32 API which does not provide a class framework.
You have to choose the MFC application wizard, when creating a new project. From this wizard select "dialog based" to create the most basic application. It will automatically add a dialog with a corresponding class.
You only need to "Add Class" when adding more dialogs to the application.
I am using Qt version 4.8.6.
I am trying to develop an application where only couple keyboard keys are used, without mouse. I have added some actions to my main QToolBar and assigned shortcuts to those actions.
Now I can either click on them or use the assigned keyboard keys to trigget the "triggered" signal. This is a debug feature however and in the end I would like to hide that toolbar. So to test it, I have used:
ui->mainToolBar->setHidden(true);
Toolbar dissapeard as I intended but the problem is that my assigned shortcuts stopped working. Is there a way to hide the toolbar but keep the actions shortcuts?
I was trying to find an example of creating a settings/configuration windows. The settings window is launched by clicking "Options" action in the menu item. I wanted to figure out how to open up a 2nd window from the main window. As well how the new window return the settings information back to main window. Tried to play around with the QDialog or some inherited dialog classes, but those are for limited uses, not for general setting window. Is there any example/documentation about this?
Have you seen this property browser. Similar to property editor in Qt Designer. qtpropertybrowser Image
I was wondering if it is possible to add a menu resource to a dialog box. It would be easier to "design" my applications layout in multiple dialog boxes rather than the standard window, however, I will need to be able to add a menu. I would preferably be able to do this through a resource defined menu, however, I have no objections to doing it programmatically.
Right now my application is just starting like this:
DialogBox(hInst,MAKEINTRESOURCE(IDD_DIALOG_UPDATE),NULL,(DLGPROC)updateTitle);
in the main function.
Thanks for your help!
Dennis M.
Call SetMenu(hDlg, hMenu) during WM_INITDIALOG.
As Krishty commented on the accepted answer, it is easier and safer to just specify the menu ID in the designer. In the dialog resource properties, scroll down and there is a Menu option. Choose your already created menu from there. You won't see it in the designer, but when you run your app it will be there.
Is is possible to draw controls using Visual C++ designer on the main window, in the same way you can design dialogs? I'd preferably like to be able to design the main window controls this way without using MFC, rather than creating them on WM_CREATE.
EDIT: I don't want a dialog-based app, just to be able to design the main window graphically similar to what can be done using Windows Forms Designer in .NET?
Your options are:
Use MFC and create a main window that has a dialog view (based on the CFormView class).
Use WinForms/.NET
Use Qt.
If you're starting a new project and you want to stick with C++, then I highly recommend Qt. Not only is it an excellent framework, but it's cross-platform so your app could be built on Linux and the Mac.
http://www.qtsoftware.com/products/
A Visual C++ plugin is available and you can design your main window visually using a tool called Qt Designer.
I'm not sure if I understand what you want your app to look like. If you want your application to be a dialog, then make it a dialog app.
Just create a new MFC Application, and set it to "Dialog based". Now your application will start at that dialog.
If you want to use a native win32 app, just create the dialog in your InitInstance, using CreateDialog (instead of CreateWindow).
In both cases, you use the resource editor to create the dialog.