fix bug164533 文件对话框有两个标题栏的问题处理

This commit is contained in:
tanjing 2023-04-03 10:51:51 +08:00
parent f9bfc7b891
commit 336414ff80
3 changed files with 26 additions and 12 deletions

View File

@ -15,7 +15,7 @@ TARGET = qt5-ukui-platformtheme
TEMPLATE = lib
CONFIG += plugin
CONFIG += c++11 link_pkgconfig lrelease
PKGCONFIG += gsettings-qt Qt5XdgIconLoader peony fontconfig freetype2
PKGCONFIG += gsettings-qt Qt5XdgIconLoader peony kysdk-waylandhelper fontconfig freetype2
LIBS += -lX11 -lfontconfig -lfreetype
include(../libqt5-ukui-style/libqt5-ukui-style.pri)

View File

@ -5,6 +5,7 @@
#include "kyfiledialogprivate.h"
#include "sidebar.h"
#include "pathbar.h"
#include "ukuistylehelper/ukuistylehelper.h"
#include <peony-qt/controls/directory-view/directory-view-container.h>
#include <peony-qt/controls/menu/directory-view-menu/directory-view-menu.h>
#include <peony-qt/controls/directory-view/directory-view-widget.h>
@ -2470,12 +2471,17 @@ bool KyFileDialogHelper::show(Qt::WindowFlags windowFlags, Qt::WindowModality wi
}
}
MotifWmHints hints;
hints.flags = MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS;
hints.functions = MWM_FUNC_ALL;
hints.decorations = MWM_DECOR_BORDER;
XAtomHelper::getInstance()->setWindowMotifHint(mKyFileDialog->winId(), hints);
QString platform = QGuiApplication::platformName();
if(platform.startsWith(QLatin1String("wayland"),Qt::CaseInsensitive))
{
kdk::UkuiStyleHelper::self()->removeHeader(mKyFileDialog);
} else {
MotifWmHints hints;
hints.flags = MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS;
hints.functions = MWM_FUNC_ALL;
hints.decorations = MWM_DECOR_BORDER;
XAtomHelper::getInstance()->setWindowMotifHint(mKyFileDialog->winId(), hints);
}
mKyFileDialog->delayShow();
return true;
}

View File

@ -32,6 +32,7 @@
#include <QStyleOption>
#include <qpa/qplatformdialoghelper.h>
#include <QtWidgets/qdialogbuttonbox.h>
#include "ukuistylehelper/ukuistylehelper.h"
#include "private/qlabel_p.h"
#include "private/qdialog_p.h"
@ -1479,11 +1480,18 @@ bool MessageBoxHelper::show(Qt::WindowFlags windowFlags, Qt::WindowModality wind
// }
}
*/
MotifWmHints hints;
hints.flags = MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS;
hints.functions = MWM_FUNC_ALL;
hints.decorations = MWM_DECOR_BORDER;
XAtomHelper::getInstance()->setWindowMotifHint(mMessageBox->winId(), hints);
QString platform = QGuiApplication::platformName();
if(platform.startsWith(QLatin1String("wayland"),Qt::CaseInsensitive))
{
kdk::UkuiStyleHelper::self()->removeHeader(mMessageBox);
} else {
MotifWmHints hints;
hints.flags = MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS;
hints.functions = MWM_FUNC_ALL;
hints.decorations = MWM_DECOR_BORDER;
XAtomHelper::getInstance()->setWindowMotifHint(mMessageBox->winId(), hints);
}
foreach (QAbstractButton *ab, mMessageBox->buttons()) {
if (QPushButton *pb = qobject_cast<QPushButton *>(ab)) {