Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. reisizeEvent changes scene item position

reisizeEvent changes scene item position

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 2 Posters 1.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • _ Offline
    _ Offline
    _Sebaastian_
    wrote on last edited by _Sebaastian_
    #1

    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! :)

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • _ Offline
        _ Offline
        _Sebaastian_
        wrote on last edited by
        #3

        I need to achieve that on resizeEvent items in scene does not change position.

        mrjjM 1 Reply Last reply
        0
        • _ _Sebaastian_

          I need to achieve that on resizeEvent items in scene does not change position.

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @_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?

          1 Reply Last reply
          1
          • _ Offline
            _ Offline
            _Sebaastian_
            wrote on last edited by
            #5

            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 ?

            mrjjM 2 Replies Last reply
            0
            • _ _Sebaastian_

              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 ?

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @_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.

              1 Reply Last reply
              0
              • _ _Sebaastian_

                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 ?

                mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @_Sebaastian_
                Ahh, you mean, you dont like that it redraws the elements While you are dragging mainwindow?

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved