Qt Examples
shows how to use Qt widgets only by programming code (c++17).
Hello World
- HelloWorldEmoticons The classic first application "Hello, world!" with QLabel and emoticons.
- HelloWorldLabel The classic first application "Hello, world!" with QLabel.
- HelloWorldMessageBox The classic first application "Hello, world!" with QMessageBox.
- HelloWorldPaint The classic first application "Hello, world!" with QPainter.
Application and messages
- Application shows how to create an application with QApplication.
- DarkMode shows how to create a dark mode application.
Common Controls
- CheckBox shows how to create a check box with QCheckBox.
- CheckedListWidget shows how to create a checked list widget with QListWidget.
- ComboBox shows how to create a combo box with QComboBox.
- Dial shows how to create a dialx with QDial.
- DoubleSpinBox shows how to create a double spin box with QDoubleSpinBox.
- LCDNumber shows how to create a LCD number with QLCDNumber.
- Label shows how to create a label with QLabel.
- LineEdit shows how to create a line edit with QLineEdit.
- ListView shows how to create a list view with QListView.
- ListView2 shows how to create a list view with QTreeView.
- ListWidget shows how to create a list widget with QListWidget.
- PictureBox shows how to create a picture box with QLabel.
- PictureBox2 shows how to create a picture box with QGraphicsPixmapItem.
- ProgressBar shows how to create a ProgressBar with QProgress.
- PushButton shows how to create a button and Event Click with QPushButton.
- RadioButton shows how to create a radio button with QRadioButton.
- Slider shows how to create a slider with QSlider.
- SpinBox shows how to create a spin box with QSpinBox.
- SpinButton shows how to create a spin button with QSpinBox.
- ToggleButton shows how to create a toggle button with QPushButton.
- TreeView shows how to create a three view with QTreeView.
- TreeWidget shows how to create a three widget with QTreeWidget.
- Widget shows how to create a widget with QWidget.
Custom Controls
- Line shows how to create a custom widget line with QFrame.
Containers
- Frame shows how to create a frame with QFrame.
- GroupBox shows how to create a group box with QGroupBox.
- TabWidget shows how to create a tab widget with QTabWidget.
- Window shows how to create a window with QMainWindow.
Menus and toolbars
- MenuBar shows how to create a menu bar with QMenu and QAction.
- StatusBar shows how to create a status bar with QStatusBar.
- ToolBar shows how to create a toolbar bar with QToolBar.
Components
- Cursors shows how to associate cursor to widget with QCursor.
- Timer shows how to create a Timer with QTimer.
Dialogs
- ColorDialog shows how to create a ColorDialog with QColorDalog.
- FolderBrowserDialog shows how to create a FolderBrowserDialog with QFileDialog.
- FontDialog shows how to create a FontDialog with QFontDialog.
- MessageBox shows how to create a MessageBox with QMessageBox.
- OpenFileDialog shows how to create an OpenFileDialog with QFileDialog.
- SaveFileDialog shows how to create an SaveFileDialog with QFileDialog.
Others
- LCDNumber2 shows how to create a LCD number with QLCDNumber.
- Wiggly shows how to animate a user control using QBasicTimer and timerEvent(). In addition, the example demonstrates how to use QFontMetrics to determine the size of text on screen.
Download
git clone https://github.com/gammasoft71/Examples_Qt.git
Generate and build
Qt Creator
To build these projects, open each project.pro file with Qt Creator.
CMake
To build this project, open "Terminal" and type following lines:
Set "CMAKE_PREFIX_PATH" with Qt5 install path.
Windows :
mkdir build
cd build
cmake ..
start ./Qt.Examples.sln
macOS :
mkdir build
cd build
cmake .. -G "Xcode"
open ./Qt.Examples.xcodeproj
Linux :
mkdir build
cd build
cmake ..
cmake --build . --config Debug