The QxtPushButton widget is an extended QPushButton with rotation and rich text support.
QxtPushButton is a QPushButton which can be rotated. In addition, QxtPushButton provides rich text support.

This enum describes the rotation.
| Constant | Value | Description |
|---|---|---|
| Qxt::NoRotation | 0 | No rotation. |
| Qxt::UpsideDown | 180 | Upside down (180 degrees). |
| Qxt::Clockwise | 90 | Clockwise (90 degrees). |
| Qxt::CounterClockwise | 270 | CounterClockwise (-90 degrees). ----------------------------------- |
btn1 = new qPushButton(win1) {
setgeometry(100,100,400,400)
settext("")
}
label1 = new qlabel(win1) {
setgeometry(100,100,400,400)
settext("")
setAttribute(Qt_WA_TransparentForMouseEvents,True)
}Qt_WA_TransparentForMouseEvents is a constant defined in Ring 1.3 qt.rh file
Qt_WA_TransparentForMouseEvents = 51
Attached a Screen Shot
Greetings,
Mahmoud
btn[n].settext("15")see btn[n].text() + nlLoad "guilib.ring"
New qapp {
win1 = new qwidget() {
setwindowtitle("Label and Button - Rotate Text")
setgeometry(100,100,500,500)
btn1 = new ButtonWithRotatedText(win1)
btn1 {
setgeometry(100,100,400,400)
settext("Test")
setClickEvent("see btn1.text()")
}
showMaximized()
}
exec()
}
Class ButtonWithRotatedText
oButton oLabel cText="" nDegree = 30
func init oParent
oButton = new qPushButton(oParent)
oLabel = new qLabel(oParent)
oLabel.setAttribute(Qt_WA_TransparentForMouseEvents,True)
func setgeometry x,y,width,height
oButton.setgeometry(x,y,width,height)
oLabel.setgeometry(x,y,width,height)
func setText cValue
cText = cValue
func Text
return cText
func setRotationDegree nValue
nDegree = nValue
func RotationDegree
return nDegree
func setClickEvent cEvent
oButton.setClickEvent(cEvent)
func braceend
draw()
Func draw
p1 = new qpicture()
color = new qcolor() {
setrgb(0,0,255,255)
}
pen = new qpen() {
setcolor(color)
setwidth(10)
}
painter = new qpainter() {
begin(p1)
setpen(pen)
oFont = font()
oFont.setpointsize(20)
setfont(oFont)
rotate(this.RotationDegree())
drawtext(0,0,this.Text())
endpaint()
}
oLabel {
setpicture(p1)
show()
}