tags:

views:

401

answers:

2

Is there an easy way to remove the QDockWidget's resize handle? My dock widget can't be resized (the sizepolicy is fixed), so having the handle there is just redundant.

A: 

The handle is drawn as a separator by the QMainWindow instance & I believe the only way to modify it is using a style sheet.

http://doc.trolltech.com/main-snapshot/stylesheet-examples.html#customizing-qmainwindow

Setting the background color to the current palette background seems to work:

QPalette pal = QApplication::palette(&mainWin);
QString wcolor = pal.window().color().name();
QString style= QString( "QMainWindow::separator { background: %1;}").arg(wcolor);
mainWin.setStyleSheet(style);
Cyrus
I'm not able to check right now, but won't this just make the handle the same color as the background, but not remove it? It will still take up space, and still change the mouse cursor to the resize arrows.
mos
Cyrus
A: 

This bug is as old as Qt itself, I reported this in this report for this in the Qt bugtracker. Please vote it up if you want it to get fixed faster.

BastiBense
I'll go ahead and mark this as the accepted answer, since it did send me on the path of writing my own custom layout that handled docking widgets.
mos