Skip to content

Commit 13f0b1a

Browse files
docs: Added README."en".md translation via https://github.com/dephraiim/translate-readme
1 parent 719982c commit 13f0b1a

1 file changed

Lines changed: 281 additions & 0 deletions

File tree

README.en.md

Lines changed: 281 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,281 @@
1+
# Qt-Examples
2+
3+
- [Simplified Chinese](README.md)
4+
- [English](README.en.md)
5+
6+
## Overview
7+
8+
This repository contains numerous Qt samples demonstrating everything from basic UI components to advanced network programming and system tools. Each example is self-contained and can be used as a reference or starting point for your own Qt projects.
9+
10+
## Example
11+
12+
# [AutoStartManager](src/AutoStartManager/)- Auto-start at boot
13+
14+
- **Windows**:User registration form`HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run`, system registry`HKEY_LOCAL_MACHINE\...\Run`
15+
- **macOS**`~/Library/LaunchAgents/com.{appname}.plist`
16+
- **Linux**`~/.config/autostart/{appname}.desktop`
17+
- <img src="src/AutoStartManager/images/auto_start.png" width="500" alt="开机自启动">
18+
19+
### [Battery](src/Battery/) - 电池电量显示控件
20+
21+
- Supports charging status display and lightning symbol
22+
- Low battery alarm threshold and color can be set
23+
- Support numerical animation transition effects
24+
- <img src="src/Battery/images/battery.png" width="300" alt="电池控件截图">
25+
26+
### [BatteryQuick](src/BatteryQuick/)-Battery power display control (QtQuick version)
27+
28+
- <img src="src/BatteryQuick/images/battery.png" width="300" alt="电池控件截图">
29+
30+
### [Bubble](src/Bubble/)- Bubble dialog control
31+
32+
- Support arrow positioning in four directions
33+
- Contains fade animation and shadow effects
34+
- Customizable borders, background colors and rounded corners
35+
- <img src="src/Bubble/images/bubble.png" width="600" alt="气泡对话框截图">
36+
37+
### [ButtonIconStateManager](src/ButtonIconStateManager/)- Button icon state manager
38+
39+
- Smart management button icon switching in different states
40+
- Supports four states: normal, hover, pressed, and selected.
41+
- Automatic status detection based on event filters
42+
- Can be applied to QPushButton, QToolButton and other button types
43+
44+
### [Carousel3DView](src/Carousel3DView/)- 3D carousel control
45+
46+
- Supports image carousel display with stereoscopic 3D effect
47+
- Customizable animation duration and automatic rotation interval
48+
- Automatic carousel is paused when the mouse is hovered and resumed when removed.
49+
- Support clicking on the picture to jump directly to the center location
50+
- Responsive design to adapt to different window sizes
51+
- Provide complete control interface and status feedback
52+
- <img src="src/Carousel3DView/images/carousel.png" width="650" alt="3D轮播图控件截图">
53+
54+
### [Chart](src/Chart/)- Data visualization charts (QtCharts module Desprecated)
55+
56+
- Multiple chart types: area chart, line chart, pie chart, bar chart
57+
- Real-time dynamic charts
58+
- Custom callouts and tooltips
59+
- <img src="src/Chart/picture/Chart_1.png" width="90%" alt="动态图表">
60+
<img src="src/Chart/picture/Chart_2.png" width="90%" alt="滚动图表">
61+
62+
### [CheckableTreeItem](src/CheckableTreeItem/)- Hierarchical checkbox tree
63+
64+
- The check box status of parent and child nodes is automatically linked
65+
- Support three-state display (selected/unselected/partially selected)
66+
- Contains file system tree structure demonstration
67+
- <img src="src/CheckableTreeItem/images/checkable_tree.png" width="800" alt="层次化复选框树">
68+
69+
### [Clock](src/Clock/)- Analog clock control
70+
71+
- Support second hand smooth animation effect
72+
- Customizable dial, scale, and pointer colors
73+
- Provides a variety of preset color themes
74+
- <img src="src/Clock/images/clock.png" width="800" alt="时钟控件截图">
75+
76+
### [DashBoard](src/DashBoard/)- Dashboard controls
77+
78+
- Adjustable scale range and angle range
79+
- Support pointer numerical animation transition
80+
- Highly customizable colors and text styles
81+
- <img src="src/DashBoard/images/dashboard.png" width="800" alt="仪表盘控件截图">
82+
83+
### [FlowLayout](https://doc.qt.io/qt-6/qtwidgets-layouts-flowlayout-example.html)- Qt official Flow Layout Example
84+
85+
### [GridViewModel](src/GridViewModel/)- Adaptive grid layout
86+
87+
- Grid layout component based on Qt Model-View architecture
88+
- Support adaptive column number and custom cells
89+
- Built-in multi-selection function and smooth interactive experience
90+
- <img src="src/GridViewModel/images/grid_view_model.png" width="800" alt="网格布局视图">
91+
92+
### [HttpClient](src/HttpClient/)- HTTP client
93+
94+
- Support GET/POST/PUT/DELETE method
95+
- File upload and download, supports breakpoint resume and progress callback
96+
- JSON request and response processing automatically
97+
- Timeout control and SSL certificate configuration
98+
- Integrated life cycle safety callback mechanism
99+
100+
### [LifecycleCallback](src/LifecycleCallback/)- Lifecycle aware callback wrapper
101+
102+
- Automatically detect object destruction and avoid dangling callbacks
103+
- Supports QObject, std::shared_ptr and free functions
104+
- Type safety, providing convenient creation of functions
105+
- Suitable for asynchronous operations and event processing scenarios
106+
107+
### [LoadingIndicator](src/LoadingIndicator/)- Loading indicator control
108+
109+
- Supports multiple animation styles: rotating dots, pulsing circles, jumping bars, and custom GIF animations
110+
- Customizable text, color, background and animation speed
111+
- Provide overlay mode to easily achieve mask loading effect
112+
- Flexible parameter settings to adapt to different scene needs
113+
- Automatically respond to window size changes and maintain centered display
114+
- <img src="src/LoadingIndicator/images/loading.png" width="450" alt="加载指示器截图">
115+
116+
### [LoadingIndicatorQuick](src/LoadingIndicatorQuick/)- Loading indicator control (QtQuick version)
117+
118+
- <img src="src/LoadingIndicatorQuick/images/loading.png" width="450" alt="QML加载指示器截图">
119+
120+
### [LoadingOverlayQuick](src/LoadingOverlayQuick/)- Load overlay control (QtQuick version)
121+
122+
- Lightweight loading overlay component based on QtQuick Popup
123+
- Use the system's native BusyIndicator to ensure platform consistency
124+
- Modal dialog box design to prevent user interaction
125+
- Support dynamic text settings and color customization
126+
- Simple API, providing show/hide methods to control display
127+
- Automatically center the display to adapt to different screen sizes
128+
- <img src="src/LoadingOverlayQuick/images/loading.png" width="350" alt="加载覆盖层截图">
129+
130+
### [LogAsync](https://github.com/RealChuan/Qt-App/blob/main/src/utils/logasync.h)- Asynchronous logging system
131+
132+
- Independent thread handles log writing to avoid blocking the main thread
133+
- Supports console output, file recording or both at the same time
134+
- Automatically roll log files by size and time, support automatic cleaning of old files
135+
- Different log levels can be set (Debug, Info, Warning, Error, Fatal)
136+
- Console output length limit to avoid overly long logs from swiping the screen
137+
- Built-in signal and slot mechanism to ensure data security in multi-threaded environment
138+
139+
### [MultithreadedTcpServer](https://doc.qt.io/qt-6/qtcpserver.html#incomingConnection)- Description of multi-threaded TCP server implementation mechanism
140+
141+
**core mechanism**: rewrite`QTcpServer::incomingConnection(qintptr socketDescriptor)`method
142+
143+
- **Passing between threads**: Pass the native socket descriptor to the worker thread
144+
- **Create within thread**:Created in worker thread`QTcpSocket`and call`setSocketDescriptor()`
145+
- **Connection management**: Custom socket needs to be called`addPendingConnection()`Join the connection mechanism
146+
147+
```cpp
148+
// 核心实现模式
149+
void ThreadedTcpServer::incomingConnection(qintptr socketDescriptor)
150+
{
151+
// 创建工作线程并传递socketDescriptor
152+
ClientThread *thread = new ClientThread(socketDescriptor, this);
153+
connect(thread, &ClientThread::finished, thread, &QObject::deleteLater);
154+
thread->start();
155+
}
156+
```
157+
158+
**Reference documentation**:[QTcpServer Class - Qt 6 Documentation](https://doc.qt.io/qt-6/qtcpserver.html#incomingConnection)
159+
160+
### [NavigationProgressBar](src/NavigationProgressBar/)- Navigation progress bar control
161+
162+
- Supports visual display of multi-step processes
163+
- Customizable color themes and font styles
164+
- Provide step forward, backward and reset functions
165+
- Adaptive layout, responding to window size changes
166+
- <img src="src/NavigationProgressBar/images/navigation_progress.png" width="800" alt="导航进度条截图">
167+
168+
### [NavigationProgressBarQuick](src/NavigationProgressBarQuick/)- Navigation progress bar control (QtQuick version)
169+
170+
- <img src="src/NavigationProgressBarQuick/images/navigation_progress.png" width="800" alt="导航进度条截图">
171+
172+
### [PasswordInputQuick](src/PasswordInputQuick/)- Password input box control (QtQuick version)
173+
174+
- <img src="src/PasswordInputQuick/images/password_input.png" width="600" alt="密码输入框截图">
175+
176+
### [PasswordLineEdit](src/PasswordLineEdit/)- Password input box control
177+
178+
- Support show/hide password switching function
179+
- Automatically detect CapsLock status and display warning prompts
180+
- Customizable icons, prompt duration and warning functions
181+
- Provide password verification and batch operation support
182+
- <img src="src/PasswordLineEdit/images/password_line_edit.png" width="600" alt="密码输入框截图">
183+
184+
### [ProgressArc](src/ProgressArc/)- Circular progress indicator
185+
186+
- Arc progress visualization
187+
- <img src="src/ProgressArc/picture/ProgressArc.png" width="90%" alt="弧形进度">
188+
189+
### [ProgressBar](src/ProgressBar/)- Rounded corner progress bar
190+
191+
- Custom style progress bar
192+
- QProgressBar alternative
193+
- <img src="src/ProgressBar/picture/ProgressBar.png" width="90%" alt="圆角进度条">
194+
195+
### [ReactorServer](src/ReactorServer/)- Reactor mode server
196+
197+
- Reactor design pattern implementation
198+
- Multi-threaded echo server
199+
200+
### [ShowInMyComputer](src/ShowInMyComputer/)- System integration
201+
202+
- Show application in system location
203+
- Firewall whitelist
204+
205+
### [SimpleUdp](src/SimpleUdp/)- UDP communication
206+
207+
- UDP broadcast and receive
208+
- Simple network communication example
209+
210+
### [SlipButton](src/SlipButton/)- Sliding toggle button
211+
212+
- animated toggle switch
213+
- <img src="src/SlipButton/picture/SlipButton_check.png" width="200" alt="未选中">
214+
<img src="src/SlipButton/picture/SlipButton_checked.png" width="200" alt="已选中">
215+
216+
### [SqliteWAL](src/SqliteWAL/)- SQLite write-ahead log
217+
218+
- Multi-threaded SQLite database operations
219+
- WAL mode implementation
220+
- Thread-safe write operations
221+
222+
### [TableViewModel](src/TableViewModel/)- Advanced table view
223+
224+
- Custom delegate: button, combo box, progress bar
225+
- Rich text rendering
226+
- Star Rating Delegation
227+
- High-performance data rendering (100,000+ rows)
228+
- <img src="src/TableViewModel/picture/TabViewModelDelegate.jpg" width="90%" alt="表格视图委托">
229+
230+
### [Thread](src/Thread/)- Multi-threading example
231+
232+
- 6 different ways to handle threads
233+
- QThread usage pattern
234+
235+
### [TreeViewModel](src/TreeViewModel/)- Tree and list views
236+
237+
- MVC pattern implementation
238+
- Checkbox title view
239+
- File system-like tree structure
240+
- <img src="src/TreeViewModel/picture/TreeView.png" width="90%" alt="树形视图">
241+
<img src="src/TreeViewModel/picture/ListView.png" width="90%" alt="列表视图">
242+
243+
### [Validator](src/Validator/)- Enhanced input validator
244+
245+
- Improved IntValidator and DoubleValidator
246+
- Custom validation rules
247+
248+
### [packaging](src/packaging/)- Cross-platform packaging solutions
249+
250+
##### macOS packaging
251+
252+
- **Reference implementation**:[Qt-App macOS packaging](https://github.com/RealChuan/Qt-App/tree/main/packaging/macos)
253+
- **core file**:
254+
- **DMG package**:
255+
- [create-dmg](https://github.com/sindresorhus/create-dmg): The simplest;
256+
- [create-dmg](https://github.com/create-dmg/create-dmg):Bash script;
257+
- [node-appdmg](https://github.com/LinusU/node-appdmg): json configuration file;
258+
- [dmgbuild](https://pypi.org/project/dmgbuild/): Python script;
259+
- [entitlements.plist](packaging/macos/entitlements.plist)- Application signing permissions profile
260+
- [package.sh](src/packaging/macos/package.sh)- Main packaging script, including the signing process,[Qt-App macOS packaging](https://github.com/RealChuan/Qt-App/tree/main/packaging/macos)There is no signing process here
261+
- [utils.sh](src/packaging/macos/utils.sh)- Packaging helper functions
262+
263+
##### Windows packaging
264+
265+
- **Reference implementation**:[Qt-App Windows packaging](https://github.com/RealChuan/Qt-App/tree/main/packaging/windows)
266+
- **core file**:
267+
- [sign.bat](src/packaging/windows/sign.bat)- Code signing script, supports integration into Inno Setup
268+
- **Signature integration**: Integrate the signing script in sign.bat into the Inno Setup tool:
269+
1. Select in Inno Setup`Tools`→`Configure Sign Tools`
270+
2. Add the signing tool and paste the script content in sign.bat
271+
3. Add the corresponding sign flags parameter to the packaging script for the files that need to be signed.
272+
273+
##### Ubuntu packaging
274+
275+
- **Reference implementation**:[Qt-App Ubuntu packaging](https://github.com/RealChuan/Qt-App/tree/main/packaging/ubuntu)
276+
277+
## resource
278+
279+
- [Qt Practical Tips (Chinese)](https://realchuan.github.io/2021/10/12/QT实用小技巧(想到就更新)/)
280+
- [Use QChart to display real-time dynamic curves](https://qtdebug.com/qtbook-paint-realtime-curve-qchart/)
281+
- [SQLite WAL documentation](https://sqlite.org/wal.html)

0 commit comments

Comments
 (0)