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. [SOLVED] Rotate border-image

[SOLVED] Rotate border-image

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 2.2k 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.
  • S Offline
    S Offline
    secondVISION
    wrote on last edited by
    #1

    Hey, my application has a lot of custom widgets that have a border-image.
    But I want some of those widgets to show the image upside down.
    Can this be done via the stylesheet?

    Thank you!

    1 Reply Last reply
    0
    • p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on last edited by
      #2

      Seems that it is not possible using stylsheets.
      But if you have overridden paintevent method in your custom widgets, you can use QTransform and QPainter to rotate the image by 180 degree to make it upside down.
      Example code:

      @QPainter painter;
      QPointF c = rect().center();
      QTransform t;
      t.translate(c.x(), c.y());
      t.rotate(180, Qt::XAxis);
      t.translate(-c.x(), -c.y());
      painter.setTransform(t);@

      157

      1 Reply Last reply
      0
      • S Offline
        S Offline
        secondVISION
        wrote on last edited by
        #3

        Hey, I got it working by adding your code to my paintEvent code.
        Thank you!

        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