Minor improvements.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
Yuhang Zhao 2020-10-22 11:49:30 +08:00
parent 6a12cb1a30
commit d671fd703d
10 changed files with 33 additions and 9 deletions

View File

@ -4,7 +4,21 @@ If you are using part of or all the code from this repository in your own projec
如果您正在使用此项目的部分或全部代码,这是我的荣幸,我很高兴能帮到您,但我同时也希望,您能将您项目的首页或仓库的网址告诉我(闭源或收费都没关系),我将在这个自述文件中链接到您所提供的网址,以供展示。如果您能一并提供一些软件运行时的截图,那就更好了。
## Screenshots
## Screenshots - Win32
![Win32Demo 1](/screenshots/win32demo1.png)
![Win32Demo 2](/screenshots/win32demo2.png)
![Win32Demo 3](/screenshots/win32demo3.png)
![Win32Demo 4](/screenshots/win32demo4.png)
![Win32Demo 5](/screenshots/win32demo5.png)
![Win32Demo 6](/screenshots/win32demo6.png)
## Screenshots - Cross platform
![zhihuiyanglao](/screenshots/zhihuiyanglao.png)

View File

@ -2,15 +2,17 @@
## Screenshots
![zhihuiyanglao](/screenshots/zhihuiyanglao.png)
![Win32Demo 1](/screenshots/win32demo1.png)
![QQ Player](/screenshots/qqplayer.png)
![Win32Demo 2](/screenshots/win32demo2.png)
![Qt Widgets example](/screenshots/widgets.png)
![Win32Demo 3](/screenshots/win32demo3.png)
![Qt MainWindow example](/screenshots/mainwindow.png)
![Win32Demo 4](/screenshots/win32demo4.png)
![Qt Quick example](/screenshots/quick.png)
![Win32Demo 5](/screenshots/win32demo5.png)
![Win32Demo 6](/screenshots/win32demo6.png)
## Features

View File

@ -155,6 +155,8 @@ Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget)
ui->forceAcrylicCB->setEnabled(m_bIsWin101803OrGreater);
if (shouldDrawBorder()) {
layout()->setContentsMargins(1, 1, 1, 1);
} else {
layout()->setContentsMargins(0, 0, 0, 0);
}
updateTitleBar();
@ -213,7 +215,7 @@ Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget)
});
connect(ui->blurEffectCB, &QCheckBox::stateChanged, this, [this](int state) {
const bool enable = state == Qt::Checked;
QColor color = Qt::white;
QColor color = {0, 0, 0, 127};
if (m_bIsWin101803OrGreater && ui->forceAcrylicCB->isChecked()) {
if (enable && m_bShowColorDialog) {
color = QColorDialog::getColor(color,
@ -280,6 +282,11 @@ bool Widget::shouldDrawThemedBorder(const bool ignoreWindowState) const
return (shouldDrawBorder(ignoreWindowState) && isThemeColorEnabled());
}
bool Widget::shouldDrawThemedTitleBar() const
{
return m_bIsWin10OrGreater && isThemeColorEnabled();
}
QColor Widget::activeBorderColor() const
{
return isThemeColorEnabled() ? m_cThemeColor : m_cDefaultActiveBorderColor;
@ -387,7 +394,7 @@ void Widget::paintEvent(QPaintEvent *event)
void Widget::updateTitleBar()
{
const bool themedTitleBar = shouldDrawThemedBorder(true) && isActiveWindow();
const bool themedTitleBar = shouldDrawThemedTitleBar() && isActiveWindow();
if (themedTitleBar && !m_bExtendToTitleBar) {
ui->minimizeButton->setIcon(QIcon(QLatin1String(":/images/button_minimize_white.svg")));
ui->closeButton->setIcon(QIcon(QLatin1String(":/images/button_close_white.svg")));
@ -446,7 +453,7 @@ void Widget::updateTitleBar()
void Widget::initWindow()
{
if (m_bIsWin10OrGreater) {
ui->preserveWindowFrameCB->click();
//ui->preserveWindowFrameCB->click();
if (m_bIsWin101803OrGreater) {
ui->forceAcrylicCB->click();
}

View File

@ -55,6 +55,7 @@ public:
bool shouldDrawBorder(const bool ignoreWindowState = false) const;
bool shouldDrawThemedBorder(const bool ignoreWindowState = false) const;
bool shouldDrawThemedTitleBar() const;
QColor activeBorderColor() const;
QColor inactiveBorderColor() const;

BIN
screenshots/win32demo1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
screenshots/win32demo2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
screenshots/win32demo3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

BIN
screenshots/win32demo4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1006 KiB

BIN
screenshots/win32demo5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

BIN
screenshots/win32demo6.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 905 KiB