I want to create a custom Qt/QML menu like the main menu in Firefox:
As you can see, the menu can exceed the boundaries of the main window if it is bigger than the main window. Is there any way to achieve such behavior in Qt? I tried with the native Menu QML component, but this only gives me a default OS context menu with very vew customization options. I want full control over how the menu looks like and its contents (i.e. the same possibilities I have for a normal QML component or widget).
Qt Quick Controls 1 has Menus that are native and hence are not limited to window bounds.
Qt Quick Controls 2 does not yet have support for native Menus. You can track that here.
Qt Labs Platform has a native menu.
However, I doubt that any of these options will be sufficient in your case, as native menu support means utilising whatever the OS provides, which is probably not flexible enough to implement the menu shown in the image.
As mentioned by #hyde, one option may be to create a Window and implement your menu in there.
Related
Can Qt build menu bars with a widget that allows to write the menu entry to select, and the menu bar tries to guess what the user is looking for providing a list of candidate entries?
I am sure this can be implemented manually, but I am wondering if this is a feature that Qt provides out of the box.
See the image for an example (from Visual Studio 2022).
I have a small problem whit QScrollbar.
for example,
This is a one my project in C#
At left panel, the user loads a graphic image and can pick elements.
but I see in Qt don't exist Split Panel whit automatic Scrollbar.
I tried to use QScrollArea, but if user maximizes Window it's a problem.
anyone have a solution or a good way to make this in qt?
I would like to create an application using Qt (PyQt5 specifically) that has a photo editor like interface. More specifically, I would like it to have:
No main window
Free-floating toolbar
Free-floating context window
Startup dialog
Edit-windows
The idea is to have the toolbar and context window persist for as along as the application is running. The user then opens one or multiple documents (e.g. images in the photo editor example) and uses the options in the toolbar to modify the document(s).
My first question is; does this type of application interface have a specific name, something akin to MDI or SDI? I've been searching for "photo editor interface" and variations on that, but haven't been able to find a search string that seems to hit the mark. For instance, I've tried "build a photo editor type interface with Qt" but it doesn't yield anything useful.
The second question I have is, what is the best way to build a Qt application that doesn't spawn a main window? It seems like I could kludge an assortment of dialogs together to make this happen, but I would really like to use a lot of the functionality of QMainWindow (toolbars, menus, top-level management of the application). Is there a way to launch QMainWindow, display the menu and toolbar, but suppress the main window?
I plan to primarily use this application on OSX, but would also like it to perform well on Windows and Linux.
QMenuBar has explicit support for OSX to have the menu bar behave as expected: http://doc.qt.io/qt-5/qmenubar.html#qmenubar-on-os-x
I think it'll also work on Ubuntu's Unity, which tries to have similar style, but there may be some details you need to take care of. Other desktops should work as expected.
As to how to have individual windows: any Qt widget will be a top level window if it has no parent, so that is an easy way to create windows. If you want to have parent windows (for example to control window stacking order automatically), there's a window flag for that. So you don't need to use QDialog (not sure if you were implying that in your question).
You want to read QWidget documentation carefully to get an idea how all this works.
As I am putting more widgets on top of more layouts in my application, the space where I design the GUI is getting also bigger for the Qt-creator interface.
I have many buttons and frames which are out of reach. I cannot see them (or click them, of course). I don't know how they look until I run the whole application for debugging.
Is there is a way to zoom out/in the main frame (the whole playground) so that I can see my full GUI design on the UI of Qt IDE?
P.S.: I am working on macBook 13"
Zooming is not possible. You can use Tools -> Form Editor -> Preview.
If the viewport gets too small the QtCreator shows scrollbars which allow to move the part of interest into view.
Note, on some system configurations the scollbars may be very small and hard to handle.
You can use this steps
Tool-->options-> Text editor ->zoom
Text editor
The JavaFX 2.1 Release Notes states that this release includes,
UI enhancements, including controls for Combo Box, Stacked Chart, and application-wide menu bar.
What does the "application-wide menu bar" mean? What does it imply?
Looked for UI Components but could not find any reference to it.
I believe the comment refers to the new JavaFX 2.1 ability to set a menu bar to act as a system level application menu bar. For example, on Mac, it would be the menu bar at the top of the screen.
I think the added property is MenuBar.useSystemMenuBarProperty.
Windows (and some Linux window managers) don't have the same concept, so I don't think the property does anything on those platforms.