You are on page 1of 10

Ring Documentation, Release 1.5.

55.18 Using QDial

In this example we will learn about using the QDial class


Load "guilib.ring"

New qApp {
win1 = new qMainWindow() {
setGeometry(100,100,450,500)
setwindowtitle("Using QDial")
new qdial(win1) {
setGeometry(100,100,250,300)
}
show()
}
exec()
}

The application during the runtime

55.18. Using QDial 565


Ring Documentation, Release 1.5.2

Another Example
Load "guilib.ring"

New qApp {
win1 = new qMainWindow()
{
setGeometry(100,100,450,500)
setwindowtitle("Using QDial")
button1 = new QPushButton(win1){
setGeometry(100,350,100,30)
settext("Increment")
setClickEvent("pIncrement()")
}

button2 = new QPushButton(win1){


setGeometry(250,350,100,30)
settext("Decrement")
setClickEvent("pDecrement()")
}
pdial = new qdial(win1) {

55.18. Using QDial 566


Ring Documentation, Release 1.5.2

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

55.18. Using QDial 567


Ring Documentation, Release 1.5.2

55.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

55.19. Using QWebView 568


Ring Documentation, Release 1.5.2

55.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

55.20. Using QCheckBox 569


Ring Documentation, Release 1.5.2

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

55.21 Using QRadioButton and QButtonGroup

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

55.21. Using QRadioButton and QButtonGroup 570


Ring Documentation, Release 1.5.2

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

55.21. Using QRadioButton and QButtonGroup 571


Ring Documentation, Release 1.5.2

55.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

55.22. Adding Hyperlink to QLabel 572


Ring Documentation, Release 1.5.2

55.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) {

55.23. QVideoWidget and QMediaPlayer 573


Ring Documentation, Release 1.5.2

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

55.23. QVideoWidget and QMediaPlayer 574

You might also like