PDA

View Full Version : QFrame::HLine disappears



powermax
9th November 2011, 21:15
I create a horizontal line with the following code:


QFrame *line = new QFrame(this);
line->setFrameShape(QFrame::HLine);
line->setFrameShadow(QFrame::Sunken); // if this line is removed, everything works on Windows and on Mac

This horizontal line is part of a widget inside a QStackedWidget, which is inside the QMainWindow.

On Windows, it shows up in every case. On Mac however, the QFrame is shown without a line inside (shown because I checked that by setting a background color) when I use setCurrentWidget(widget). When I afterwards resize the window or press on something outside the mainwindow, it is shown correctly.
So, I tried to manually repaint the QFrame, the mainwindow and so on, but nothing works (update(), repaint(), qApp->processEvents()). The only thing that did work was doing a resize on the mainwindow. (only if the size really changes).

So, what could this resize possibly do more than manually repainting?

Thanks