Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package qt5integration for openSUSE:Factory checked in at 2022-09-01 22:10:07 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/qt5integration (Old) and /work/SRC/openSUSE:Factory/.qt5integration.new.2083 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "qt5integration" Thu Sep 1 22:10:07 2022 rev:5 rq:1000240 version:5.5.24 Changes: -------- --- /work/SRC/openSUSE:Factory/qt5integration/qt5integration.changes 2022-03-19 22:23:02.128960444 +0100 +++ /work/SRC/openSUSE:Factory/.qt5integration.new.2083/qt5integration.changes 2022-09-01 22:10:59.664215165 +0200 @@ -1,0 +2,16 @@ +Wed Aug 24 12:14:06 UTC 2022 - Hillwood Yang <[email protected]> + +- Update version to 5.5.24 + * configurable proxy icon engine + * optimize ui + * Fix bugs + +------------------------------------------------------------------- +Sun Jul 3 07:38:53 UTC 2022 - Hillwood Yang <[email protected]> + +- Update version to 5.5.23.1 + * Optimize performance + * Optimize ui + * Fix bugs + +------------------------------------------------------------------- Old: ---- qt5integration-5.5.17.tar.gz New: ---- qt5integration-5.5.24.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ qt5integration.spec ++++++ --- /var/tmp/diff_new_pack.gwJGPA/_old 2022-09-01 22:11:00.128216434 +0200 +++ /var/tmp/diff_new_pack.gwJGPA/_new 2022-09-01 22:11:00.132216445 +0200 @@ -17,7 +17,7 @@ Name: qt5integration -Version: 5.5.17 +Version: 5.5.24 Release: 0 License: GPL-3.0-or-later Summary: Qt platform theme integration plugins ++++++ qt5integration-5.5.17.tar.gz -> qt5integration-5.5.24.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qt5integration-5.5.17/.github/workflows/backup-to-gitlab.yml new/qt5integration-5.5.24/.github/workflows/backup-to-gitlab.yml --- old/qt5integration-5.5.17/.github/workflows/backup-to-gitlab.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/qt5integration-5.5.24/.github/workflows/backup-to-gitlab.yml 2022-07-19 08:56:58.000000000 +0200 @@ -0,0 +1,52 @@ +name: backup to gitlab +on: [push] + +concurrency: + group: ${{ github.workflow }} + cancel-in-progress: true + +jobs: + backup-to-gitlab: + if: github.repository_owner == 'linuxdeepin' + name: backup-to-gitlab + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + repository: "linuxdeepin/jenkins-bridge-client" + path: jenkins-bridge-client + + - name: Install Client + run: | + cd $GITHUB_WORKSPACE/jenkins-bridge-client + go build . + sudo install -Dvm755 jenkins-bridge-client -t /usr/bin/ + - name: Trigger sync + id: generate-runid + run: | + echo "::set-output name=RUN_ID::$(jenkins-bridge-client -triggerSync -token '${{ secrets.BRIDGETOKEN }}')" + - name: Print log + run: | + jenkins-bridge-client -printlog -token "${{ secrets.BRIDGETOKEN }}" -runid "${{ steps.generate-runid.outputs.RUN_ID }}" + + backup-to-gitee: + if: github.repository_owner == 'linuxdeepin' + runs-on: ubuntu-latest + steps: + - name: create-repo + run: | + repo=${{ github.event.repository.name }} + homepage="https://github.com/linuxdeepin/${repo}" + description="mirror of ${homepage}" + # remove '.' prefix + repo=${repo#"."} + curl -X POST --header 'Content-Type: application/json;charset=UTF-8' 'https://gitee.com/api/v5/enterprises/linuxdeepin/repos' -d '{"private": 1,"access_token":"${{ secrets.GITEE_SYNC_TOKEN }}","name":"'"$repo"'","description":"'"$description"'","homepage":"'"$homepage"'","has_issues":"false","has_wiki":"false","can_comment":"false"}' || true + - name: push + run: | + git clone --bare https://github.com/linuxdeepin/${{ github.event.repository.name }}.git .git + repo=${{ github.event.repository.name }} + # remove '.' prefix + repo=${repo#"."} + git remote set-url origin https://myml:${{ secrets.GITEE_SYNC_TOKEN }}@gitee.com/linuxdeepin/${repo}.git + git push -f --all --prune origin + git push --tags origin diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qt5integration-5.5.17/.github/workflows/call-build-deb.yml new/qt5integration-5.5.24/.github/workflows/call-build-deb.yml --- old/qt5integration-5.5.17/.github/workflows/call-build-deb.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/qt5integration-5.5.24/.github/workflows/call-build-deb.yml 2022-07-19 08:56:58.000000000 +0200 @@ -0,0 +1,15 @@ +name: Call build-deb +on: + pull_request_target: + paths-ignore: + - ".github/workflows/**" + +concurrency: + group: ${{ github.workflow }}-pull/${{ github.event.number }} + cancel-in-progress: true + +jobs: + check_job: + uses: linuxdeepin/.github/.github/workflows/build-deb.yml@master + secrets: + BridgeToken: ${{ secrets.BridgeToken }} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qt5integration-5.5.17/.github/workflows/call-build-distribution.yml new/qt5integration-5.5.24/.github/workflows/call-build-distribution.yml --- old/qt5integration-5.5.17/.github/workflows/call-build-distribution.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/qt5integration-5.5.24/.github/workflows/call-build-distribution.yml 2022-07-19 08:56:58.000000000 +0200 @@ -0,0 +1,17 @@ +name: Call build-distribution +on: + push: + paths-ignore: + - ".github/workflows/**" + pull_request_target: + paths-ignore: + - ".github/workflows/**" + +jobs: + check_job: + uses: linuxdeepin/.github/.github/workflows/build-distribution.yml@master + secrets: + BUILD_GPG_PRIVATE_KEY: ${{ secrets.BUILD_GPG_PRIVATE_KEY }} + BUILD_SSH_PRIVATE_KEY: ${{ secrets.BUILD_SSH_PRIVATE_KEY }} + WEBDAV_PASSWD: ${{ secrets.WEBDAV_PASSWD }} + WEBDAV_USER: ${{ secrets.WEBDAV_USER }} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qt5integration-5.5.17/.github/workflows/call-chatOps.yml new/qt5integration-5.5.24/.github/workflows/call-chatOps.yml --- old/qt5integration-5.5.17/.github/workflows/call-chatOps.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/qt5integration-5.5.24/.github/workflows/call-chatOps.yml 2022-07-19 08:56:58.000000000 +0200 @@ -0,0 +1,10 @@ +name: chatOps +on: + issue_comment: + types: [created] + +jobs: + chatopt: + uses: linuxdeepin/.github/.github/workflows/chatOps.yml@master + secrets: + APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qt5integration-5.5.17/.github/workflows/call-clacheck.yml new/qt5integration-5.5.24/.github/workflows/call-clacheck.yml --- old/qt5integration-5.5.17/.github/workflows/call-clacheck.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/qt5integration-5.5.24/.github/workflows/call-clacheck.yml 2022-07-19 08:56:58.000000000 +0200 @@ -0,0 +1,16 @@ +name: Call CLA check +on: + issue_comment: + types: [created] + pull_request_target: + types: [opened, closed, synchronize] + +concurrency: + group: ${{ github.workflow }}-pull/${{ github.event.number }} + cancel-in-progress: true + +jobs: + clacheck: + uses: linuxdeepin/.github/.github/workflows/cla-check.yml@master + secrets: + APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qt5integration-5.5.17/.github/workflows/call-commitlint.yml new/qt5integration-5.5.24/.github/workflows/call-commitlint.yml --- old/qt5integration-5.5.17/.github/workflows/call-commitlint.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/qt5integration-5.5.24/.github/workflows/call-commitlint.yml 2022-07-19 08:56:58.000000000 +0200 @@ -0,0 +1,11 @@ +name: Call commitlint +on: + pull_request_target: + +concurrency: + group: ${{ github.workflow }}-pull/${{ github.event.number }} + cancel-in-progress: true + +jobs: + check_job: + uses: linuxdeepin/.github/.github/workflows/commitlint.yml@master diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qt5integration-5.5.17/.github/workflows/cppcheck.yml new/qt5integration-5.5.24/.github/workflows/cppcheck.yml --- old/qt5integration-5.5.17/.github/workflows/cppcheck.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/qt5integration-5.5.24/.github/workflows/cppcheck.yml 2022-07-19 08:56:58.000000000 +0200 @@ -0,0 +1,26 @@ +name: cppcheck +on: + pull_request_target: + paths-ignore: + - ".github/workflows/**" + +concurrency: + group: ${{ github.workflow }}-pull/${{ github.event.number }} + cancel-in-progress: true + +jobs: + cppchceck: + name: cppcheck + runs-on: ubuntu-latest + steps: + - run: export + - uses: actions/checkout@v2 + with: + ref: ${{ github.event.pull_request.head.sha }} + persist-credentials: false + - uses: linuxdeepin/action-cppcheck@main + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + repository: ${{ github.repository }} + pull_request_id: ${{ github.event.pull_request.number }} + allow_approve: false diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qt5integration-5.5.17/archlinux/PKGBUILD new/qt5integration-5.5.24/archlinux/PKGBUILD --- old/qt5integration-5.5.17/archlinux/PKGBUILD 1970-01-01 01:00:00.000000000 +0100 +++ new/qt5integration-5.5.24/archlinux/PKGBUILD 2022-07-19 08:56:58.000000000 +0200 @@ -0,0 +1,30 @@ +# Maintainer: justforlxz <[email protected]> +pkgname=deepin-qt5integration-git +pkgver=5.1.12.r54.g732a237 +pkgrel=1 +pkgdesc='Qt platform theme integration plugins for DDE' +arch=('x86_64' 'aarch64') +url="https://github.com/linuxdeepin/qt5integration" +license=('GPL3') +depends=('dtkwidget-git' 'libqtxdg' 'deepin-qt5platform-plugins-git') +makedepends=('git' 'qt5-tools' 'xcb-util-renderutil' 'gtest') +conflicts=('deepin-qt5integration') +provides=('deepin-qt5integration') +groups=('deepin-git') +source=('source.tar.gz') +sha512sums=('SKIP') + +prepare() { + cd $deepin_source_name +} + +build() { + cd $deepin_source_name + qmake-qt5 PREFIX=/usr + make +} + +package() { + cd $deepin_source_name + make INSTALL_ROOT="$pkgdir" install +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qt5integration-5.5.17/debian/control new/qt5integration-5.5.24/debian/control --- old/qt5integration-5.5.17/debian/control 2021-12-06 07:39:37.000000000 +0100 +++ new/qt5integration-5.5.24/debian/control 2022-07-19 08:56:58.000000000 +0200 @@ -26,7 +26,8 @@ Package: dde-qt5integration Architecture: any Provides: libqt5deepintheme-plugin -Conflicts: libqt5deepintheme-plugin +Conflicts: libqt5deepintheme-plugin, dde-qt5integration5.5 +Replaces: dde-qt5integration5.5 Depends: ${shlibs:Depends}, ${misc:Depends}, dde-qt5xcb-plugin, dde-qt5integration5 Description: Qt platform theme integration plugin choosers for DDE Multiple Qt plugin choosers for DDE is included. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qt5integration-5.5.17/platformthemeplugin/qdeepinfiledialoghelper.cpp new/qt5integration-5.5.24/platformthemeplugin/qdeepinfiledialoghelper.cpp --- old/qt5integration-5.5.17/platformthemeplugin/qdeepinfiledialoghelper.cpp 2021-12-06 07:39:37.000000000 +0100 +++ new/qt5integration-5.5.24/platformthemeplugin/qdeepinfiledialoghelper.cpp 2022-07-19 08:56:58.000000000 +0200 @@ -29,25 +29,18 @@ #include <QX11Info> #include <QDebug> #include <QApplication> - -#if QT_VERSION < QT_VERSION_CHECK(5, 4, 0) -#include <private/qwidgetwindow_qpa_p.h> -#else -#include <private/qwidgetwindow_p.h> -#endif #include <private/qguiapplication_p.h> #include <X11/Xlib.h> QT_BEGIN_NAMESPACE #define DIALOG_SERVICE "com.deepin.filemanager.filedialog" -#define DIALOG_CALL(Fun) ({if(nativeDialog) nativeDialog->Fun; else qtDialog->Fun;}) QList<QUrl> stringList2UrlList(const QStringList &list) { QList<QUrl> urlList; - for (const QString str : list) + for (const QString &str : list) urlList << str; return urlList; @@ -68,9 +61,9 @@ QDeepinFileDialogHelper::QDeepinFileDialogHelper() { connect(this, &QDeepinFileDialogHelper::accept, this, [this] { - if (sourceDialog && nativeDialog) { - const QMap<QString, QVariant> &map_lineedit = nativeDialog->allCustomWidgetsValue(LineEditType); - const QMap<QString, QVariant> &map_combobox = nativeDialog->allCustomWidgetsValue(ComboBoxType); + if (sourceDialog && filedlgInterface) { + const QMap<QString, QVariant> &map_lineedit = filedlgInterface->allCustomWidgetsValue(LineEditType); + const QMap<QString, QVariant> &map_combobox = filedlgInterface->allCustomWidgetsValue(ComboBoxType); auto map_eidt_begin = map_lineedit.constBegin(); @@ -93,13 +86,39 @@ QDeepinFileDialogHelper::~QDeepinFileDialogHelper() { - DIALOG_CALL(deleteLater()); - if (auxiliaryWindow) auxiliaryWindow->deleteLater(); - if (nativeDialog) - nativeDialog->deleteLater(); + if (filedlgInterface) { + filedlgInterface->deleteLater(); // dbus + filedlgInterface->QObject::deleteLater(); + } +} + +void QDeepinFileDialogHelper::onApplicationStateChanged(Qt::ApplicationState state) +{ + if (state == Qt::ApplicationActive && filedlgInterface) + filedlgInterface->activateWindow(); +} + +void QDeepinFileDialogHelper::onWindowActiveChanged() +{ + if (qApp->platformName() != "dxcb" && !qApp->property("_d_isDxcb").toBool()) + return; + + QWindow *focus_window = qApp->focusWindow(); + if (!focus_window) + return; + + if (focus_window->type() != Qt::Widget + && focus_window->type() != Qt::Window + && focus_window->type() != Qt::Dialog) { + return; + } + + if (filedlgInterface && !filedlgInterface->windowActive() && qApp->applicationState() == Qt::ApplicationActive) { + filedlgInterface->activateWindow(); + } } bool QDeepinFileDialogHelper::show(Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent) @@ -107,15 +126,15 @@ ensureDialog(); applyOptions(); - if (nativeDialog) { + if (filedlgInterface) { if (parent) activeWindow = parent; else activeWindow = QGuiApplication::focusWindow(); - nativeDialog->setParent(parent); + filedlgInterface->setParent(parent); - Qt::WindowFlags nd_flags = static_cast<Qt::WindowFlags>(nativeDialog->windowFlags()); + Qt::WindowFlags nd_flags = static_cast<Qt::WindowFlags>(filedlgInterface->windowFlags()); Qt::WindowFlags need_flags = Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowContextHelpButtonHint | Qt::WindowStaysOnTopHint | Qt::WindowTransparentForInput @@ -123,12 +142,12 @@ | Qt::WindowCloseButtonHint | Qt::BypassWindowManagerHint; if (flags & need_flags) - nativeDialog->setWindowFlags(nd_flags | (flags & need_flags)); + filedlgInterface->setWindowFlags(nd_flags | (flags & need_flags)); static bool i_am_dbus_server = iAmFileDialogDBusServer(); if (i_am_dbus_server) { - WId native_dialog_winId = nativeDialog->winId(); + WId native_dialog_winId = filedlgInterface->winId(); QWindow *real_native_dialog = nullptr; for (QWindow *window : qGuiApp->topLevelWindows()) { @@ -142,7 +161,7 @@ real_native_dialog->setTransientParent(parent); real_native_dialog->setModality(modality); // call later - QMetaObject::invokeMethod(nativeDialog.data(), "show", Qt::QueuedConnection); + QMetaObject::invokeMethod(filedlgInterface.data(), "show", Qt::QueuedConnection); return true; } @@ -156,59 +175,25 @@ QGuiApplicationPrivate::showModalWindow(auxiliaryWindow); if (modality == Qt::ApplicationModal) { - connect(qApp, &QGuiApplication::applicationStateChanged, - this, [this] (Qt::ApplicationState state) { - if (state == Qt::ApplicationActive) - nativeDialog->activateWindow(); - }); - connect(nativeDialog, &DFileDialogHandle::windowActiveChanged, this, [this] { - if (qApp->platformName() != "dxcb" && !qApp->property("_d_isDxcb").toBool()) - return; - - QWindow *focus_window = qApp->focusWindow(); - - if (!focus_window) - return; - - if (focus_window->type() != Qt::Widget - && focus_window->type() != Qt::Window - && focus_window->type() != Qt::Dialog) { - return; - } - - if (!nativeDialog->windowActive() && qApp->applicationState() == Qt::ApplicationActive) { - nativeDialog->activateWindow(); - } - }); + connect(qApp, &QGuiApplication::applicationStateChanged, this, &QDeepinFileDialogHelper::onApplicationStateChanged); + connect(filedlgInterface, &DFileDialogHandle::windowActiveChanged, this, &QDeepinFileDialogHelper::onWindowActiveChanged); } } - } else { - qtDialog->setAttribute(Qt::WA_NativeWindow); - - if (parent) { - if (parent->inherits("QWidgetWindow")) { - qtDialog->setParent(static_cast<QWidgetWindow*>(parent)->widget()); - } else { - qtDialog->windowHandle()->setParent(parent); - } - } - - qtDialog->setWindowModality(modality); - qtDialog->setWindowFlags(flags | qtDialog->windowFlags()); } - DIALOG_CALL(show()); + if (filedlgInterface) + filedlgInterface->show(); - if (nativeDialog && parent) { + if (filedlgInterface && parent) { // ??????????????????wayland??????display ?????? XSetTransientForHint(wayland_dispaly // ??????????????????????????????????????????????????????task-view-31919. if (qApp->platformName() != "dxcb" && !qApp->property("_d_isDxcb").toBool()) return true; - XSetTransientForHint(QX11Info::display(), nativeDialog->winId(), parent->winId()); + XSetTransientForHint(QX11Info::display(), filedlgInterface->winId(), parent->winId()); } - - return true; + // ????????????dbus?????? return false ???????????????????????????????????????????????? + return filedlgInterface; } void QDeepinFileDialogHelper::exec() @@ -217,22 +202,16 @@ ensureDialog(); - if (nativeDialog) { - // block input to the window, allow input to other GTK dialogs - QEventLoop loop; - connect(this, SIGNAL(accept()), &loop, SLOT(quit())); - connect(this, SIGNAL(reject()), &loop, SLOT(quit())); - loop.exec(); - } else { - QWindow *modalWindow = qApp->modalWindow(); - - if (Q_LIKELY(modalWindow->inherits("QWidgetWindow") - && qobject_cast<QFileDialog*>(static_cast<QWidgetWindow*>(modalWindow)->widget()))) { - QGuiApplicationPrivate::hideModalWindow(modalWindow); - } - - qtDialog->exec(); - } + // ????????????????????????????????????????????????????????? show ?????????,????????? show + // ??????exec????????????????????? + if (filedlgInterface) + filedlgInterface->show(); + + // block input to the window, allow input to other GTK dialogs + QEventLoop loop; + connect(this, SIGNAL(accept()), &loop, SLOT(quit())); + connect(this, SIGNAL(reject()), &loop, SLOT(quit())); + loop.exec(); } void QDeepinFileDialogHelper::hide() @@ -241,7 +220,8 @@ ensureDialog(); - DIALOG_CALL(hide()); + if (filedlgInterface) + filedlgInterface->hide(); if (auxiliaryWindow) { QGuiApplicationPrivate::hideModalWindow(auxiliaryWindow); @@ -270,7 +250,10 @@ ensureDialog(); - DIALOG_CALL(setDirectoryUrl(directory.toString())); + if (filedlgInterface) + filedlgInterface->setDirectoryUrl(directory.toString()); + else + options()->setInitialDirectory(directory); } QUrl QDeepinFileDialogHelper::directory() const @@ -279,10 +262,10 @@ ensureDialog(); - if (nativeDialog) - return QUrl(nativeDialog->directoryUrl()); + if (filedlgInterface) + return QUrl(filedlgInterface->directoryUrl()); - return qtDialog->directoryUrl(); + return options()->initialDirectory(); } void QDeepinFileDialogHelper::selectFile(const QUrl &fileUrl) @@ -291,10 +274,10 @@ ensureDialog(); - if (nativeDialog) - nativeDialog->selectUrl(fileUrl.toString()); + if (filedlgInterface) + filedlgInterface->selectUrl(fileUrl.toString()); else - qtDialog->selectUrl(fileUrl); + options()->setInitiallySelectedFiles({fileUrl}); } QList<QUrl> QDeepinFileDialogHelper::selectedFiles() const @@ -303,10 +286,10 @@ ensureDialog(); - if (nativeDialog) - return stringList2UrlList(nativeDialog->selectedUrls()); + if (filedlgInterface) + return stringList2UrlList(filedlgInterface->selectedUrls()); - return qtDialog->selectedUrls(); + return options()->initiallySelectedFiles(); } void QDeepinFileDialogHelper::setFilter() @@ -315,7 +298,8 @@ ensureDialog(); - DIALOG_CALL(setFilter(options()->filter())); + if (filedlgInterface) + filedlgInterface->setFilter(options()->filter()); } void QDeepinFileDialogHelper::selectNameFilter(const QString &filter) @@ -324,7 +308,10 @@ ensureDialog(); - DIALOG_CALL(selectNameFilter(filter)); + if (filedlgInterface) + filedlgInterface->selectNameFilter(filter); + else + options()->setInitiallySelectedNameFilter(filter); } QString QDeepinFileDialogHelper::selectedNameFilter() const @@ -333,10 +320,10 @@ ensureDialog(); - if (nativeDialog) - return nativeDialog->selectedNameFilter(); + if (filedlgInterface) + return filedlgInterface->selectedNameFilter(); - return qtDialog->selectedNameFilter(); + return options()->initiallySelectedNameFilter(); } void QDeepinFileDialogHelper::initDBusFileDialogManager() @@ -359,7 +346,7 @@ void QDeepinFileDialogHelper::ensureDialog() const { - if (nativeDialog || qtDialog) + if (filedlgInterface) return; if (manager) { @@ -370,20 +357,30 @@ if (path.isEmpty()) { qWarning("Can not create native dialog, Will be use QFileDialog"); } else { - nativeDialog = new DFileDialogHandle(DIALOG_SERVICE, path, QDBusConnection::sessionBus()); + filedlgInterface = new DFileDialogHandle(DIALOG_SERVICE, path, QDBusConnection::sessionBus()); auxiliaryWindow = new QWindow(); + auxiliaryWindow->setObjectName("QDeepinFileDialogHelper_auxiliaryWindow"); + + connect(filedlgInterface, &QObject::destroyed, auxiliaryWindow, &QWindow::deleteLater); + connect(filedlgInterface, &QObject::destroyed, filedlgInterface, &DFileDialogHandle::deleteLater); + connect(filedlgInterface, &DFileDialogHandle::accepted, this, &QDeepinFileDialogHelper::accept); + connect(filedlgInterface, &DFileDialogHandle::rejected, this, &QDeepinFileDialogHelper::reject); + connect(filedlgInterface, &DFileDialogHandle::destroyed, this, &QDeepinFileDialogHelper::reject); + connect(filedlgInterface, &DFileDialogHandle::destroyed, this, [this](){ + qWarning("filedialog dbus service destroyed."); + if (filedlgInterface) { + filedlgInterface->QObject::deleteLater(); + filedlgInterface = nullptr; + } - connect(nativeDialog, &QObject::destroyed, auxiliaryWindow, &QWindow::deleteLater); - connect(nativeDialog, &QObject::destroyed, nativeDialog, &DFileDialogHandle::deleteLater); - connect(nativeDialog, &DFileDialogHandle::destroyed, nativeDialog, &QObject::deleteLater); - connect(nativeDialog, &DFileDialogHandle::accepted, this, &QDeepinFileDialogHelper::accept); - connect(nativeDialog, &DFileDialogHandle::rejected, this, &QDeepinFileDialogHelper::reject); - connect(nativeDialog, &DFileDialogHandle::destroyed, this, &QDeepinFileDialogHelper::reject); + if (auxiliaryWindow && auxiliaryWindow->isModal() && qApp->modalWindow() == auxiliaryWindow) + QGuiApplicationPrivate::hideModalWindow(auxiliaryWindow); + }); - QTimer *heartbeatTimer = new QTimer(nativeDialog); + QTimer *heartbeatTimer = new QTimer(filedlgInterface); connect(heartbeatTimer, &QTimer::timeout, this, [this, heartbeatTimer] { - QDBusPendingReply<> reply = nativeDialog->makeHeartbeat(); + QDBusPendingReply<> reply = filedlgInterface->makeHeartbeat(); reply.waitForFinished(); @@ -397,23 +394,18 @@ return; } - nativeDialog->QObject::deleteLater(); + filedlgInterface->QObject::deleteLater(); const_cast<QDeepinFileDialogHelper*>(this)->reject(); } }); - int heartbeatInterval = nativeDialog->heartbeatInterval(); + int heartbeatInterval = filedlgInterface->heartbeatInterval(); heartbeatTimer->setInterval(qMax(1 * 1000, qMin(int(heartbeatInterval / 1.5), heartbeatInterval - 5 * 1000))); heartbeatTimer->start(); } } - if (!nativeDialog && qobject_cast<QApplication*>(qGuiApp)) { + if (!filedlgInterface && qobject_cast<QApplication*>(qGuiApp)) { QDeepinTheme::m_usePlatformNativeDialog = false; - qtDialog = new QFileDialog(); - QDeepinTheme::m_usePlatformNativeDialog = true; - - connect(qtDialog, &QFileDialog::accepted, this, &QDeepinFileDialogHelper::accept); - connect(qtDialog, &QFileDialog::rejected, this, &QDeepinFileDialogHelper::reject); } } @@ -423,20 +415,23 @@ for (int i = 0; i < QFileDialogOptions::DialogLabelCount; ++i) { if (options->isLabelExplicitlySet((QFileDialogOptions::DialogLabel)i)) { - if (nativeDialog) - nativeDialog->setLabelText(i, options->labelText((QFileDialogOptions::DialogLabel)i)); + if (filedlgInterface) + filedlgInterface->setLabelText(i, options->labelText((QFileDialogOptions::DialogLabel)i)); else - qtDialog->setLabelText((QFileDialog::DialogLabel)i, options->labelText((QFileDialogOptions::DialogLabel)i)); + qWarning() << "DFileDialogHandle invalid!!"; + } } + if (filedlgInterface) { + filedlgInterface->setOptions(int(options->options())); + filedlgInterface->setFilter(int(options->filter())); + filedlgInterface->setWindowTitle(options->windowTitle()); + filedlgInterface->setViewMode(int(options->viewMode())); + filedlgInterface->setFileMode(int(options->fileMode())); + filedlgInterface->setAcceptMode(int(options->acceptMode())); + filedlgInterface->setNameFilters(options->nameFilters()); + } - DIALOG_CALL(setOptions((QFileDialog::Options)(int)options->options())); - DIALOG_CALL(setFilter(options->filter())); - DIALOG_CALL(setWindowTitle(options->windowTitle())); - DIALOG_CALL(setViewMode((QFileDialog::ViewMode)options->viewMode())); - DIALOG_CALL(setFileMode((QFileDialog::FileMode)options->fileMode())); - DIALOG_CALL(setAcceptMode((QFileDialog::AcceptMode)options->acceptMode())); - DIALOG_CALL(setNameFilters(options->nameFilters())); if (options->initialDirectory().isLocalFile()) setDirectory(options->initialDirectory()); @@ -447,25 +442,25 @@ selectNameFilter(options->initiallySelectedNameFilter()); if (!sourceDialog) { - sourceDialog = reinterpret_cast<QFileDialog*>(qvariant_cast<quintptr>(property("_dtk_widget_QFileDialog"))); + sourceDialog = reinterpret_cast<QObject*>(qvariant_cast<quintptr>(property("_dtk_widget_QFileDialog"))); - if (sourceDialog && nativeDialog) { + if (sourceDialog && filedlgInterface) { const QStringList lineedit_list = sourceDialog->property("_dtk_widget_custom_lineedit_list").toStringList(); const QStringList combobox_list = sourceDialog->property("_dtk_widget_custom_combobox_list").toStringList(); - nativeDialog->beginAddCustomWidget(); + filedlgInterface->beginAddCustomWidget(); for (const QString &i : lineedit_list) - nativeDialog->addCustomWidget(LineEditType, i); + filedlgInterface->addCustomWidget(LineEditType, i); for (const QString &i : combobox_list) - nativeDialog->addCustomWidget(ComboBoxType, i); + filedlgInterface->addCustomWidget(ComboBoxType, i); - nativeDialog->endAddCustomWidget(); + filedlgInterface->endAddCustomWidget(); const QVariant & mixedSelection = sourceDialog->property("_dtk_widget_filedialog_mixed_selection"); if (mixedSelection.isValid()) { - nativeDialog->setAllowMixedSelection(mixedSelection.toBool()); + filedlgInterface->setAllowMixedSelection(mixedSelection.toBool()); } } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qt5integration-5.5.17/platformthemeplugin/qdeepinfiledialoghelper.h new/qt5integration-5.5.24/platformthemeplugin/qdeepinfiledialoghelper.h --- old/qt5integration-5.5.17/platformthemeplugin/qdeepinfiledialoghelper.h 2021-12-06 07:39:37.000000000 +0100 +++ new/qt5integration-5.5.24/platformthemeplugin/qdeepinfiledialoghelper.h 2022-07-19 08:56:58.000000000 +0200 @@ -24,7 +24,6 @@ QT_BEGIN_NAMESPACE -class QFileDialog; class ComDeepinFilemanagerFiledialogInterface; typedef ComDeepinFilemanagerFiledialogInterface DFileDialogHandle; class ComDeepinFilemanagerFiledialogmanagerInterface; @@ -55,13 +54,14 @@ static void initDBusFileDialogManager(); static bool iAmFileDialogDBusServer(); - +protected: + void onApplicationStateChanged(Qt::ApplicationState state); + void onWindowActiveChanged(); private: - mutable QPointer<DFileDialogHandle> nativeDialog; + mutable QPointer<DFileDialogHandle> filedlgInterface; mutable QPointer<QWindow> auxiliaryWindow; - mutable QPointer<QFileDialog> qtDialog; QPointer<QWindow> activeWindow; - QPointer<QFileDialog> sourceDialog; + QPointer<QObject> sourceDialog; static DFileDialogManager *manager; void ensureDialog() const; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qt5integration-5.5.17/platformthemeplugin/qdeepintheme.cpp new/qt5integration-5.5.24/platformthemeplugin/qdeepintheme.cpp --- old/qt5integration-5.5.17/platformthemeplugin/qdeepintheme.cpp 2021-12-06 07:39:37.000000000 +0100 +++ new/qt5integration-5.5.24/platformthemeplugin/qdeepintheme.cpp 2022-07-19 08:56:58.000000000 +0200 @@ -506,9 +506,17 @@ return plugin ? plugin->create(iconName) : nullptr; } +inline QString dgetenv(const char * varname, const QString & defaultValue) { + if (Q_UNLIKELY(qEnvironmentVariableIsSet(varname))) { + return qgetenv(varname); + } + + return defaultValue; +} + static QIconEngine *createXdgProxyIconEngine(const QString &iconName) { - static QIconEnginePlugin *plugin = getIconEngineFactory(QStringLiteral("XdgIconProxyEngine")); + static QIconEnginePlugin *plugin = getIconEngineFactory(dgetenv("D_PROXY_ICON_ENGINE", QStringLiteral("XdgIconProxyEngine"))); return plugin ? plugin->create(iconName) : nullptr; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qt5integration-5.5.17/platformthemeplugin/qt5deepintheme-plugin.pro new/qt5integration-5.5.24/platformthemeplugin/qt5deepintheme-plugin.pro --- old/qt5integration-5.5.17/platformthemeplugin/qt5deepintheme-plugin.pro 2021-12-06 07:39:37.000000000 +0100 +++ new/qt5integration-5.5.24/platformthemeplugin/qt5deepintheme-plugin.pro 2022-07-19 08:56:58.000000000 +0200 @@ -6,7 +6,6 @@ QT += dbus x11extras dtkgui$${DTK_VERSION} QT += core-private gui-private greaterThan(QT_MAJOR_VERSION, 4) { - QT += widgets widgets-private # Qt >= 5.8 greaterThan(QT_MAJOR_VERSION, 5)|greaterThan(QT_MINOR_VERSION, 7): QT += theme_support-private else: QT += platformsupport-private diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qt5integration-5.5.17/qt5integration.pro new/qt5integration-5.5.24/qt5integration.pro --- old/qt5integration-5.5.17/qt5integration.pro 2021-12-06 07:39:37.000000000 +0100 +++ new/qt5integration-5.5.24/qt5integration.pro 2022-07-19 08:56:58.000000000 +0200 @@ -1,12 +1,15 @@ TEMPLATE = subdirs SUBDIRS += \ - src \ styleplugins\ platformthemeplugin/qt5deepintheme-plugin.pro \ iconengineplugins/iconengines.pro \ imageformatplugins/imageformats.pro \ tests +!isEmpty(BASED_DTK_DIR) { + SUBDIRS += src +} + CONFIG(debug, debug|release) { SUBDIRS += styles styles.depends += styleplugins diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qt5integration-5.5.17/src/dpluginloader.h new/qt5integration-5.5.24/src/dpluginloader.h --- old/qt5integration-5.5.17/src/dpluginloader.h 2021-12-06 07:39:37.000000000 +0100 +++ new/qt5integration-5.5.24/src/dpluginloader.h 2022-07-19 08:56:58.000000000 +0200 @@ -112,7 +112,7 @@ QRegularExpressionMatch rem = reg.match(versionStr); if (rem.hasMatch()) pluginName += rem.captured(); - else + else if (!versionStr.isEmpty()) qCDebug(lcDPlugin) << versionStr << "is invalid"; } else { qCDebug(lcDPlugin) << VERSION_STR_SYMBOL << "resolve failed, trying to read self maps"; @@ -155,7 +155,7 @@ pluginLoader.unload(); } } else { - qCWarning(lcDPlugin) << pluginLoader.errorString(); + qCCritical(lcDPlugin) << pluginLoader.errorString() << realTargetPath << "loaded failed"; } return infc; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qt5integration-5.5.17/src/platformthemes/platformthemechooser/platformthemechooser.pro new/qt5integration-5.5.24/src/platformthemes/platformthemechooser/platformthemechooser.pro --- old/qt5integration-5.5.17/src/platformthemes/platformthemechooser/platformthemechooser.pro 2021-12-06 07:39:37.000000000 +0100 +++ new/qt5integration-5.5.24/src/platformthemes/platformthemechooser/platformthemechooser.pro 2022-07-19 08:56:58.000000000 +0200 @@ -1,5 +1,5 @@ greaterThan(QT_MAJOR_VERSION, 4) { - QT += widgets widgets-private + QT += gui-private } LIBS += -ldl diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qt5integration-5.5.17/styleplugins/chameleon/chameleonstyle.cpp new/qt5integration-5.5.24/styleplugins/chameleon/chameleonstyle.cpp --- old/qt5integration-5.5.17/styleplugins/chameleon/chameleonstyle.cpp 2021-12-06 07:39:37.000000000 +0100 +++ new/qt5integration-5.5.24/styleplugins/chameleon/chameleonstyle.cpp 2022-07-19 08:56:58.000000000 +0200 @@ -27,6 +27,7 @@ #include <DPlatformWindowHandle> #include <DApplicationHelper> #include <DWindowManagerHelper> +#include <DPlatformTheme> #include <DSlider> #include <DTabBar> #include <DSearchEdit> @@ -83,6 +84,20 @@ || shape == QTabBar::TriangularEast; } +static QWidget *getSbarParentWidget(QScrollBar *sbar) +{ + if (!sbar) + return nullptr; + QWidget *pw = sbar->parentWidget(); + if (!pw) + return nullptr; + + bool isContainer = !pw->objectName().compare(QLatin1String("qt_scrollarea_vcontainer")) || + !pw->objectName().compare(QLatin1String("qt_scrollarea_hcontainer")) ; + + return isContainer ? pw->parentWidget() : pw; +} + ChameleonStyle::ChameleonStyle() : DStyle() { @@ -507,13 +522,8 @@ return; } case PE_PanelItemViewRow: { - //????????????Saturday???Sunday??????????????????????????? + // ??????????????????item???????????????????????????????????? if (w && qobject_cast<QCalendarWidget *>(w->parentWidget())) { - QTextCharFormat fmt; - QCalendarWidget *calend = qobject_cast<QCalendarWidget *>(w->parentWidget()); - fmt.setForeground(QBrush(getColor(opt, DPalette::Highlight))); - calend->setWeekdayTextFormat(Qt::Saturday, fmt); - calend->setWeekdayTextFormat(Qt::Sunday, fmt); return; } //??????QTreeView??????????????????QCommonStyle????????????????????????????????????,hover????????? @@ -594,7 +604,7 @@ return false; // ScrollBarAlwaysOn ??????????????????????????? - QAbstractScrollArea *sa = qobject_cast<QAbstractScrollArea *>(sbar->parentWidget()); + QAbstractScrollArea *sa = qobject_cast<QAbstractScrollArea *>(getSbarParentWidget(sbar)); if (sa) { const QScrollBar *hsb = sa->horizontalScrollBar(); const bool hsbAlwaysOn = sa->horizontalScrollBarPolicy() == Qt::ScrollBarAlwaysOn; @@ -612,8 +622,10 @@ styleAnimation = new dstyle::DScrollbarStyleAnimation(dstyle::DScrollbarStyleAnimation::Deactivating, sbar); styleAnimation->setDeletePolicy(QAbstractAnimation::KeepWhenStopped); - // ???????????????????????? - this->startAnimation(styleAnimation); + connect(styleAnimation, &dstyle::DStyleAnimation::destroyed, + this, &ChameleonStyle::_q_removeAnimation, Qt::UniqueConnection); + + animations.insert(styleAnimation->target(), styleAnimation); // ????????????????????????????????????????????????????????????????????? QObject::connect(sbar, &QAbstractSlider::valueChanged, styleAnimation, &dstyle::DScrollbarStyleAnimation::restart); @@ -650,12 +662,6 @@ sbar->setProperty("_d_dtk_slider_visible", on); } -static bool isContainer (QWidget *w) -{ - return !w->objectName().compare(QLatin1String("qt_scrollarea_vcontainer")) || - !w->objectName().compare(QLatin1String("qt_scrollarea_hcontainer")) ; -} - bool ChameleonStyle::eventFilter(QObject *watched, QEvent *event) { QScrollBar *sbar = qobject_cast<QScrollBar *>(watched); @@ -669,31 +675,42 @@ bool on = sbar->property("_d_dtk_slider_visible").toBool(); // ????????????????????????????????? parent - QWidget *p = sbar->parentWidget(); - QWidget *pp = isContainer(p) ? p->parentWidget() : p; - - // ?????? QAbstractItemView ?????? item ????????? viewport ??? - QAbstractItemView *itemView = qobject_cast<QAbstractItemView *>(pp); + QWidget *pp = getSbarParentWidget(sbar); + // ?????? QAbstractScrollArea ?????? item ????????? viewport ??? + QAbstractScrollArea *itemView = qobject_cast<QAbstractScrollArea *>(pp); pp = itemView ? itemView->viewport() : pp; if (!pp) return false; - // scrollbar right click + // (`(!cme && !me)` is True) && (`cme` is False) ==> `me` is True, `me` can't be False. + const QPoint viewportPos = pp->mapFromGlobal(cme ? cme->globalPos() : me->globalPos()); + QWidget *target = pp; + QPoint localPos = viewportPos; + if (qobject_cast<QScrollArea *>(itemView)) { + if (target = pp->childAt(viewportPos)) { + localPos = target->mapFrom(pp, viewportPos); + } + } + // scrollbar right click if (cme) { - QContextMenuEvent menuEvent(cme->reason(), pp->mapFromGlobal(cme->globalPos()), cme->globalPos(), cme->modifiers()); - return !on ? false : QApplication::sendEvent(pp, &menuEvent); + if (target) { + QContextMenuEvent menuEvent(cme->reason(), localPos, cme->globalPos(), cme->modifiers()); + return !on ? false : QApplication::sendEvent(target, &menuEvent); + } } else { // ???????????????????????????????????????(??????)?????? if (!me || !on) return false; - QMouseEvent mevent = *me; - mevent.setLocalPos(pp->mapFromGlobal(mevent.globalPos())); - - // ?????????????????????????????? widget - return QApplication::sendEvent(pp, &mevent); + if (target) { + QMouseEvent mevent = *me; + mevent.setLocalPos(localPos); + // ?????????????????????????????? widget + return QApplication::sendEvent(target, &mevent); + } } + return false; } void ChameleonStyle::drawControl(QStyle::ControlElement element, const QStyleOption *opt, @@ -1420,6 +1437,41 @@ if (toolbutton->state & (State_MouseOver | State_Sunken)) //hover?????? ???press?????? p->setBrush(getBrush(toolbutton, DPalette::Button)); + // ???????????? + if (toolbutton->state & State_Enabled) { + if ((toolbutton->features & QStyleOptionToolButton::MenuButtonPopup) && + (toolbutton->state & (QStyle::State_MouseOver | QStyle::State_Sunken))) { + + // ????????????????????? + int menuButtonIndicatorMargin = 4; + auto btn = *toolbutton; + if (btn.state & (QStyle::State_MouseOver)) + btn.state &= ~ QStyle::State_MouseOver; + if (btn.state & (QStyle::State_Sunken)) + btn.state &= ~ QStyle::State_Sunken; + p->setPen(getColor(&btn, DPalette::Button)); + p->setBrush(getBrush(&btn, DPalette::Button)); + QRect tmp = rect; + tmp.adjust(0, 0, proxy()->pixelMetric(PM_MenuButtonIndicator, toolbutton, w) + 2 * menuButtonIndicatorMargin, 0); + p->drawRoundedRect(tmp, radius, radius); + + // ???????????????????????? + p->setPen(getColor(toolbutton, DPalette::Button)); + p->setBrush(getBrush(toolbutton, DPalette::Button)); + if (toolbutton->activeSubControls & QStyle::SC_ToolButton) { + DDrawUtils::drawRoundedRect(p, rect, radius, radius, + DDrawUtils::TopLeftCorner | DDrawUtils::BottomLeftCorner); + } else if (toolbutton->activeSubControls & QStyle::SC_ToolButtonMenu) { + QRect r = rect; + r.adjust(r.width(), 0, proxy()->pixelMetric(PM_MenuButtonIndicator , toolbutton, w) + 2 * menuButtonIndicatorMargin, 0); + DDrawUtils::drawRoundedRect(p, r, radius, radius, + DDrawUtils::TopRightCorner | DDrawUtils::BottomRightCorner); + } + } else { + p->drawRoundedRect(rect, radius, radius); + } + } + // Arrow type always overrules and is always shown bool hasArrow = toolbutton->features & QStyleOptionToolButton::Arrow; if (((!hasArrow && toolbutton->icon.isNull()) && !toolbutton->text.isEmpty()) @@ -1428,8 +1480,6 @@ if (!proxy()->styleHint(SH_UnderlineShortcut, opt, w)) alignment |= Qt::TextHideMnemonic; p->setFont(toolbutton->font); - p->drawRoundedRect(rect, radius, radius); - if (toolbutton->state & State_On) { p->setPen(getColor(toolbutton, DPalette::Highlight)); } else { @@ -1459,7 +1509,6 @@ break; } - int radius = DStyle::pixelMetric(PM_FrameRadius, opt, w); //?????????icon???text??????,?????????????????????????????????????????? p->setRenderHint(QPainter::Antialiasing); p->setPen(Qt::NoPen); p->setBrush(Qt::NoBrush); @@ -1475,8 +1524,7 @@ p->setBrush(getColor(toolbutton, DPalette::Button)); } - if (toolbutton->state & State_Enabled) - p->drawRoundedRect(rect, radius, radius); + // pr?????????????????? QRect pr = rect; @@ -1547,6 +1595,10 @@ p->drawText(tr, alignment, toolbutton->text); } else { //?????????icon?????? + if (toolbutton->features & QStyleOptionToolButton::HasMenu && + !(toolbutton->features & QStyleOptionToolButton::MenuButtonPopup)) { + rect.adjust(0, 0, - (proxy()->pixelMetric(PM_MenuButtonIndicator , toolbutton, w) + 4), 0); + } pr.moveCenter(rect.center()); drawIcon(toolbutton, p, pr, icon); } @@ -2237,11 +2289,22 @@ painter->setPen(Qt::NoPen); painter->setRenderHint(QPainter::Antialiasing); - if (comboBox->editable) - painter->setBrush(getThemTypeColor(QColor(0, 0, 0, 255* 0.08), - QColor(255, 255, 255, 255 * 0.15))); - else + if (comboBox->editable) { + QBrush brush = getThemTypeColor(QColor(0, 0, 0, 255 * 0.08), + QColor(255, 255, 255, 255 * 0.15)); + if (widget->testAttribute(Qt::WA_SetPalette)) { + brush = comboBox->palette.button(); + } else if (const QComboBox *combobox = qobject_cast<const QComboBox *>(widget)) { + if (auto lineEdit = combobox->lineEdit()) { + if (lineEdit->testAttribute(Qt::WA_SetPalette)) { + brush = lineEdit->palette().button(); + } + } + } + painter->setBrush(brush); + } else { painter->setBrush(Qt::transparent); + } DDrawUtils::drawRoundedRect(painter, comboBoxCopy.rect, frameRadius, frameRadius, DDrawUtils::Corner::TopLeftCorner @@ -2362,8 +2425,9 @@ const int contentLeftPadding = flat ? (contentsRect.width() - contentsWidth) / 2 : Metrics::ComboBox_ContentLeftMargin; iconRect = QRect(QPoint(contentsRect.left() + contentLeftPadding, contentsRect.top() + (contentsRect.height() - iconSize.height()) / 2), iconSize); + const int availableTextWidth = contentsRect.width() - contentLeftPadding - iconSize.width() - Metrics::Icon_Margins - downArrowRect.width(); textRect = QRect(QPoint(iconRect.right() + Metrics::Icon_Margins + 1, - contentsRect.top() + (contentsRect.height() - textSize.height()) / 2), textSize); + contentsRect.top() + (contentsRect.height() - textSize.height()) / 2), QSize(availableTextWidth, textSize.height())); } // handle right to left @@ -2888,7 +2952,7 @@ int xpos = menuRect.x(); //1.???????????? 2.????????????????????? ???xpos???????????????????????? if (iconSize.width() > 0) { - xpos += realMargins + smallIconSize + frameRadius; + xpos += realMargins + frameRadius + iconSize.width(); } else { xpos += realMargins; } @@ -3128,8 +3192,14 @@ mflags |= State_Sunken; } + + int menuButtonIndicatorMargin = 4; // ????????????????????? QStyleOption tool = *toolbutton; - if (toolbutton->subControls & SC_ToolButton) { + if (toolbutton->features & QStyleOptionToolButton::MenuButtonPopup) { + if (w && !w->property("_d_calendarToolBtn").toBool()) { + button.adjust(0, 0, -2 * menuButtonIndicatorMargin, 0); + menuarea.adjust(-2 * menuButtonIndicatorMargin, 0, 0, 0); + } if (bflags & (State_Sunken | State_On | State_Raised)) { tool.rect = button; tool.state = bflags; @@ -3145,7 +3215,6 @@ if (w && w->property("_d_calendarToolBtn").toBool()) { label.palette = DGuiApplicationHelper::instance()->applicationPalette(); } - proxy()->drawControl(CE_ToolButtonLabel, &label, p, w); if (toolbutton->state & State_HasFocus) { @@ -3154,29 +3223,33 @@ //fr.rect.adjust(3, 3, -3, -3); if (toolbutton->features & QStyleOptionToolButton::MenuButtonPopup) fr.rect.adjust(0, 0, -proxy()->pixelMetric(QStyle::PM_MenuButtonIndicator, - toolbutton, w), 0); + toolbutton , w) - 2 * menuButtonIndicatorMargin, 0); proxy()->drawPrimitive(PE_FrameFocusRect, &fr, p, w); } if (toolbutton->subControls & SC_ToolButtonMenu) { tool.rect = menuarea; tool.state = mflags; - if (mflags & (State_Sunken | State_On | State_Raised)) - proxy()->drawPrimitive(PE_IndicatorButtonDropDown, &tool, p, w); + tool.rect.adjust(menuButtonIndicatorMargin, 0, -menuButtonIndicatorMargin, 0); + if ((toolbutton->state & (QStyle::State_Sunken)) && (toolbutton->activeSubControls & QStyle::SC_ToolButton)) { + p->setPen(Qt::NoPen); + } + if((toolbutton->state & (QStyle::State_Sunken)) && toolbutton->activeSubControls & QStyle::SC_ToolButtonMenu) { + p->setPen(getColor(toolbutton, DPalette::Highlight)); + } proxy()->drawPrimitive(PE_IndicatorArrowDown, &tool, p, w); } else if (toolbutton->features & QStyleOptionToolButton::HasMenu) { int mbi = proxy()->pixelMetric(PM_MenuButtonIndicator, toolbutton, w); QRect ir = toolbutton->rect; QStyleOptionToolButton newBtn = *toolbutton; - newBtn.rect = QRect(ir.right() + 5 - mbi, ir.y() + ir.height() - mbi + 4, mbi - 6, mbi - 6); + newBtn.rect = QRect(ir.right() - mbi - menuButtonIndicatorMargin, (ir.height() - mbi) / 2, mbi, mbi); newBtn.rect = visualRect(toolbutton->direction, button, newBtn.rect); //DelayedPopup ????????????????????????, ??????????????? ????????????????????? - if (toolbutton->features & QStyleOptionToolButton::PopupDelay || (w && w->objectName() == "qt_calendar_monthbutton")) { + if (w && w->objectName() == "qt_calendar_monthbutton") { newBtn.rect = QRect(ir.right() + 5 - mbi, ir.y() + ir.height() / 2, mbi - 4, mbi - 4); newBtn.rect = visualRect(toolbutton->direction, button, newBtn.rect); } - proxy()->drawPrimitive(PE_IndicatorArrowDown, &newBtn, p, w); } @@ -3883,7 +3956,7 @@ m_width += (textWidth + frameRadius); if (!menuItem->icon.isNull()) - m_width += (smallIconSize + + frameRadius); + m_width += (smallIconSize + frameRadius); m_width += (smallIconSize + frameRadius); size.setWidth(m_width); @@ -3923,7 +3996,21 @@ } case CT_ToolButton: { qreal radius = DStyle::pixelMetric(DStyle::PM_FrameRadius); - return QSize(size.width() + radius, size.height() + radius); + if (widget && widget->property("_d_calendarToolBtn").toBool()) { + return QSize(size.width() + radius, size.height() + radius); + } + int fw = proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget); + int menuButtonIndicatorWidth = 0; + if (const QStyleOptionToolButton *toolbutton + = qstyleoption_cast<const QStyleOptionToolButton *>(opt)) { + if ((toolbutton->features & QStyleOptionToolButton::HasMenu) && + (!(toolbutton->features & QStyleOptionToolButton::MenuButtonPopup))) { + menuButtonIndicatorWidth = proxy()->pixelMetric(QStyle::PM_MenuButtonIndicator, opt, widget); + } + } + int menuButtonIndicatorMargin = 4; + return QSize(size.width() + radius + 2 * menuButtonIndicatorMargin + 2 * fw + menuButtonIndicatorWidth, + size.height() + radius + 2 * fw); } case CT_ProgressBar: { if (const QStyleOptionProgressBar *pbo = qstyleoption_cast<const QStyleOptionProgressBar*>(opt)) { @@ -3994,7 +4081,7 @@ //?????????????????? menu border ??? 1 return DWindowManagerHelper::instance()->hasComposite() ? 0 : 1; case PM_SubMenuOverlap: - return -1; + return 0; case PM_ComboBoxFrameWidth: { //??????ComboBox VMargin const QStyleOptionComboBox *comboBoxOption(qstyleoption_cast< const QStyleOptionComboBox *>(opt)); return comboBoxOption && comboBoxOption->editable ? Metrics::ComboBox_FrameWidth : Metrics::LineEdit_FrameWidth ; @@ -4077,6 +4164,17 @@ } } +static void updateWeekendTextFormat(QCalendarWidget *calendar, QColor) +{ + if (!calendar) + return ; + + QTextCharFormat fmt; + fmt.setForeground(QBrush(calendar->palette().highlight())); + calendar->setWeekdayTextFormat(Qt::Saturday, fmt); + calendar->setWeekdayTextFormat(Qt::Sunday, fmt); +} + void ChameleonStyle::polish(QWidget *w) { DStyle::polish(w); @@ -4120,11 +4218,20 @@ if (auto calendar = qobject_cast<QCalendarWidget* >(w)) { int radius = DStyle::pixelMetric(PM_TopLevelWindowRadius); - DPlatformWindowHandle handle(calendar); + // ??????dtk????????????????????????????????? + if (dynamic_cast<DApplication *>(QCoreApplication::instance())) { + DPlatformWindowHandle handle(calendar); + handle.setWindowRadius(radius); + } - handle.setWindowRadius(radius); calendar->setVerticalHeaderFormat(QCalendarWidget::NoVerticalHeader); + // ????????????Saturday???Sunday??????????????????????????? + DPlatformTheme *theme = DGuiApplicationHelper::instance()->applicationTheme(); + updateWeekendTextFormat(calendar, QColor()); + connect(theme, &DPlatformTheme::activeColorChanged, calendar, + std::bind(&updateWeekendTextFormat, calendar, std::placeholders::_1)); + auto topWidget = calendar->findChild<QWidget *>("qt_calendar_navigationbar"); topWidget->setBackgroundRole(QPalette::Base); @@ -4158,7 +4265,7 @@ view->setItemDelegate(new QStyledItemDelegate); } - if (DApplication::isDXcbPlatform()) { + if (DApplication::isDXcbPlatform() || (qApp->platformName() == "dwayland" || qApp->property("_d_isDwayland").toBool())) { bool is_menu = qobject_cast<QMenu *>(w); bool is_tip = w->inherits("QTipLabel"); @@ -4180,7 +4287,10 @@ if (DPlatformWindowHandle::isEnabledDXcb(w)) { handle.setEnableBlurWindow(true); - handle.setWindowRadius(8); + // ????????????8, 18???????????????????????????8 + auto theme = DGuiApplicationHelper::instance()->applicationTheme(); + int wradius = theme->windowRadius(); + handle.setWindowRadius(qMax(0, qMin(wradius, 8))); w->setAttribute(Qt::WA_TranslucentBackground); connect(DWindowManagerHelper::instance(), SIGNAL(hasCompositeChanged()), w, SLOT(update())); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qt5integration-5.5.17/styles/widgetgallery.cpp new/qt5integration-5.5.24/styles/widgetgallery.cpp --- old/qt5integration-5.5.17/styles/widgetgallery.cpp 2021-12-06 07:39:37.000000000 +0100 +++ new/qt5integration-5.5.24/styles/widgetgallery.cpp 2022-07-19 08:56:58.000000000 +0200 @@ -319,9 +319,15 @@ listModel->appendRow(item); } + QWidget *toolbtns = new QWidget; + QVBoxLayout *tbVLayout = new QVBoxLayout(toolbtns); + tbVLayout->addWidget(createToolButtons(nullptr, false)); + tbVLayout->addWidget(createToolButtons(nullptr, true)); + QScrollArea *toolArea = new QScrollArea; + toolArea->setWidget(toolbtns); bottomLeftTabWidget->addTab(pTreeViewWidget, "&TreeView"); bottomLeftTabWidget->addTab(pListViewWidget, "&ListView"); - bottomLeftTabWidget->addTab(new QWidget(), "tab 2"); + bottomLeftTabWidget->addTab(toolArea, "toolbuttons"); bottomLeftTabWidget->addTab(new QWidget(), "tab 3"); bottomLeftTabWidget->addTab(new QWidget(), "tab 4"); } @@ -415,3 +421,76 @@ timer->start(1000); } //! [13] + +QToolButton* WidgetGallery::toolBtn(QToolButton::ToolButtonPopupMode mode, const QString &text, bool hasMenu, bool hasIcon, Qt::ToolButtonStyle style) +{ + QToolButton *btn = new QToolButton; + QMenu *menu = new QMenu; + menu->addAction("action1"); + menu->addAction("action2"); + if (hasMenu) + btn->setMenu(menu); + if (hasIcon) + btn->setIcon(QIcon::fromTheme("edit")); + btn->setIconSize({16, 16}); + btn->setPopupMode(mode); + if (!text.isEmpty()) { + btn->setText(text); + btn->setToolButtonStyle(style); + } + + return btn; +} + +QWidget* WidgetGallery::createToolButtons(QWidget *parent, bool hasMenu) +{ + QWidget *holder = new QWidget(parent); + holder->resize(300, 500); + QGridLayout *gridLayout = new QGridLayout(holder); + gridLayout->addWidget(new QLabel(QString("ToolButtonPopupMode")), 0, 0); + gridLayout->addWidget(new QLabel("IconOnly"), 0, 1); + gridLayout->addWidget(new QLabel(" TextOnly"), 0, 2); + gridLayout->addWidget(new QLabel("TextBesideIcon"), 0, 3); + gridLayout->addWidget(new QLabel("TextUnderIcon"), 0, 4); + gridLayout->addWidget(new QLabel("FollowStyle"), 0, 5); + QString tmp = + hasMenu ? QString("(hasMenu)") : QString("(NoMenu)"); + for (int i = 0; i < 3; ++i) { + auto mode = static_cast<QToolButton::ToolButtonPopupMode>(i); + QMetaEnum metaEnum = QMetaEnum::fromType<QToolButton::ToolButtonPopupMode>(); + + gridLayout->addWidget(new QLabel(metaEnum.valueToKey(mode) + tmp), i + 1, 0); + + if (hasMenu) { + QToolButton *menuTextIconBtnUnderIconOnly = toolBtn(mode, "ToolButton", true, true, Qt::ToolButtonStyle::ToolButtonIconOnly); + gridLayout->addWidget(menuTextIconBtnUnderIconOnly, i + 1, 1); + + QToolButton *menuTextIconBtnUnderTextOnly = toolBtn(mode, "ToolButton", true, true, Qt::ToolButtonStyle::ToolButtonTextOnly); + gridLayout->addWidget(menuTextIconBtnUnderTextOnly, i + 1, 2); + + QToolButton *menuTextIconBtn = toolBtn(mode, "ToolButton", true, true, Qt::ToolButtonStyle::ToolButtonTextBesideIcon); + gridLayout->addWidget(menuTextIconBtn, i + 1, 3); + + QToolButton *menuTextIconBtnUnder = toolBtn(mode, "ToolButton", true, true, Qt::ToolButtonStyle::ToolButtonTextUnderIcon); + gridLayout->addWidget(menuTextIconBtnUnder, i + 1, 4); + + QToolButton *menuTextIconBtnUnderFollow = toolBtn(mode, "ToolButton", true, true, Qt::ToolButtonStyle::ToolButtonFollowStyle); + gridLayout->addWidget(menuTextIconBtnUnderFollow, i + 1, 5); + } else { + QToolButton *noMenuTextIconBtnIconOnly = toolBtn(mode, "ToolButton", false, true, Qt::ToolButtonStyle::ToolButtonIconOnly); + gridLayout->addWidget(noMenuTextIconBtnIconOnly, i + 1, 1); + + QToolButton *noMenuTextIconBtnTextOnly = toolBtn(mode, "ToolButton", false, true, Qt::ToolButtonStyle::ToolButtonTextOnly); + gridLayout->addWidget(noMenuTextIconBtnTextOnly, i + 1, 2); + + QToolButton *noMenuTextIconBtn = toolBtn(mode, "ToolButton", false, true, Qt::ToolButtonStyle::ToolButtonTextBesideIcon); + gridLayout->addWidget(noMenuTextIconBtn, i + 1, 3); + + QToolButton *noMenuTextIconBtnUnder = toolBtn(mode, "ToolButton", false, true, Qt::ToolButtonStyle::ToolButtonTextUnderIcon); + gridLayout->addWidget(noMenuTextIconBtnUnder, i + 1, 4); + + QToolButton *noMenuTextIconBtnFollow = toolBtn(mode, "ToolButton", false, true, Qt::ToolButtonStyle::ToolButtonFollowStyle); + gridLayout->addWidget(noMenuTextIconBtnFollow, i + 1, 5); + } + } + return holder; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qt5integration-5.5.17/styles/widgetgallery.h new/qt5integration-5.5.24/styles/widgetgallery.h --- old/qt5integration-5.5.17/styles/widgetgallery.h 2021-12-06 07:39:37.000000000 +0100 +++ new/qt5integration-5.5.24/styles/widgetgallery.h 2022-07-19 08:56:58.000000000 +0200 @@ -42,6 +42,7 @@ #define WIDGETGALLERY_H #include <QMainWindow> +#include <QToolButton> QT_BEGIN_NAMESPACE class QCheckBox; @@ -81,6 +82,8 @@ void createBottomLeftTabWidget(); void createBottomRightGroupBox(); void createProgressBar(); + QToolButton* toolBtn(QToolButton::ToolButtonPopupMode mode, const QString &text = QString(), bool hasMenu = true, bool hasIcon = true, Qt::ToolButtonStyle style = Qt::ToolButtonStyle::ToolButtonTextBesideIcon); + QWidget* createToolButtons(QWidget *parent = nullptr, bool hasMenu = true); QPalette originalPalette; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qt5integration-5.5.17/tests/styleplugins/chameleon/ut_chameleonstyle.cpp new/qt5integration-5.5.24/tests/styleplugins/chameleon/ut_chameleonstyle.cpp --- old/qt5integration-5.5.17/tests/styleplugins/chameleon/ut_chameleonstyle.cpp 2021-12-06 07:39:37.000000000 +0100 +++ new/qt5integration-5.5.24/tests/styleplugins/chameleon/ut_chameleonstyle.cpp 2022-07-19 08:56:58.000000000 +0200 @@ -1882,6 +1882,10 @@ INIT_TESTWIDGET(QScrollBar); TestScrollBarSliderDrawUtil drawUtilInstance(this); + + QScrollBar *bar = qobject_cast<QScrollBar*> (drawUtilInstance.testWidget()); + bar->setProperty("_d_dtk_slider_always_show", true); + ASSERT_DrawFuncHasData(drawUtilInstance.testDrawNormalScrollBarSlider); ASSERT_DrawFuncHasData(drawUtilInstance.testDrawNormalVerticalScrollBarSlider); ASSERT_DrawFuncHasData(drawUtilInstance.testDrawHorizontalSliderWithSpaceProperty); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qt5integration-5.5.17/tests/test-recoverage-qmake.sh new/qt5integration-5.5.24/tests/test-recoverage-qmake.sh --- old/qt5integration-5.5.17/tests/test-recoverage-qmake.sh 2021-12-06 07:39:37.000000000 +0100 +++ new/qt5integration-5.5.24/tests/test-recoverage-qmake.sh 2022-07-19 08:56:58.000000000 +0200 @@ -1,8 +1,9 @@ #!/bin/bash set -e -BUILD_DIR=build -REPORT_DIR=report +BUILD_DIR=`pwd`/../build-ut +HTML_DIR=${BUILD_DIR}/html +XML_DIR=${BUILD_DIR}/report cd ../ rm -rf $BUILD_DIR mkdir $BUILD_DIR @@ -16,15 +17,15 @@ cd $BUILD_DIR qmake ../ CONFIG+=debug BASED_DTK_DIR=based-dtk export ASAN_OPTIONS=halt_on_error=0 -TESTARGS="--gtest_output=xml:dde_test_report_qt5integration.xml" make check -j$(nproc) +TESTARGS="--gtest_output=xml:${XML_DIR}/report_qt5integration.xml" make check -j$(nproc) lcov -d ./ -c -o coverage_all.info #lcov --extract coverage_all.info $EXTRACT_ARGS --output-file coverage.info -lcov --remove coverage_all.info "*/tests/*" "*/usr/include*" "*build/src*" --output-file coverage.info +lcov --remove coverage_all.info "*/tests/*" "*/usr/include*" "*build-ut/src*" --output-file coverage.info cd .. -genhtml -o $REPORT_DIR $BUILD_DIR/coverage.info +genhtml -o $HTML_DIR $BUILD_DIR/coverage.info && mv ${BUILD_DIR}/html/index.html ${BUILD_DIR}/html/cov_qt5integration.html -test -e ./build/asan.log* && mv ./build/asan.log* ./build/asan_qt5integration.log || touch ./build/asan.log +test -e ${BUILD_DIR}/asan.log* && mv ${BUILD_DIR}/asan.log* ${BUILD_DIR}/asan_qt5integration.log || touch ${BUILD_DIR}/asan_qt5integration.log #rm -rf $BUILD_DIR #rm -rf ../$BUILD_DIR
