PDA

View Full Version : QSplitter handle invisible on Win32



para
3rd November 2006, 01:32
I'm working on a program that uses two QSplitters objects. Functionally this works without issue, but visually there is a significant difference between Linux and Windows.

On Linux, whatever theme I am currently using takes care of how to render the splitter handles. Here is a basic example:

On Linux:
http://uhook.net/qt/linux_ex1.jpg

However, in Windows, while the layout is the same, the handle that divides the sections is not visible.

On Windows:
http://uhook.net/qt/win_ex1.jpg

Of course it is still there, but if one were to look at the program it would not be immediately obvious there was a splitter handle located there.

The problem is much more evident in a larger example.

On Linux:
http://uhook.net/qt/linux_ex2.jpg

On Windows:
http://uhook.net/qt/win_ex2.jpg

I would like to see some sort of divider, perhaps something similar to how the QDockWidget's divider looks.

Here is the code I am using for the first example (written quickly since the 2nd example is too long to post):

#include <qapplication.h>
#include <qframe.h>
#include <qpushbutton.h>
#include <qsplitter.h>

class gui : public QFrame {
public:
gui();

private:
QSplitter* split;

QPushButton* left_button;
QPushButton* right_button;
};

gui::gui() {
left_button = new QPushButton("Left");
right_button = new QPushButton("Right");

split = new QSplitter(Qt::Horizontal, this);
split->addWidget(left_button);
split->addWidget(right_button);
}

int main(int argc, char** argv) {
QApplication app(argc, argv);

gui* w = new gui();

w->show();

app.exec();

delete w;
return 0;

}

Has anyone else had this problem?
I have tried QSplitter::setHandleWidth() but it doesn't seem to do anything.

munna
3rd November 2006, 05:06
I think that is how splitters are suppose to look on windows. The cursor changes when you mouse over it.

lauranger
17th November 2006, 11:34
Hi
I don't think it is the way it has to be on windows.
And as Qt4.1.4 it showed a bar in raised style. Qt4.2 does not anymore :(
Regards.

GameCrashDebug
23rd November 2010, 13:21
Use a QVBoxLayout to wrapper your splitter.