Commit Graph

241 Commits

Author SHA1 Message Date
Yuhang Zhao 55fe04000e add more comments
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-09-11 10:43:48 +08:00
Yuhang Zhao 34596db939 fix various issues found by user
Issue list:

1. MinGW lacks some definitions so there's compilation errors
2. The chrome buttons' foreground color is incorrect when the window is inactive.
3. Adapt to new macros from Qt dev branch.
4. Remove unneeded parameter from setApplicationOSThemeAware().

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-09-10 13:11:55 +08:00
Yuhang Zhao 7dda58deaf free all resources during destruction
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-09-06 13:40:16 +08:00
Yuhang Zhao b9f65aa783 add frameless dialog & demo
And some other minor fixes.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-09-05 15:00:02 +08:00
Yuhang Zhao 012721d9a0 demo: add missing definition
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-08-31 16:47:40 +08:00
Yuhang Zhao 7a35b09a74 add limited qmake support
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-08-31 16:34:30 +08:00
Yuhang Zhao abf4b29dca minor fixes of the last commit
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-08-31 10:45:26 +08:00
Yuhang Zhao 463ac0a999 add window icon support
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-08-31 10:21:24 +08:00
Yuhang Zhao ce78c037b1 add some helper functionalities
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-08-28 19:25:22 +08:00
Yuhang Zhao 6ddf79ba9c demo: fix build on qt5
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-08-22 13:00:33 +08:00
Yuhang Zhao 6c060b3946 demo: add shortcut to switch between fullscreen state
Can also help use better debugging the old style window frame
issue on Windows.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-08-21 15:38:43 +08:00
Yuhang Zhao 4fe67c9313 cmake: minor improvements
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-07-27 09:36:28 +08:00
Yuhang Zhao 56499c7028 fix the widget demo
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-07-18 15:16:06 +08:00
Yuhang Zhao 7616161699 Implement homemade Mica material & other improvements
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-07-16 15:25:15 +08:00
Yuhang Zhao 2f36d1f73e blur behind window: add macos implementation
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-07-09 14:59:47 +08:00
Yuhang Zhao 7e3a735a7d minor tweaks and improvements
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-07-09 12:10:41 +08:00
Yuhang Zhao 9a93475f2b fix typo: snap layouts --> snap layout
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-07-07 17:00:15 +08:00
Yuhang Zhao 011b4a85f5 fix Qt5 build
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-07-07 16:22:34 +08:00
Yuhang Zhao 389c8ad6d6 examples: add convenient script to deploy qt libraries
Currently only functional on Windows. macOS and Linux to do.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-07-07 15:34:31 +08:00
Yuhang Zhao 2806cc811b code simplification, minor re-structure
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-07-07 13:43:09 +08:00
Yuhang Zhao 01828e086f quick blur demo: fix typo
And minor improvements to the win32 utils code.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-07-06 18:01:24 +08:00
Yuhang Zhao 464e2af515 finish the chrome palette implementation
And with some other minor tweaks that improve user experience.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-07-06 14:24:41 +08:00
Yuhang Zhao e8dcb6e6fe add api to set title bar and chrome button color
TODO:
1. Special handling for the close button
2. Move QuickChromePalette class to own files
3. More testing

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-07-05 17:58:04 +08:00
Yuhang Zhao cbf34ea0ec win32: try to fix bug
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-07-04 13:03:23 +08:00
Yuhang Zhao 71f8a5aab1 add blurBehindWindowEnabled property
Current only implements for Windows,
macOS will be implemented later,
Linux won't be supported in the near future.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-07-03 16:01:19 +08:00
Yuhang Zhao f90b49538a add support for qmltc tool
Also remove one useless enum.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-07-01 15:52:28 +08:00
Yuhang Zhao 66250dbb6e cmake: minor tweaks
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-06-27 14:15:34 +08:00
Yuhang Zhao a89f19af96 2.1.7 release
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-06-25 19:38:41 +08:00
Yuhang Zhao 6fe3dd1088 cmake: minor tweaks
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-05-23 14:46:20 +08:00
Yuhang Zhao ca1c33ac23 win32 demos: minor tweaks
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-05-23 09:58:39 +08:00
Yuhang Zhao 1cd39fd7b2 quick: a little code simplification
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-05-14 10:02:42 +08:00
Yuhang Zhao 8042a78b8f various fixes and improvements
1. Make all demo applications be able to record and restore the previous window geometry.
2. Improve the robustness of the widgets and quick implementation.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-05-13 14:19:50 +08:00
Yuhang Zhao a10ac4e32d demos: simplify some code
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-05-08 18:24:09 +08:00
Yuhang Zhao 053d6b104e centralize how we handle global options
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-05-08 16:09:00 +08:00
Yuhang Zhao c936a7da80 minor tweaks
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-05-06 21:00:07 +08:00
Yuhang Zhao e7f434c5a4 demo: center window on first show
Looks better than before.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-05-05 20:23:35 +08:00
Yuhang Zhao 1c6e02d81b code tidies, prepare for the 2.1 release
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-05-05 18:02:38 +08:00
Yuhang Zhao a97b1782ae redesign the title bar interface
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-05-04 14:50:11 +08:00
Yuhang Zhao 8ccbe2cf94 file rename, step 2
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-05-03 19:06:30 +08:00
Yuhang Zhao 6977db1e02 file rename, step 1
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-05-03 19:05:53 +08:00
Yuhang Zhao 81e736570f refactor widgets interface
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-05-03 19:02:39 +08:00
Yuhang Zhao 306ebfc717 Refactor the Quick implementation, interface is now simpler
Now we use attached properties instead, it make things simpler.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-05-02 12:26:57 +08:00
Yuhang Zhao ff8252aaf4 Add initial snap layout implementation
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-04-30 12:47:51 +08:00
Yuhang Zhao fbe241f29e internal refactor
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-04-29 18:03:39 +08:00
Yuhang Zhao 2f629a9e5b Quick: make the titleBarItem become a property
By making it a Q_PROPERTY we can use it more conveniently.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-04-25 14:50:41 +08:00
Yuhang Zhao 2915d1f33a Widgets: move FramelessWidgetsHelper to source directory
It's pure implementation detail, so should not be publicly visible

Also fixed the crash of the QOpenGLWidget demo application.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-04-24 11:33:05 +08:00
Yuhang Zhao 3f17626c64 misc: minor tweaks
1. Finish the simple title bar of the QOpenGLWidget demo
2. Minor improvements of the Quick implementation

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-04-22 12:04:38 +08:00
Yuhang Zhao 130d174dc2 misc: improve old Qt version support
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-04-21 21:13:16 +08:00
Yuhang Zhao 701d8d0927 fix build on 5.12 & add initial opengl demo
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-04-21 15:10:16 +08:00
Yuhang Zhao 2c0ec868ab finish the linux implementation
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-04-16 16:55:51 +08:00
Yuhang Zhao cd05b6ecdf quick: finish qml -> cpp migrating
Convert all qml files to pure c++ implementation.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-04-16 09:52:38 +08:00
Yuhang Zhao 4f5044a58c wip: quick: start migrating to modern usage
Still wip, but doesn't left much.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-04-14 17:33:09 +08:00
Yuhang Zhao b5d2ae5888 quick: improve the standard titlebar's appearance
And some minor tweaks to the initialize() function.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-04-02 17:56:45 +08:00
Yuhang Zhao d4bacdcab6 quick: fix running on qt5
Previously Qt5 can't recognize the Anchor enum, it's fixed now.
Also rename framelesshelper_quick to framelessquickhelper, the
former name was to avoid conflict with an already removed class.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-04-02 13:07:26 +08:00
Yuhang Zhao eb1c6f4a62 win32: minor improvements
1. Fix build on 32bit platforms: the "Ptr" suffixed APIs not available on 32bit platforms
2. Reduce the confusion caused by the original "UseStandardWindowLayout" option
3. Minor tweaks of the quick implementation

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-04-01 20:06:48 +08:00
Yuhang Zhao bde9c85cd9 cmake: add license headers
add some more license headers

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-04-01 14:36:36 +08:00
Yuhang Zhao 8bc08ab32f quick example: add some comments
explain some more

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-04-01 14:22:45 +08:00
Yuhang Zhao 6166422e37 misc: internal refactor
centralize how we handle string literals.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-04-01 14:09:14 +08:00
Yuhang Zhao 90ad8d281a little simplify
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-03-30 13:16:19 +08:00
Yuhang Zhao c49b971983 internal refactoring
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-03-29 13:34:05 +08:00
Yuhang Zhao d4e711d679 win implementation is mostly settled now
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-03-26 15:31:16 +08:00
Yuhang Zhao 533bbeac82 wip - QtQuick impl on win mostly done
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-03-25 15:44:59 +08:00
Yuhang Zhao fd3b815924 wip
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-03-24 16:37:37 +08:00
Yuhang Zhao 6ffc894213 wip
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-03-23 16:38:14 +08:00
Yuhang Zhao d94f8221d3 wip
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-03-23 10:48:22 +08:00
Yuhang Zhao 5ecc06df2f wip
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-03-22 15:03:22 +08:00
Yuhang Zhao 1ed6e2fb01 wip
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-03-21 16:53:18 +08:00
Yuhang Zhao 0e75f12089 wip
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-03-21 15:18:42 +08:00
Yuhang Zhao 12988f2ddf add the Options feature to control some details
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-03-20 15:51:05 +08:00
Yuhang Zhao 09acbfaf02 adjust the project file architecture
to make it more like a modern library project

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-03-20 12:30:00 +08:00
Yuhang Zhao 4d277a5eac wip
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-03-18 18:09:20 +08:00
Yuhang Zhao f700b07e5c wip
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-03-17 16:48:57 +08:00
Yuhang Zhao 7d22263df0 wip
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-03-17 11:58:19 +08:00
Yuhang Zhao 1aa92e3db4 wip
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-03-16 16:19:24 +08:00
Yuhang Zhao d6fe3fd8bd wip
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-03-16 10:12:12 +08:00
Yuhang Zhao 942fd02b66 wip
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-03-15 17:29:00 +08:00
Yuhang Zhao d46ec0c1b6 wip
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-03-15 13:02:59 +08:00
Yuhang Zhao f68665298b wip
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-03-14 20:59:38 +08:00
Yuhang Zhao bb8d174c56 wip
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-03-14 15:26:49 +08:00
Yuhang Zhao 3216defd59 wip
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-03-13 15:36:18 +08:00
Yuhang Zhao 2073cb9fd2 wip
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-03-13 15:17:27 +08:00
Yuhang Zhao 556741cfb1 wip
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-03-13 12:14:08 +08:00
Yuhang Zhao d0e19a2b1e wip
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-03-12 16:58:58 +08:00
Yuhang Zhao 2881874d7a wip
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-03-12 15:53:50 +08:00
Yuhang Zhao 01ad24aae1 wip
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-03-11 21:57:24 +08:00
Yuhang Zhao 0ce352ff22 wip
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-03-11 17:59:53 +08:00
Yuhang Zhao 0e4f95fe2c wip
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-03-11 16:23:12 +08:00
Yuhang Zhao 8e69a57039 wip
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-03-11 09:33:27 +08:00
Yuhang Zhao bbd20b6476 win32: minor improvements
1. Adds some more comments
2. Fixed a typo in QMainWindow example
3. Commented out a block of code that may cause issues
4. Return WVR_REDRAW by default in WM_NCCALCSIZE
5. Other minor tweaks

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-03-09 10:21:52 +08:00
Yuhang Zhao a9256ba4b3 QtQuick demo: work-around a QtQuick bug
See https://bugreports.qt.io/browse/QTBUG-69711
Also some minor tweaks of the constexpr variables.

Fixes: #35

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-02-10 10:14:54 +08:00
Yuhang Zhao e0c00bce35 Example improvements
Try to fix the frame border issue on high dpi monitors.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-01-10 10:07:26 +08:00
Yuhang Zhao 485d9665ea Fix build on Qt versions below 5.14
QStringView introduced in Qt 5.10.0
qExchange() introduced in Qt 5.14.0
qSwap() is deprecated, use std::swap() instead

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-01-07 13:15:46 +08:00
Yuhang Zhao e85e3f891e Example: special case for Win11
1. On Win11 we don't need to paint the frame border, the OS will always draw one for us.
2. Fix the wrong coordinate of the right and bottom frame border of the widget example.
3. Improve the Qt Quick example.
4. Correctly detect the OS version when building against Qt below 5.9.
5. Other minor tweaks.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-01-07 11:10:28 +08:00
Yuhang Zhao e3adb917a6 Fix build on Qt before 5.14
1. The QWinRegistryKey class was introduced in 5.14.0. The implementation is quite clean, so just copy the sources files from Qt repo in case the user is linking against a version older than 5.14.
2. Fixes the rounding error of the self-painted frame border of the examples.
3. Other minor tweaks.

Fixes: #95
Task-number: #94

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-01-06 11:18:33 +08:00
Yuhang Zhao 17601f386f Code refactor
1. Load dwmapi.dll and winmm.dll dynamically at runtime, to remove the dependency on those dlls
2. Use QSystemLibrary to load dlls, it can make the loading of system dlls safer, and avoid duplicating the code
3. Use QWinRegistryKey to access registry, no need to use QSettings in such scenarios
4. Adapt to new code when building against Qt 6.3 and newer.
5. Other minor tweaks.

Fixes: #94
2022-01-05 11:00:31 +08:00
Yuhang Zhao fb8f061091 Win32: Add workaround for DWM flicker
And some other minor tweaks.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2021-12-01 14:59:29 +08:00
Yuhang Zhao 2fafa7a433 Fix the border width of the examples
Amends commit 3aba956d66

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2021-11-19 14:29:44 +08:00
Yuhang Zhao 3aba956d66 Minor improvements
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2021-11-19 14:11:55 +08:00
Yuhang Zhao 330669e34a Quality improvements
1. Use native frame color in the MainWindow example, just like the Widget example. Fixes #87
2. Rename setHitTestVisibleInChrome() to setHitTestVisible(): This name was taken from Microsoft's WindowChrome class in WPF. Now they removed the legacy "Chrome" suffix in their new products, so we removed it as well.
3. Fix build with Qt older than 5.15: Q_NAMESPACE_EXPORT was introduced in Qt 5.14
4. Removed code that supports native frame: they are just leftovers of the previous refactoring.
4. Correctly detect SetWindowLongPtrW() and GetWindowLongPtrW() 's operation result: they won't modify the Last Error state on success, so we have to set Last Error state to ERROR_SUCCESS before calling them to make sure we get the correct error code.
5. Remove implicitly conversions, use explicit casts where possible
6. Fixed FormatMessage() usage, correctly retrieve the error message: According to MSDN, we should pass the address of a LPWSTR, not the LPWSTR itself.
7. Removed the special handing of WM_SIZE: It turns out that this handling is not needed at all and it's causing new issues, so just remove it.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2021-10-08 15:43:33 +08:00
Yuhang Zhao 138a2b90cb Minor refactor
1. Remove compiler specific flags
2. Build shared library by default
3. Remove unused functions
4. Minor tweaks of some internal logic, the final behavior is not affected

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2021-09-06 14:24:43 +08:00