You are on page 1of 10

Ring Documentation, Release 1.

setGeometry(100,50,250,300)
setNotchesVisible(true)
setValue(50)
SetValueChangedEvent("pDialMove()")
}
lineedit1 = new qlineedit(win1) {
setGeometry(200,400,50,30)
setalignment(Qt_AlignHCenter)
settext(string(pdial.value()))
setreturnPressedEvent("pPress()")
}
show()
}
exec()
}

func pIncrement
pdial{val=value()}
pdial.setvalue(val+1)
lineedit1{settext(string(val+1))}

func pDecrement
pdial{val=value()}
pdial.setvalue(val-1)
lineedit1{settext(string(val-1))}

func pPress
lineedit1{val=text()}
pdial.setvalue(number(val))

func pDialMove
lineedit1.settext(""+pdial.value())

49.18. Using QDial 428


Ring Documentation, Release 1.3

49.19 Using QWebView

In this example we will learn about using the QWebView class


Load "guilib.ring"

New qApp {
win1 = new qMainWindow() {
setwindowtitle("QWebView")
myweb = new qwebview(win1) {
setGeometry(10,10,600,600)
loadpage(new qurl("http://google.com"))
}
setcentralwidget(myweb)
showMaximized()
}
exec()
}

The application during the runtime

49.19. Using QWebView 429


Ring Documentation, Release 1.3

49.20 Using QCheckBox

In this example we will learn about using the QCheckBox class


Load "guilib.ring"

New qApp {
win1 = new qMainWindow() {
setwindowtitle("Using QCheckBox")
new qcheckbox(win1) {
setGeometry(100,100,100,30)
settext("New Customer!")
}
showMaximized()
}
exec()
}

The application during the runtime

49.20. Using QCheckBox 430


Ring Documentation, Release 1.3

Another Example:
Load "guilib.ring"

New qApp {
win1 = new qMainWindow() {
setGeometry(100,100,400,300)
setwindowtitle("Using QCheckBox")

### 0-Unchecked 1-Checked

CheckBox = new qcheckbox(win1) {


setGeometry(100,100,160,30)
settext("New Customer!")
setclickedEvent("HandleClickEvent()")
}

show()
}
exec()
}

Func HandleClickEvent

if CheckBox.isChecked() = 1
CheckBox.settext("New Customer. Check 1-ON")
else
CheckBox.settext("New Customer. Check 0-OFF")
ok

49.21 Using QRadioButton and QButtonGroup

In this example we will learn about using the QRadioButton and QButtonGroup classes
Load "guilib.ring"

49.21. Using QRadioButton and QButtonGroup 431


Ring Documentation, Release 1.3

New qApp {

win1 = new qMainWindow() {

setwindowtitle("Using QRadioButton")

new qradiobutton(win1) {
setGeometry(100,100,100,30)
settext("One")
}
new qradiobutton(win1) {
setGeometry(100,150,100,30)
settext("Two")
}
new qradiobutton(win1) {
setGeometry(100,200,100,30)
settext("Three")
}

group2 = new qbuttongroup(win1) {


btn4 = new qradiobutton(win1) {
setGeometry(200,150,100,30)
settext("Four")
}
btn5 = new qradiobutton(win1) {
setGeometry(200,200,100,30)
settext("Five")
}
addbutton(btn4,0)
addbutton(btn5,0)

showMaximized()

}
exec()
}

The application during the runtime

49.21. Using QRadioButton and QButtonGroup 432


Ring Documentation, Release 1.3

49.22 Adding Hyperlink to QLabel

In this example we will learn about creating Hyperlink using the QLabel class
Load "guilib.ring"

New qApp {
win1 = new qMainWindow() {
setwindowtitle("QLabel - Hyperlink")
new qlabel(win1) {
setGeometry(100,100,100,30)
setopenexternallinks(true)
settext('<a href="http://google.com">Google</a>')
}
showMaximized()
}
exec()
}

The application during the runtime

49.22. Adding Hyperlink to QLabel 433


Ring Documentation, Release 1.3

49.23 QVideoWidget and QMediaPlayer

In this example we will learn about using the QVideoWidget and QMediaPlayer classes to play a group of movies
from different positions at the same time
Load "guilib.ring"

New qApp {

win1 = new qMainWindow() {

setwindowtitle("QVideoWidget")

btn1 = new qpushbutton(win1) {


setGeometry(0,0,100,30)
settext("play")
setclickevent("player.play() player2.play()
player3.play() player4.play()")
}

videowidget = new qvideowidget(win1) {


setGeometry(50,50,600,300)
setstylesheet("background-color: black")
}

videowidget2 = new qvideowidget(win1) {


setGeometry(700,50,600,300)
setstylesheet("background-color: black")
}

videowidget3 = new qvideowidget(win1) {


setGeometry(50,370,600,300)
setstylesheet("background-color: black")
}

videowidget4 = new qvideowidget(win1) {

49.23. QVideoWidget and QMediaPlayer 434


Ring Documentation, Release 1.3

setGeometry(700,370,600,300)
setstylesheet("background-color: black")
}

player = new qmediaplayer() {


setmedia(new qurl("1.mp4"))
setvideooutput(videowidget)
setposition(35*60*1000)

player2 = new qmediaplayer() {


setmedia(new qurl("2.mp4"))
setvideooutput(videowidget2)
setposition(23*60*1000)
}

player3 = new qmediaplayer() {


setmedia(new qurl("3.mp4"))
setvideooutput(videowidget3)
setposition(14.22*60*1000)
}

player4 = new qmediaplayer() {


setmedia(new qurl("4.avi"))
setvideooutput(videowidget4)
setposition(8*60*1000)
}

showfullscreen()

exec()

The application during the runtime

49.23. QVideoWidget and QMediaPlayer 435


Ring Documentation, Release 1.3

49.24 Using QFrame

In this example we will learn about using the QFrame class


Load "guilib.ring"

New qApp {
win1 = new qMainWindow() {
setwindowtitle("Using QFrame")
for x = 0 to 10
frame1 = new qframe(win1,0) {
setGeometry(100,20+50*x,400,30)
setframestyle(QFrame_Raised | QFrame_WinPanel)
}
next
showMaximized()
}
exec()
}

The application during the runtime

49.24. Using QFrame 436


Ring Documentation, Release 1.3

49.25 Display Image using QLabel

In this example we will learn about displaying an image using the QLabel widget
Load "guilib.ring"

New qApp {
win1 = new qMainWindow() {
setwindowtitle("QLabel - Display image")
new qlabel(win1) {
image = new qpixmap("b:/mahmoud/photo/advice.jpg")
setpixmap(image)
setGeometry(0,0,image.width(),image.height())
}

49.25. Display Image using QLabel 437

You might also like