I am trying to achieve the below layout. Basically the idea is to achieve a non-rectangular dock area (in blue).
From my reading of the documentation in https://doc.qt.io/archives/qt-4.8/qmainwindow.html#details, under the arrangement of the QMainWindow, the toolbar always expands throughout the entire bottom of the QMainWindow.
Is there a way to obtain this non-rectangular layout?
Related
So, I have a QFrame with its layout set as a QGridLayout.
Within this layout I have tiles in rows of 16 which represent something of a palette.
I want this grid of tiles to be separated by lines, like a grid should be. I can do this easily with the tiles' paintEvents.
However, the obvious problem is that between the tiles, the lines are doubled up. When I scale this up for other applications, the difference becomes even more noticeable.
So, is there a way to create a gridline overlay for my QFrame? I have considered converting the whole thing to a view/scene solution, and using drawForeground, however this seems like a completely inappropriate use of the paradigm.
Thanks for any assistance!
Put the QFrame into a QGridLayout, then put a custom QWidget with transparent background and paintEvent that paints the grid on top of it (same QGridLayout position).
Or since you already have a QGridLayout, just put the custom QWidget in that, above the tiles, filling the entire grid.
A side note, are you sure you want QFrame there, or if just QWidget would do? Just saying, because with QFrame you get that 1990's look into your UI... If you do want that then go ahead, just saying.
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.
Is there any possibility to make DockWidgetArea in QMainWindow scrollable? I have many instances of QDockWidget that cannot fit into the area without scrolling. Basically, I need to have two “side bars”, one on the left, second on the right of the main window. These side bars has to be floatable on the whole and so be able to be moved to secondary monitor.
I have tried adding three instances of QMainWindow into the horizontal layout, used the middle one for showing the main application content and the rest as a dock areas – their central widget has zero size.
It works except that I am not able to add a scrollbar into these "dock areas". More precisely, I can add a QScrollBar as a central widget of these QMainWindows, but it breaks docking ability and that is all.
In Qt 4 there was QDockArea widget, but in Qt 5 one has only a minimal control of the dock areas behavior.
Is there any solution for that?
In my Qt program, I programmatically generate a modal QDialog. I want to show two widgets in this dialog window: A custom widget showing a camera output and a QTableWidget, showing the pixel coordinates of the corners found in the camera image. I generate a QHBoxLayout and add my custom widget and the QTableWidget into it. Then I set this QHBoxLayout as the Layout of the QDialog window. What I want to achieve is to share the available space in the QDialog's window area equally between my custom QWidget and the QTableWidget, horizontally, by using a QHBoxLayout. But I always end up with QTableWidget occupying the whole QDialog area, by overlapping my custom widget. How can I instruct these two widgets to exactly share the QDialog area?? Note that I first add my custom widget and then the QTableWidget into the QHBoxLayout.
Make sure on your custom widget you've specified a minimumSizeHint and a sizeHint, this instructs the QLayout manager that the widget requires a specific space. To have them split equally you'll be best off detecting the size of the QDialog and then specifying the width for both by removing the boundary sizes (spacing between widgets + space to QDialog edge) and dividing it up.
I am using qt designer and python. I want to make a layout where a user can drag widgets to control the size while at the same time scaling properly with the window. Basically all 3d modeling programs have this function, usually it has a top left right and perspective view. The user can drag the edges to resize each view and it will maintain that aspect ratio when the main window is resized. My question is similar to this: active resizing of widgets inside mainwindow but I would like to do it in qt designer.
So what I have found is the layout horizontal/vertical splitter. However I am only able to layout two widgets horizontally, and another two widgets horizontally, then grid layout. This makes it look similar to what I want except I want the top and bottom horizontal layouts to also be re-size able.
Thanks
Edit:
I have been able to do this with putting both horizontal split views in a group box and then splitting the two group boxes, however that makes each widget independent and does not let the user grab the middle axis to control all 4 views.
You are essentially asking for a splitter than works across two axes - no such standard widget exists. So you will have to create your own.