# Qt-Examples **Repository Path**: spark-framework-libs/Qt-Examples ## Basic Information - **Project Name**: Qt-Examples - **Description**: https://github.com/RealChuan/Qt-Examples - **Primary Language**: Unknown - **License**: GPL-3.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-04-19 - **Last Updated**: 2024-04-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Some simple common examples of Qt - [Simplified Chinese](README.md) - [English](README.en.md) ## [QT Practical Tips (Update as soon as I think of it) | Free Will (realchuan.github.io)](https://realchuan.github.io/2021/10/12/QT%E5%AE%9E%E7%94%A8%E5%B0%8F%E6%8A%80%E5%B7%A7%EF%BC%88%E6%83%B3%E5%88%B0%E5%B0%B1%E6%9B%B4%E6%96%B0%EF%BC%89/) ## [Battery](/Battery/)——Battery control
## [BatteryQuick](/BatteryQuick/)--battery control(`QtQuick`) ## [Bootstrap](/Bootstarp/)--Auto-start settings and detection when the program is powered on 1. Reading and writing the registry under Windows enables self-starting at boot, and there are two locations where you can write; ```powershell HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run //对于所有用户 HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run // 对于当前用户 ``` 2. Copy the plist file to ~/Library/LaunchAgents/ under MacOS, and use the launchctl load/unload command to achieve automatic startup at boot; 3. There are two ways under Ubuntu: 1. Use the systemctl --user enable/disable command to achieve automatic startup at boot; 1. Copy the .service and .timer files to ~/.config/systemd/user/, and use the systemctl --user enable/disable command to implement automatic startup at boot; 2. The systemctl command is used in the .timer file, which is used to execute the .service file regularly to prevent the qxcbconnection: could not connect to display error from occurring after the graphical interface is started; 2. Copy the .desktop file under /usr/share/Application/ to ~/.config/autostart/ to achieve automatic startup at boot (not verified); ## [BubbleWindow](/BubbleWindow/)——Bubble dialog box, which can also be used as a tool tip (ToolTip)
## [Chart](Chart/)——Visual chart drawing, reference[Use QChart to display real-time dynamic curves](https://qtdebug.com/qtbook-paint-realtime-curve-qchart/ "qtdebug/公孙二狗")Examples related to QChart
图一二是动态曲线
图一二是动态曲线, 图二坐标轴也会动态变化
## [CheckBoxStandardItem](/CheckBoxStandardItem/)——StandardItem that can be checked, and the parent node status or child node status is automatically updated according to the checked status
## [Clock](/Clock/)--clock
## [DashBoard](/DashBoard/)--dash board
## [FlowLayout](/FlowLayout/)——Flow layout, from QT example Flow Layout Example
## [DragDrop](/DragDrop/)——Simple control drag and drop, refer to the QT example Drag and Drop Puzzle Example ## [HttpClient](/HttpClient/)——http client ## [IconButton](/IconButton/)——EventFilter and Button that support Icon following state switching ## [ImageCarousel](/ImageCarousel/)——Simple picture carousel
## [GridViewModel](/GridViewModel/)——Adaptive palace chart based on QListView
## [LogAsynchronous](/LogAsynchronous/)——Asynchronous logging, create a thread to write logs to files, and separate the front and back ends 1. Log file name: application name (appname). time (time, accurate to seconds). host name. process ID (Tid). log (. count). If a single log written in a day is close to 1G, a suffix will be added automatically. (.1,.2.3..., and so on) Create a new log file to write, and rollFile will still be rolled at 0 o'clock every day; 1. Normal file name: LogAsynchronous.2020-04-26-20-29-03.Youth.11828.log; 2. The log written on that day was close to 1G, and the new file name was: LogAsynchronous.2020-04-26-20-38-55.Youth.11828.log.1; 2. Log format: time (time, accurate to milliseconds). Thread ID (Pid). Log level (debug). Print information (msg). File (File). Line number (Line). 1. For example: 2020-04-26 20:38:55.818 2052[Debug]123456789qwertyuioplkjhgfdsa 8412789-File:(..\\logAsynchronous\\main.cpp) Line:(19); ## [MulClient](/MulClient/)——Multi-threaded client, one client per thread (how to bypass system limitations and simulate millions of clients) ## [MulServer](/MulServer/)——Multi-threaded server, one thread and one client processing (processing TCP communication with high real-time performance) ## [Navigation Progress Bar](/NavigationProgressBar/)——Navigation progress bar
## [PasswordLineEdit](/PasswordLineEdit/)——Password input box
## [ProgressArc](/ProgressArc/)——Arc progress bar
## [ProgressBar](/ProgressBar/)——QProgressBar rounded corner alternative
## [ReactorServer](/ReactorServer/)——Multi-threaded server, Reactor mode (Echo) ## [SimpleUdp](/SimpleUdp/)——Simple UDP example, broadcast and receive ## [ShowInMyComputer](/ShowInMyComputer/)——Show current applications in My Computer Firewall whitelist. ## [SlipButton](/SlipButton/)——Sliding button Another: A simpler implementation:[Animated CheckBox](http://qtdebug.com/qtbook-animated-checkbox/);
## [SqliteWAL](/SqliteWAL/)——Multi-threaded concurrent writing database program in Sqlite WAL mode ### Advantages of WAL mode 1. Improved concurrency: WAL mode allows multiple readers and one writer to access the database at the same time, which can improve concurrency and performance; 2. Crash recovery: WAL mode ensures that the database remains consistent in the event of a crash by flushing all changes to the log file before committing the transaction; 3. Improved write performance: WAL mode allows concurrent writes, which can improve write performance better than the default rollback mode; ### Things to note about WAL mode 1. WAL mode is only available in SQLite 3.35.5+ versions; 2. Increased disk usage: WAL mode requires more disk space than rollback mode because it writes all changes to the log file before committing them; 3. Slow read performance: In WAL mode, read operations are not blocked by write operations. If read and write operations are performed at the same time, data inconsistency may result. ## [TableViewModel](/TableViewModel/)——Table view 1. Various custom agents 1. [ButtonDelegate](./TableViewModel/buttondelegate.h); 2. [ComboBoxDelegate](./TableViewModel/comboboxdelegate.h); 3. [ProgressBarDelegate](./TableViewModel/progressbardelegate.h); 4. [RichTextItemDelegate](./TableViewModel/richtextitemdelegate.hpp); 5. [StarDelegate](./TableViewModel/stardelegate.h)----From Qt example Star Delegate Example; 2. One hundred thousand level data rendering;
## [Thread](/Thread/)——Multi-threading examples, 6 ways of writing ## [TreeViewModel](/TreeViewModel/)——Tree view (MVC), QtCreator source code
## [Validator](/Validator/)——Enhanced versions of IntValidator (QIntValidator) and DoubleValidator (QDoubleValidator) ## [packaging](/packaging/)——Packaging script 1. [macos](/packaging/macos/)——macos qmake compiles and packages dmg package script (`python`/`appdmg`); 2. [ubuntu](/packaging/ubuntu/)——Ubuntu qmake compiles and packages AppImage/deb package script (`linuxdeployqt-continuous-x86_64.AppImage`/`dpkg-deb`); 1. [A way to open an application with root privileges](/packaging/ubuntu/opt/MyApp/MyApp.sh): ```shell #!/bin/sh pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY /opt/MyApp/MyApp ``` 3. [windows](/packaging/windows/)——windows qmake compilation, packaging and installation script (`Innosetup`); 1. `Innosetup``signtool` sha256="C:\\Program Files (x86)\\Windows Kits\\10\\bin\\10.0.18362.0\\x86\\signtool.exe" sign /f C:\\certificate\\certificate.pfx /p password /fd SHA256 /tr http://timestamp.digicert.com/scripts/timestamp.dll /td SHA256 $f