Commit Graph

144 Commits

Author SHA1 Message Date
Yuhang Zhao b8a3ff604f win: minor tweaks
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-11-10 11:17:29 +08:00
Yuhang Zhao 3842f4e353 win: fix typo
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-11-09 14:43:44 +08:00
Yuhang Zhao c86a3fe35e win: reshuffle code a bit
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-11-09 14:40:03 +08:00
Yuhang Zhao 07bd39d1aa win: minor improvement
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-11-06 19:28:25 +08:00
Yuhang Zhao ac6a2c11a7 win: minor improvement
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-11-06 15:52:25 +08:00
Yuhang Zhao 9715bd9d4b minor tweaks
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-11-03 13:52:57 +08:00
trbogdanov 31849d1c12
gcc and qt-5.12.0 compilation error fix (#171)
Compililation with gcc (any version) and Qt 5.12.0 (important) fails with error:
```
Core/private/sysapiloader_p.h:59:26: error: no matching function for call to ‘QMutex::QMutex()’
     static inline QMutex m_mutex;
                          ^~~~~~~
include/QtCore/qmutex.h:165:5: note: candidate: ‘QMutex::QMutex(const QMutex&)’ <deleted>
     Q_DISABLE_COPY(QMutex)
     ^~~~~~~~~~~~~~
```

`QMutex` in Qt 5.12.0 has explicit (!) one-parameter constructor with a
default value: `QMutex(QMutex::RecursionMode mode = NonRecursive)` and no
default constructor. In this case declaring static inline member without
initializer causes the above error.
2022-10-26 17:13:53 +08:00
Yuhang Zhao 53bf6016df win: simplify code a little
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-10-20 17:26:55 +08:00
Yuhang Zhao af6d3c7380 win: minor tweaks
1. Avoid name collision of original Win SDK
2. Enable non-client area DPI scaling when building with Qt < 5.9.0

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-10-20 14:15:11 +08:00
Yuhang Zhao fe6fb8ef5f win: add new win10 subver
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-10-19 17:15:23 +08:00
Yuhang Zhao 1ae0bd8fd6 examples: reuse common code
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-10-17 13:43:38 +08:00
Yuhang Zhao e2f7c76c88 win: minor tweaks
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-10-16 13:41:41 +08:00
Yuhang Zhao 87da6cb5da move static_assert to cpp source files
To speed up compilation time.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-10-13 09:44:50 +08:00
Yuhang Zhao f15ca8daf0 fix various issues
1. Fix mica material doesn't work normally when used on multiple windows.
2. Fix build on Qt5.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-10-12 14:08:58 +08:00
Yuhang Zhao 994b02ad6c quick: add FramelessApplicationWindow element
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-10-12 10:47:41 +08:00
Yuhang Zhao b9f5cf79c0 win32: add support for dark theme menu
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-10-11 16:17:04 +08:00
Yuhang Zhao fcf51d6d73 refactor
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-10-11 11:52:49 +08:00
Yuhang Zhao 1e43ba2e81 improve windowborder element
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-10-10 22:12:01 +08:00
Yuhang Zhao 55be173c31 minor tweaks
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-10-10 13:59:00 +08:00
Yuhang Zhao 92415fb61c Add WindowBorderPainter and WindowBorder
1. Added WindowBorderPainter for QtWidgets
2. Added WindowBorder for QtQuick (uses WindowBorderPainter internally)
3. Adjust some header includes
4. Limit a Linux workaround to the appropriate Qt versions

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-10-10 13:35:37 +08:00
Yuhang Zhao b50a2dcd72 fix Qt5 compilation error
And change to lazy initialization for Mica Material.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-10-09 10:08:49 +08:00
Yuhang Zhao d483c39b9a add way to disable window maximization
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-10-08 15:25:22 +08:00
Yuhang Zhao ac9a05209e quick: fix misleading and annoying warning
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-09-30 12:58:13 +08:00
Yuhang Zhao 07101273bd win: refactor & simplify
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-09-26 11:18:13 +08:00
Yuhang Zhao f97f000cc7 avoid potential deadlocks
And some other minor tweaks.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-09-25 10:35:00 +08:00
Yuhang Zhao 684ebc3fa3 minor improvement
Code simplification & adapt to latest Qt code.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-09-23 14:04:47 +08:00
Yuhang Zhao eeda750a61 finalize api update
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-09-21 13:22:03 +08:00
Yuhang Zhao 47bf4da5ae allow user to remove a window from the frameless window list
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-09-20 15:56:59 +08:00
Yuhang Zhao 3d3607af7b refactor
and maybe avoid potential bugs.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-09-16 17:38:13 +08:00
Yuhang Zhao 91bb8273b8 routine code quality improvement
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-09-15 18:24:34 +08:00
Yuhang Zhao 47dcb8f032 quick: emulate Windows behavior more, just like widget
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-09-14 17:07:06 +08:00
Yuhang Zhao 1b36587f14 widgets: emulate Windows behavior more
On Windows, when you left click the window icon in the title bar, the system menu will be triggered.
And when you double click it, the window will be closed.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-09-14 13:30:08 +08:00
Yuhang Zhao 221f1c12aa fix button size can't be changed
widget: fix the bug
quick: add the interface to change size

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-09-13 17:38:10 +08:00
Yuhang Zhao 55fe04000e add more comments
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-09-11 10:43:48 +08:00
Jan Kowalewicz 6a46844853
win: Qt version check for #155 (#157) 2022-09-11 10:23:01 +08:00
Jan Kowalewicz f2affbca85
win: fix build with Qt 5.14 and MinGW (#155) 2022-09-10 16:38:40 +08:00
Yuhang Zhao 33c3eaa05a win: add missing definitions for mingw
Fixes: #153
Fixes: #154

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-09-10 16:04:17 +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 f2a6d35908 improve macos code [1/2]
1. Simplify code a little
2. Use Qt functionalities as many as possible.
3. Prepare for adding old Qt support.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-09-05 16:55:55 +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 5018d9ea82 widget: add support for changing title font
Not needed for Qt Quick, because you can easily to change it:

```qml
StandardTitleBar {
    titleLabel {
        font {
            family: "Arial"
            pointSize: 10
            italic: true
        }
    }
}
```

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-09-02 10:39:45 +08:00
Yuhang Zhao ba343fbbd4 win: fix bug when using Qt 5.14 and below
Fixes: #152

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-09-01 16:45:32 +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 e55afa2fe3 simplify a function
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-08-28 20:08:44 +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 406c801383 Remove unneeded function
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-08-25 11:16:50 +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