Ring/Lessons/Desktop and Mobile development using RingQt

Desktop and Mobile development using RingQt
In this chapter we will learn how to use the Qt framework classes in our Ring applications to create Desktop and Mobile Applications.

The First GUI Application
In this example we will create an application to ask the user about his/her name. When the user type the name in the textbox then click on "Say Hello" button, the textbox value will be updated by adding "Hello " to the name.

Program Output:

At first we type the name in the textbox



Then we click on the say hello button



Using Layout
The next example is just an upgrade to the previous application to use the vertical layout.

The application during the runtime!



Using the QTextEdit Class
In this example we will use the QTextEdit Class

During the runtime we can paste rich text in the qtextedit widget



Using the QListWidget Class
In this example we will use the QListWidget Class

The application during the runtime



Using QTreeView and QFileSystemModel
In this example we will learn how to use the QTreeView widget to represent the File System

The application during the runtime



Using QTreeWidget and QTreeWidgetItem
In this example we will learn about using the QTreeWidget and QTreeWidgetItem classes

The application during the runtime



Using QComboBox Class
In this example we will learn about using the QComboBox class

The application during the runtime



Creating Menubar
In this example we will learn about using the QMenuBar class

The application during the runtime



Creating Toolbar
In this example we will learn about using the QToolBar class

The application during the runtime



Creating StatusBar
In this example we will learn about using the QStatusBar class

The application during the runtime



Using QDockWidget
In this example we will learn about using the QDockWidget class

The application during the runtime



Using QTabWidget
In this example we will learn about using the QTabWidget class

The application during the runtime



Using QTableView
In this example we will learn about using the QTableView class

The application during the runtime



Using QProgressBar
In this example we will learn about using the QProgressBar class

The application during the runtime



Using QSpinBox
In this example we will learn about using the QSpinBox class

The application during the runtime



Using QSlider
In this example we will learn about using the QSlider class

The application during the runtime



Using QDateEdit
In this example we will learn about using the QDateEdit class

The application during the runtime



Using QDial
In this example we will learn about using the QDial class

The application during the runtime



Using QWebView
In this example we will learn about using the QWebView class

The application during the runtime



Using QCheckBox
In this example we will learn about using the QCheckBox class

The application during the runtime



Using QRadioButton and QButtonGroup
In this example we will learn about using the QRadioButton and QButtonGroup classes

The application during the runtime



Adding Hyperlink to QLabel
In this example we will learn about creating Hyperlink using the QLabel class

The application during the runtime



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

The application during the runtime



Using QFrame
In this example we will learn about using the QFrame class

The application during the runtime



Display Image using QLabel
In this example we will learn about displaying an image using the QLabel widget

The application during the runtime



Menubar and StyleSheet Example
In this example we will learn about creating menubar and setting the window stylesheet

The application during the runtime



QLineEdit Events and QMessageBox
In this example we will learn about using QLineEdit Events and displaying a Messagebox

The application during the runtime





Other Widgets Events
Each Qt signal can be used in RingQt, just add Set before the signal name and add event after the signal name to get the method that can be used to determine the event code.

For example the QProgressBar class contains a signal named valueChanged To use it just use the function setValueChangedEvent

Example:

The application during the runtime



Another example for the stateChanged event of the QCheckBox class

The application during the runtime



Using the QTimer Class
In this example we will learn about using the QTimer class

The application during the runtime



Using the QFileDialog Class
Example

The application during the runtime



Drawing using QPainter
In this example we will learn about drawing using the QPainter class

The application during the runtime



Printing using QPrinter
In this example we will learn how to print to PDF file using QPrinter

Creating More than one Window
The next example demonstrates how to create more than one window

The application during the runtime



Playing Sound
Example:

Color Dialog
Example:

The application during the runtime

Using qLCDNumber Class
In this example we will learn about using the qLCDNumber class

The application during the runtime

Movable Label Example
The application during the runtime

QMessagebox Example
In this section we will learn how to check the output of the Message box

The application during the runtime

Using QInputDialog Class
In the next example we will learn about using the QInputDialog class

The application during the runtime

KeyPress and Mouse Move Events
In this example we will learn how to use the Events Filter to know about KeyPress and Mouse Move Events

The application during the runtime

Moving Objects using the Mouse
In the next example we will learn how to program movable objects where the user can move a label

The application during the runtime



Inheritance from GUI Classes
Example :

The application during the runtime

Using QDesktopWidget Class
In the next example we will learn about using the QDesktopWidget class

The application during the runtime

Simple Client and Server Example
In this section we will learn about creating simple Client and Server Application

The application during the runtime



Notepad Application
In the next example we will see simple Notepad developed using the RingQt

The application during the runtime

The next screen shot demonstrates the "File" menu



The next window for "search and replace"



The next screen shot demonstrates the application main window



.. Note:: the functions pDebug, pRun and pRunNoConsole in the previous sample are not portable! They are written in this sample for MS-Windows and we can update them for other operating systems.

The Cards Game
In the next example we will see a simple Cards game developed using RingQt

Each player get 5 cards, the cards are unknown to any one. each time one player click on one card to see it. if the card is identical to another card the play get point for each card. if the card value is "5" the player get points for all visible cards.

The application during the runtime

.. note:: in the previous screen shot the player get the card number '5' but his score is not increased because he opened this card while no other cards are visible!

The next screen shot while running the game using a Mobile (Android)



.. note:: using Qt we can run the same application on other Mobile systems