I have a QDockWidget which has been added to a QMainWindow. I set the sizeHint of the DocWidget to be 260px and its the size that I 开发者_JS百科want it to be because nothing else is offering up a size.
However now I want to increase the width of the DockWidget - QMainWindow separator. The only way I have found of doing this is via a StyleSheet:
http://doc.qt.nokia.com/4.7-snapshot/stylesheet-examples.html#customizing-qmainwindow
However when I do this the DockWidget shrinks to < 100px and becomes unusable. You cannot force the QDockWidget to a certain size and its inheriting the MainWindows stylesheet.
I also cannot get any other handle on the QMainWindow::separator.
I had similar problems with QPushButtons, when rendering with stylesheets they has decreased to minimum possible size. With them i cured that trouble by setting minimum size to needed. Maybe same solution will work for you...
you can use such code:
setStyleSheet("QMainWindow::separator {width: 20px}");
精彩评论