View Full Version : Splitter in QMainWindow DockAreas

20th May 2011, 13:13

I have a quick question I could not answer with the qt api docu site. Is it possible to set attributes for the splitter of the dock areas in qt 4.7? In my case I want to to set the splitters of the dock areas to non opaque resizing and to callapsible. Any help would be appreciated.


21st May 2011, 01:23
I guess you can access the splitters with qFindChild()

24th May 2011, 13:32
First, thanks for the quick reply. I tried it but it does not work for me. I get a bunch of splitters for my mainwindow but not the ones which are responsible for the dock areas :(

24th May 2011, 16:00
If they are splitters, they should be there.

24th May 2011, 16:54
To clarify my problem: I have a QMainWindow and many different QDockWidgets for my modules. These DockWidgets can be arranged in tabs or nested in my MainWindow. So if I dock a DockWidget into my MainWindow I automatically get a Splitter to resize the DockArea. Same if I nest another Dock into that DockArea. These splitters are default non-collapsible and opaque-resizing but I want them to be collapsible and non-opaque-resizing. So after adding a DockWidget to my MainWindow I did the following: mw->findChildren<QSplitter*>(). This returns a bunch of splitters but non of these splitters references one of the DockArea splitters. So what am I doing wrong? I also tried to get all QSplitterHandle of the MainWindow but with the same result.

24th May 2011, 21:34
Those handles are not implemented as splitters. They are part of the QMainWindow class. They just look like splitters.

25th May 2011, 09:18
This mean that there is no chance to change the behaviour of that separators?

25th May 2011, 09:33
No, I don't think so. This is how the "splitters" are drawn:

static void paintSep(QPainter *p, QWidget *w, const QRect &r, Qt::Orientation o, bool mouse_over)
QStyleOption opt(0);
opt.state = QStyle::State_None;
if (w->isEnabled())
opt.state |= QStyle::State_Enabled;
if (o != Qt::Horizontal)
opt.state |= QStyle::State_Horizontal;
if (mouse_over)
opt.state |= QStyle::State_MouseOver;
opt.rect = r;
opt.palette = w->palette();

w->style()->drawPrimitive(QStyle::PE_IndicatorDockWidgetResize Handle, &opt, p, w);

There is nothing to set an attribute on.

25th May 2011, 11:38
Thanks for your support. I finally found the places for that separator in the source of Qt and I guess you are right. There is no easy solution for changing the behavior of that separator :( Perhaps Qt will change it in the future...

25th May 2011, 14:41
I don't think so.