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. Rotate axis of QWidget
Forum Updated to NodeBB v4.3 + New Features

Rotate axis of QWidget

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 5.7k 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.
  • G Offline
    G Offline
    goocreations
    wrote on last edited by
    #1

    QWidget is by default configured to start the x and y axis in the top left corner. How can I change the axis to start at the bottom left corner (like in maths)?

    I basically just want to draw shapes on the QWidget, but it is drawing everything upside-down

    1 Reply Last reply
    0
    • K Offline
      K Offline
      kamalakshantv
      wrote on last edited by
      #2

      In the computer graphics world it starts at the top left corner only. So you will have to make your calculations like that. You can calculate the respective points(x,y) and draw it. I don't know if there is any easier way out.

      1 Reply Last reply
      0
      • D Offline
        D Offline
        dangelog
        wrote on last edited by
        #3

        Apply a transform on the painter.

        You want to:

        • translate the painter by (0, height())
        • reverse the y axis by scaling (1, -1)

        Software Engineer
        KDAB (UK) Ltd., a KDAB Group company

        1 Reply Last reply
        0
        • G Offline
          G Offline
          goocreations
          wrote on last edited by
          #4

          thanks, i'll try that

          1 Reply Last reply
          0
          • G Offline
            G Offline
            goocreations
            wrote on last edited by
            #5

            thanx, the translate and scale solution worked

            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