更改窗口双标题问题

This commit is contained in:
yushuoqi 2022-07-18 16:12:03 +08:00
parent 5f7249c8e6
commit 919329ab00
4 changed files with 47 additions and 22 deletions

View File

@ -983,6 +983,11 @@ void Widget::slotShowMiniWidget()
m_miniWidget->update();
});
if (Global::isWayland) {
kdk::UkuiStyleHelper::self()->removeHeader(this);
kdk::UkuiStyleHelper::self()->removeHeader((QWidget *)m_miniWidget);
}
m_miniWidget->setWindowOpacity(0);
m_miniWidget->showNormal();
m_miniWidget->activateWindow();
@ -1005,21 +1010,27 @@ void Widget::slotClose()
void Widget::slotShowMinimized()
{
this->showMinimized();
if(Minimize == true)
{
this->showMaximized();
if (Global::isWayland) {
kdk::UkuiStyleHelper::self()->removeHeader(this);
kdk::UkuiStyleHelper::self()->removeHeader((QWidget *)m_miniWidget);
}
else
{
this->showMinimized();
if(Minimize == true) {
this->showMaximized();
} else {
this->showNormal();
}
}
void Widget::slotShowMaximized()
{
if(Minimize)
{
if (Global::isWayland) {
kdk::UkuiStyleHelper::self()->removeHeader(this);
kdk::UkuiStyleHelper::self()->removeHeader(m_miniWidget);
}
if(Minimize) {
showNormal();
Minimize = false;
m_titleBar->maximumBtn->setIcon(QIcon::fromTheme("window-maximize-symbolic"));
@ -1027,13 +1038,10 @@ void Widget::slotShowMaximized()
m_titleBar->maximumBtn->setProperty("isWindowButton", 0x1);
m_titleBar->maximumBtn->setProperty("useIconHighlightEffect", 0x2);
m_titleBar->maximumBtn->setFlat(true);
}
else
{
} else {
showMaximized();
Minimize = true;
m_titleBar->maximumBtn->setIcon(QIcon::fromTheme("window-restore-symbolic"));
// maximumBtn->setToolTip(tr("还原"));
m_titleBar->maximumBtn->setToolTip(tr("reduction"));
m_titleBar->maximumBtn->setProperty("isWindowButton", 0x1);
m_titleBar->maximumBtn->setProperty("useIconHighlightEffect", 0x2);
@ -1121,12 +1129,13 @@ void Widget::PlayPause() const
void Widget::slotRecoverNormalWidget()
{
if(Minimize == true)
{
this->showMaximized();
if (Global::isWayland) {
kdk::UkuiStyleHelper::self()->removeHeader(this);
}
else
{
if(Minimize == true) {
this->showMaximized();
} else {
this->showNormal();
}
m_miniWidget->hide();

View File

@ -31,6 +31,10 @@ miniWidget::miniWidget(QWidget *parent) : QFrame(parent)
setFixedSize(300,60);
this->setObjectName("miniWidget");
if (Global::isWayland) {
kdk::UkuiStyleHelper::self()->removeHeader(this);
}
m_mouseState = false;
setWindowFlags(Qt::WindowStaysOnTopHint);
// setWindowFlags(Qt::FramelessWindowHint|Qt::Tool|Qt::WindowStaysOnTopHint);

View File

@ -1,6 +1,9 @@
#include "menumodule.h"
#include "UI/mainwidget.h"
#include "UI/base/xatom-helper.h"
#include "UIControl/global/global.h"
#include "ukuistylehelper/ukuistylehelper.h"
#include "windowmanager/windowmanager.h"
#define PT_14 14
@ -198,11 +201,18 @@ void menuModule::helpAction(){
void menuModule::initAbout(){
aboutWindow->setWindowModality(Qt::ApplicationModal);
aboutWindow->setWindowFlag(Qt::Tool);
if (Global::isWayland) {
kdk::UkuiStyleHelper::self()->removeHeader(aboutWindow);
} else {
MotifWmHints hints;
hints.flags = MWM_HINTS_FUNCTIONS|MWM_HINTS_DECORATIONS;
hints.functions = MWM_FUNC_ALL;
hints.decorations = MWM_DECOR_BORDER;
XAtomHelper::getInstance()->setWindowMotifHint(aboutWindow->winId(), hints);
}
aboutWindow->setFixedSize(420,390);
QVBoxLayout *mainlyt = new QVBoxLayout();
QHBoxLayout *titleLyt = initTitleBar();

2
debian/changelog vendored
View File

@ -3,6 +3,8 @@ kylin-music (1.1.0.47-ok6~0718) yangtze; urgency=medium
* [BUG]
- close-cd: #127037, 解决音乐音量控件显示位置和窗口显示问题
* 其他: 更改窗口双标题问题
-- yushuoqi <yushuoqi@kylinos.cn> Mon, 18 Jul 2022 11:25:08 +0800
kylin-music (1.1.0.47-ok5~0716) yangtze; urgency=medium