1

I have a label with a pixmap on it Code looks like this:

Label = new QLabel (dialog, Qt::Widget);
Label -> setGeometry( xPosition, yPosition, 25, 87 );
QPixmap pixmap;
pixmap.load("/home/richter/Dokumente/QDevelop/AnimationTest/ScreenData/rightTire.png", 0, Qt::DiffuseAlphaDither);
Label -> setPixmap(pixmap);
Label -> setAlignment(Qt::AlignCenter);
Label -> show();

what I now want to have is a method like that:

void rotateLabel (int degrees)

I think it's clear what it should do. You enter the degrees and see it rotated by these degrees.

CeeAre
  • 11
  • 2

2 Answers2

1

Run qtdemo -> Demonstrations -> Embedded Dialogs

It shows how to map a whole dialog to a 3D surface. The same technique allows you to rotate a single label.

Source code is here: http://doc.qt.io/archives/qt-4.7/demos-embeddeddialogs.html

Christophe Weis
  • 2,518
  • 4
  • 28
  • 32
Aaron Digulla
  • 321,842
  • 108
  • 597
  • 820
0

Checkout the examples in QMatrix.

You need to override paint event of your QLabel and draw similar to given example.

Christophe Weis
  • 2,518
  • 4
  • 28
  • 32
O.C.
  • 6,711
  • 1
  • 25
  • 26