I am developing a tool which will have some variable sized windows. I am able to achieve this using the QSplitter horizontal & vertical. Please see attached image.
Now, how to make these individual windows detachable/maximize/close? How can I add cross markers at the top-right-corner of each window so that they can be closed maximized or detached from there? Just like this link :--
http://vector.com/portal/medien/ecu_testing/tae/test_automation_editor.png
You're looking for the QDockWidget class:
The QDockWidget class provides a widget that can be docked inside a
QMainWindow or floated as a top-level window on the desktop.
QDockWidget provides the concept of dock widgets, also know as tool
palettes or utility windows. Dock windows are secondary windows placed
in the dock widget area around the central widget in a QMainWindow.
Check out this example
In 2021, there is KDQDockWidget, an apparently much better Qt docking framework with both commercial and open source licenses.
The site lists the following advantages:
It provides advanced docking that QDockWidgets doesn’t support.
The layouting engine honors min/max size constraints and some size policies.
Supports PySide2 bindings.
Clean codebase.
Supports lazy separator resize.
You can reorder tabs with the mouse.
Supports partial layout save/restore, affecting only a chosen sub-set.
Allows double clicking on title bar to maximize.
Allows double clicking on separator to distribute equally.
Shows close button on tabs.
Allows you to make a dock widget non-closable and/or non-dockable.
Provides an optional maximize button on the title bar.
FloatingWindows can be utility windows or full native.
Related
I use Qt designer (as opposed to building controls via the program) to lay out my sidebar and floating dialogs. When first launching the application, the sidebar is WAY too wide and bears no resemblance to how I saved it. The user can shrink it to a reasonable width, and that is 'remembered' after closing and re-opening the application. But it doesn't create a good first impression of our application, and not all our users are savvy enough to realize that the sidebar width can be changed.
The sidebar is quite complex, with multiple forms (QStackedWidget) and each with multiple controls. Any suggestions for forcing it to come up at the minimum width with the first use? Thanks!
You should be able to achieve the wanted behavior by setting "Horizontal Stretch" property in Qt Designer, for each of the widgets in your splitter or layout, whichever you are using to layout your components. See QSizePolicy documentation for more info.
The "Horizontal Stretch" & "Vertical Stretch" properties are located in Qt Designers Property Editor, under the sizePolicy.See the image for exact location of properties
I'm looking for an existing solution in Qt5 which would allow me to construct a QWidget with horizontal layout with some child widget which would be movable within parent widget area.
As an example of such behaviour you may try to play with tabs in firefox - user can drag a tab and move it right and left and other tabs are drawing aside to make a place for dragged one.
Also I'd like to be able to drag and drop child widgets from one parent widget to another, like in case of firefox: one tab can be dragged to another window. However in my case drag and dropping would occur in one application.
Is there such a solution or I've to do it myself?
I am using Qt4 but I am sure that the following should work for Qt5 too:
For moving tabs within tabwidget there is a API "setMovable (bool movable)" available in QTabWidget class.
To your other requirement you may need to do a little bit of coding. You should look into documentation of QDrag class and
examples of drag-drop in qt installation (examples/draganddrop) folder.
Santosh
I created custom Dialog in my Basic MSI project and placed 3-4 pushbuttons on it. Now I want to change pushbutton style - for example I want to have oval buttons instead of rectangular, I want to have possibility of changing their color, I want to add small image on it etc... Set of push button properties is limited as I can see - there are Height, Width, Visible, TabStop TextStyle and some other simple properties.
How can I do it in InstallShield Professional Edition?
The UI available to Windows Installer is not capable of that. We're moving that direction in our Advanced UI project's UI, but currently offer only relatively standard buttons at this point.
Is it possible to cut a QGLWidget? I mean I would like to cut it so i get access to the gui below. It sounds strange, but it would be a lot of work for me to divide my QGLWidget into two. I hope you understand what I mean.
I don't fully understand what you mean by "cut" and GUI below. In Qt with layout mechanisms properly used a widget consumes the area it covers and there are no widgets beneath it.
Do you want to render multiple views into a single QGLWidget? This is easily achieved by proper use of glViewport + glScissor.
EDIT due to comment
There are two kinds of windows:
Top level (those you can freely move around on the screen)
Child windows (subwindows like widgets or panes in a top level window)
Child windows again come in two characteristics:
logical child
real child
A logical child window just consists of its position, dimension and layer and are managed by the toolkit. From the view of the operating system there's just one top level window. The toolkit is it that manages its internal state to give the impression of independent sibling windows in the toplevel window.
A real child window is manages by the operating/graphics system. Such real child windows may share their graphics context with their parent and sibling. However OpenGL only works well if the window into which a OpenGL context is created has its very own graphics context. Thus any OpenGL child window inevitably will have its very own graphics context and graphics system window object. Most graphics systems out there don't properly support applying shapes onto child windows (only toplevel windows, and then this also conflicts with OpenGL).
So this boils all down that it's virtually impossible, nor advisible to try to "layer" an OpenGL window on top of a sibling. It may work in some circumstances, but most of the time it won't.
That's the bad news.
The good news are, that you simply looked in a slightly wrong direction. I hereby direct your view towards QGraphicsView. QGraphicsView supports OpenGL as a backend, you can also write your own OpenGL renderer code to be executed within a QGraphicsView. But furthermore QGraphicsView can also be used for rendering widgets, also using OpenGL. So all you have to do is putting both your OpenGL rendering code and your widget into a common QGraphicsView scene and are done. And here is a tutorial http://www.crossplatform.ru/node/612 the result of the tutorial looks like this:
After much digging I've realised there is no Qt-way to use 3 middle buttons in landscape mode in S50v5, however I don't like to waste this precious space. I've tried to place my widgets there but menu bar is on top and widgets aren't visible.
Is there any way to utilise this space without using native Symbian APIs?
Controlling the stock softkeys in Qt is a pain. The strategy I have used is to make the QMainWindow full-screen with showFullScreen() which allows you to use the softkey space yourself. You will have to make sure any widgets you create are ultimately parents of the main window, and be mindful of this bug when creating pop-ups.