[SOLVED] Rotate border-image

  • 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!

  • Moderators

    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());

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

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.