Unsolved reisizeEvent changes scene item position
-
Hello!
I have implemented QGraphicsView and some elements inside. Once I resize the main window where QGraphicsView element embedded all elements whos parent is scene will change position. I could handle no position changes on resizeEvent, but i believe there could be some better stndart solution for that.
Could anyone give some advise and simple code sample. I am quite new to QT Pyside.
Thanks in advance! :) -
Hi and welcome
Do you mean you want to have QGraphicsView resize automatically to main window size??
If yes, then layouts are super for that.
http://doc.qt.io/qt-5/layout.html -
I need to achieve that on resizeEvent items in scene does not change position.
-
@_Sebaastian_
But they should not move?
Did you output x,y before and after resize?
If i try the 40000 sample
http://doc.qt.io/qt-5/qtwidgets-graphicsview-chip-example.html
They are not moving anywhere within the scene on resize.
So maybe its different in python or I dont understand what you mean? -
I did no position changes before and after resize event.
Should I do that ?
I hoped there is some mode that all elements stay on the same place while resize mainWindow.
So the correct solution is manually hold scene coordinates of item on the same place while resizing ? -
@_Sebaastian_
Well this is the part i dont understand.
Normally you dont have to do anything, it just works so im very unsure
what is happening when you resize.Does the normal samples comes with PySide?
You could check some example and see if it also does "this moving" you dont want. -
@_Sebaastian_
Ahh, you mean, you dont like that it redraws the elements While you are dragging mainwindow?