Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
johnk last edited by
I wrote a simple application based on QGraphicsView. I want a set of buttons on the upper right of the window. So I anchored a linear layout to the left. Consider this method.
QGraphicsLinearLayout *leftLayout = new QGraphicsLinearLayout(Qt::Vertical);
QGraphicsAnchorLayout *aLayout = new QGraphicsAnchorLayout; aLayout->addAnchor(leftLayout,Qt::AnchorLeft,aLayout,Qt::AnchorLeft); QGraphicsWidget *widget = new QGraphicsWidget; widget->setLayout(aLayout); scene->addItem(widget);
Looks great in the Qt Simulator. Unfortunately, it Qt centers these buttons on the target platform (ie, Symbian^1 - Nokia 5800 running Qt 4.6.3). Why does this layout behave so differently?
PS. Hmm.. to bad this forum doesn't allow me to upload an image. I wanted to show the resulting layout.
fleury last edited by
Cannot you upload the image to imagebin or something like that? It should not look different if the screen resolution and text are the same in the simulator and device.
The layout you set should make the buttons remain at the left of the screen with their preferred size. You could also try removing the linear layout and using only the anchor one to try and see if it behaves differently. I mean, by anchoring each of the buttons to the left of the layout. Then one on top of the other, and finally glueing their right side together.