I'm looking (unsuccessfully) for a Qt widget that would work similarly to the panes in Eclipse IDE. This inludes the ability to rearrange panes within the workspace. Very powerful! For instance, you can
combine panes into tabs and separate them again
place panes on the top, bottom, left, right or center.
place panes under, over, within the left, and within the right of current panes
pull panes into their on top-level window or re-integrate them into the main window
double click a pane to take over the entire workspace or snap it back to its original position
minimize a pane to a side bar
etc!
Any idea if such a widget exists so I can create a workspace?
Perhaps something like QDockWidget would help.
Related
I have a QMenubar inside QMainWindow. I have set it to be displayed on the right corner using setCornerWidget. But the menu items are going out of the main window. How can I prevent the menu to be displayed within the window?
I have already tried menu->setLayoutDirection(Qt::RightToLeft) which is giving me a mirror image of the current menu display as seen below, but that does not look good to me. Is there a way to keep the direction from Qt::LeftToRight and still be able to contain the menu inside the window?
I have a program, preliminary look of which is in the first photo. Here, the project tree takes all space below it, and the 3D-viewport and the text edit widget are stacked vertically:
However, when I try to turn that text edit into a dock widget, it places itself under the project tree as well:
I would like the layout to be as in the first photo, and the text edit to be a dock widget at the same time, but I couldn't figure, how to do this, at least in the Qt Designer. Is it possible?
Thanks)
I think QMainWindow::setCorner is what you're looking for...
QMainWindow main_window(...);
main_window.setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
The above code should cause the bottom left corner of the QMainWindow to be occupied by the left dock area rather than the bottom dock area.
I want to allow a user using my application to be able to drag a boundary between two widgets in my window which will resize the two (i.e. you drag it down and the top one will get bigger while the bottom gets smaller, and vice-versa).
Is there anything in Qt designer that will allow a user to resize an element in the window, within certain constraints?
Thank you
What you're describing is called a QSplitter widget. In Qt Designer, you can create one by selecting 2 or more widgets, and then clicking the splitter button on the toolbar at the top. It's in the same location as the layout buttons. It will place those widgets inside a QSplitter. You still need to place the splitter widget inside another layout. It will create a handle between them to let you resize the portion that each widget gets.
You're looking for the QDockWidget. It can do all that you described above and more. The user can dock the widget to different sides of the window, changing which widget is on the top or bottom. You can customize the minimum and maximum sizes, as well as default sizes.
I use grid layout (horizontal and vertical too). I like the fact that when resizing the window fills the entire window contents. but this extension is poorly managed. I often want to change the size of only one column in grid layout without changing the size of the window. such as in Windows Explorer. there are two columns - the left list of directories and their contents to the left to the right. and i can always press mouse button therebetween and pulling change the mutual sizes of columns in relation to each other.
how can I do this in Qt?
You need to use a QSplitter rather than a QGridLayout in this specific case (where you just want 2 widgets shown together). QSplitters are draggable.
You are looking for QSplitter
(The following is the procedure in the Qt Designer)
Group your widgets, and click Lay Out Horizontally/Vertically in Splitter
Put this group into another layout (QGridLayout, for example) to automatically expand it.
Congrats! Your Layout is now draggable(from step1) and expandable(from step2).
I am creating a Qt application where I need to display contents in an overlay box(Please refer to the attached image). The box needs to slide up from behind the bottom dock when a button is pressed and slide down by toggling the button. I tried with a QWidget but couldn't achieve what I wanted. Also I don't know how to list the elements in the overlay box. The elements are dynamic or changing.
The widgets stacking order is defined by their order in the QObject hierarchy tree. The first element is the bottom, and every next is on top of the previous. Children are on top of their parents, in widgets confined within their bounds, in QML free.
If you want that sliding element to appear on top of everything else, just put its parent on top of everything else.
After all it is on top of the bottom control bar, which is on top of the playlist, so you have it all worked out for you.
The same applies if you decide to do the wiser thing and use QML instead of QWidget. Animation and states are much easier there. Not to mention more specific designs.