Cannot seem to make toolbar be vertical
-
@mrjj
Yes that's the gist. I think there might be a special case where the toolbar starts off vertical when it shouldn't have enough room horizontally really, but just ignore that. Once you're into dragging, if there isn't enough horizontal (or vertical) space given the page content minima for the destination of the drag, quite simply Qt does not open up the "blued reception area" to drop into, and when you release the mouse the toolbar reverts to where it was.Which I found confusing, I didn't understand what was going on, and I just didn't realise my (resizeable) main window size happened to be too close to the minimum width in the first place. Now I do, and I can understand Qt's behaviour, even if it's a little "non obvious". :)
-
@JNBarchan said in Cannot seem to make toolbar be vertical:
"non obvious". :)
It was very sneaky IMHO.
I thought that all the use of central widget would always allow room for
docks/toolbars. ! -
@mrjj
Remember I'm a noob. But if it always "allowed room for moving the toolbar anywhere", you'd have permanent reserved empty space always, which doesn't seem right. At some level my content's layout (I didn't write it) --- even the "central widget" --- has some minimum width, and if the window is narrowed down to somewhere close to that there just isn't room across the main window to allow for the toolbar to now take up extra width space by being dragged to vertical. Which makes sense. -
@mrjj
:)My main window has half a dozen "filter controls" laid out like:
Label1: Label2: Label3: ... <input1> <input2> <input3> ...
where the <input> controls, I think, have a decent minimum width. They don't move down to the next line or anything when I resize, so that, I think, is what gives it an overall considerable minimum width for the main window.
-
@mrjj
No. But of course those widgies will doubtless be positioned/added onto some other widgey, etc..... Ultimately I think there are vertical/horizontal vbox layouts. I note the starting point seems to be:# Configure main widget self.centralWidget = QtWidgets.QWidget(self) self.centralLayout = QtWidgets.QVBoxLayout(self.centralWidget) self.centralLayout.setContentsMargins(0, 0, 0, 0) self.centralLayout.setSpacing(0) self.pageStack = QtWidgets.QStackedWidget(self.centralWidget) self.addPages() self.initActions() self.toolBar() self.pageStack.setCurrentIndex(0) # Set up layouts self.centralLayout.addWidget(self.pageStack) self.setCentralWidget(self.centralWidget)
so that gives a "glimpse" of what's going on....
-
Ok it was easy to reproduce.
just with one widget in central and min size of 200.
if you reduce mainwindow size till it cant get smaller, you are not
able to dock the toolbar back again. (to the side)
It seems to function in top/bottom. -
@mrjj
Thanks :)
You can also reduce mainwin width to minimum + ~1cm and it will still happen, depending on width of required vertical toolbar, so doesn't only happen when window at minimum width.
That's what I've been experiencing for two days, but I didn't know what was going on!It seems to function in top/bottom.
Yes, in this case. I haven't tried (maybe you have), but it might happen if page has a minimum height on its widgets and not enough room for even one-line horizontal toolbar at top, but harder to set that up.
-
@JNBarchan
My sample had min as 200x200 and i just tried now again.
If no toolbar from beginning at top and you resize.
You cant dock back either.
Oddly enough add space with setContentsMargins(0, 0, 0, 0)
Didnt help. Even a small strip of space was seem.
I assume its due to events not reaching mainwindow.