PDA

View Full Version : Layout (widget overlay)



whitefurrows
3rd July 2009, 16:36
Hi,

i would be cereate a dialog with the qt designer as the attached picture.

The picture on the right side should be a QLabel with a QPixmap and the labels (diagonal, sideward, ahead,...) a QLabel. The labels must be a QLabe to translate the text. The left side should be build with a Line, QLabel and QPushButton.

My problem is to create a layout with a widget overlay for the left and right side. Can you tell me how can i do that?

Thanks in advance

wysota
3rd July 2009, 17:42
What widget overlay do you mean? For me it seems you need two completely custom widgets, without any labels - just drawing and buttons.

whitefurrows
3rd July 2009, 21:48
On the right side i mean the overlay from the QLabels. I have attached an example. The green border is a QLabel with a QPixmap and the red border is a QLabel with text and this QLabel is over the other QLabel. On the left side all Lines are overlapping.

Have i no chance to build the dialog with the designer and a QGridLayout. If you answer no, what is the common way to drawing the widget that can resize?

wysota
3rd July 2009, 23:54
It's not that you can't do it this way, but I really wouldn't advise it.

I would compose your widget from two widgets - one for the left side and another one for the right side.

The left side would be a customly drawn widget with either 9 push button widgets (without a layout, geometry controlled manually upon resizeEvent) or with using QStyle to draw the buttons (which would be very easy if you don't require things such as keyboard focus).

The right side would also be a completely custom drawn widget. I don't see any advantage for using QLabels - all they would do is to substitute a single call to QPainter::drawText() and it would be much more work to set them up.