PDA

View Full Version : QtDockWidget Resize



Phopojijo
10th July 2010, 10:06
Hello.

((For the actual question without the background-for-context, scroll down to the line of equal signs))

I've been hacking away at this problem on and off for two weeks now, searching through Google, trying things, looking through Qt's actual source code to see how QMainWindow and QMainWindowLayout worked, etc. I am currently working on a code editor partially as an incentive to learn C++ and Qt and partially because the language I'm writing it for has crappy editors and apart from Eclipse -- no other project I can start off with and modify to get me any closer than I would be simply starting from scratch.

Functionally I would like the document editor to fit a few design features:

"0") Multiplatform with little-to-no difficulty in porting Windows <----> Linux (at the least... Mac too if someone else wants to. I can't, I don't own a Mac.)
1) Editor windows could be pulled off into floatable windows (for those with multiple monitors).
2) Editor windows could be arranged side by side evenly, like Qt Creator's side-by-side view mode.
3) Editor windows could be arranged in a tabbed environment.

So obviously QtDockWidgets lent themselves ALMOST perfectly as the functional containers for the editors... I was able to create a child QMainWindow of the main QMainWindow (the child actually being the parent's centralWidget) to contain the dockwidgets with a null central widget on the child (to allow dockWidgets docked inside to fill its space) and have everything dock in the child's TopDockWidgetArea so that each dock widget is either tabbed or split with a vertical splitter.

======================

The problem: the vertical splitter between dock widgets is very arbitrary. I would *really* like to have it evenly split the two (maybe three, etc.) dock widgets that are docked in TopDockWidgetArea (initially -- the user can then grab and move to whatever size they want... but I'd want it to be initially that size).

I know it's possible to move the SeparatorWidget (SplitVCursor?) because obviously the mouse does. Is there any way I can reach in to this and grab it myself and shift it to half (or a third, etc) of the child MainWindow? What I read from prior discussions about related problems suggests that it is NOT possible... counter-intuitively... but no harm in trying.

I've tried adjusting the size of the DockWidget's contents, re-implementing (I think it was resize()), etc. Didn't even change anything in a weird way... they had absolutely zero effect no matter what I tried.

I am not against subclassing QMainWindow for the child main window if it allows me more access to the layout.

Thanks for any help. If possible, assume I know little-to-nothing about Qt in your explanations since I am just learning it.
-Scott Michaud

P.S. -- Does anyone know if floating QDockWidgets will get Aero Snap on Windows 7 (and equivalent 'nix implementations) in the future?