diff --git a/qt5-ukui-platformtheme/qt5-ukui-platform-theme.cpp b/qt5-ukui-platformtheme/qt5-ukui-platform-theme.cpp index db01793..14e6db8 100644 --- a/qt5-ukui-platformtheme/qt5-ukui-platform-theme.cpp +++ b/qt5-ukui-platformtheme/qt5-ukui-platform-theme.cpp @@ -229,8 +229,7 @@ QVariant Qt5UKUIPlatformTheme::themeHint(ThemeHint hint) const case QPlatformTheme::SystemIconFallbackThemeName: return "hicolor"; case QPlatformTheme::IconThemeSearchPaths: - //FIXME: - return QStringList()<<".local/share/icons"<<"/usr/share/icons"<<"/usr/local/share/icons"; + return xdgIconThemePaths(); // case WheelScrollLines: // { // return QVariant(1); @@ -241,6 +240,19 @@ QVariant Qt5UKUIPlatformTheme::themeHint(ThemeHint hint) const return QPlatformTheme::themeHint(hint); } +QStringList Qt5UKUIPlatformTheme::xdgIconThemePaths() const { + QStringList paths; + // Add home directory first in search path + const QFileInfo homeIconDir(QDir::homePath() + QLatin1String("/.icons")); + if (homeIconDir.isDir()) + paths.prepend(homeIconDir.absoluteFilePath()); + + paths.append(QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, + QStringLiteral("icons"), + QStandardPaths::LocateDirectory)); + return paths; +} + QIconEngine *Qt5UKUIPlatformTheme::createIconEngine(const QString &iconName) const { // QPluginLoader l(XDG_ICON_ENGINE_PATH); diff --git a/qt5-ukui-platformtheme/qt5-ukui-platform-theme.h b/qt5-ukui-platformtheme/qt5-ukui-platform-theme.h index a1b4cbe..086271c 100644 --- a/qt5-ukui-platformtheme/qt5-ukui-platform-theme.h +++ b/qt5-ukui-platformtheme/qt5-ukui-platform-theme.h @@ -89,6 +89,9 @@ public: public Q_SLOTS: void slotChangeStyle(const QString& key); +private: + QStringList xdgIconThemePaths() const; + private: QFont m_system_font; QFont m_fixed_font; diff --git a/qt5-ukui-platformtheme/widget/filedialog/kyfiledialog.cpp b/qt5-ukui-platformtheme/widget/filedialog/kyfiledialog.cpp index dbbc8d3..d519dd8 100644 --- a/qt5-ukui-platformtheme/widget/filedialog/kyfiledialog.cpp +++ b/qt5-ukui-platformtheme/widget/filedialog/kyfiledialog.cpp @@ -90,7 +90,7 @@ KyNativeFileDialog::KyNativeFileDialog(QWidget *parent) pDebug << "QTranslator t3 load" << t3->load("/usr/share/qt5/translations/qt_"+QLocale::system().name()); QApplication::installTranslator(t3); - mKyFileDialogUi = new Ui_KyFileDialog; + mKyFileDialogUi = new Ui_KyFileDialog(this); // setStyle(nullptr); @@ -328,7 +328,7 @@ KyNativeFileDialog::KyNativeFileDialog(QWidget *parent) onSwitchView(); isTableModel(); - m_model = new QStringListModel(); + m_model = new QStringListModel(this); m_completer = new QCompleter(mKyFileDialogUi->m_fileNameEdit); m_completer->setModel(m_model); m_completer->setMaxVisibleItems(10); diff --git a/qt5-ukui-platformtheme/widget/filedialog/kyfiledialogprivate.cpp b/qt5-ukui-platformtheme/widget/filedialog/kyfiledialogprivate.cpp index ace5800..82c70b8 100644 --- a/qt5-ukui-platformtheme/widget/filedialog/kyfiledialogprivate.cpp +++ b/qt5-ukui-platformtheme/widget/filedialog/kyfiledialogprivate.cpp @@ -37,6 +37,14 @@ KyNativeFileDialogPrivate::KyNativeFileDialogPrivate() // m_container = q->m_container; } +KyNativeFileDialogPrivate::~KyNativeFileDialogPrivate() +{ + if(m_timer){ + delete m_timer; + m_timer = nullptr; + } +} + QStringList KyNativeFileDialogPrivate::typedFiles() { /* diff --git a/qt5-ukui-platformtheme/widget/filedialog/kyfiledialogprivate.h b/qt5-ukui-platformtheme/widget/filedialog/kyfiledialogprivate.h index 89485ff..4a9c1c5 100644 --- a/qt5-ukui-platformtheme/widget/filedialog/kyfiledialogprivate.h +++ b/qt5-ukui-platformtheme/widget/filedialog/kyfiledialogprivate.h @@ -34,8 +34,11 @@ class KyFileDialogHelper; class KyNativeFileDialogPrivate { friend class KyNativeFileDialog; -private: +public: KyNativeFileDialogPrivate(); + ~KyNativeFileDialogPrivate(); + +private: QStringList typedFiles(); diff --git a/qt5-ukui-platformtheme/widget/filedialog/sidebar.cpp b/qt5-ukui-platformtheme/widget/filedialog/sidebar.cpp index bd6fffb..9e7a2d4 100644 --- a/qt5-ukui-platformtheme/widget/filedialog/sidebar.cpp +++ b/qt5-ukui-platformtheme/widget/filedialog/sidebar.cpp @@ -113,8 +113,8 @@ FileDialogSideBar::FileDialogSideBar(QWidget *parent) : QTreeView(parent) setAutoScrollMargin(0); - auto delegate = new SideBarItemDelegate(this); - setItemDelegate(delegate); + m_delegate = new SideBarItemDelegate(this); + setItemDelegate(m_delegate); m_model = new Peony::SideBarModel(this); m_proxyModel = new Peony::SideBarProxyFilterSortModel(this); @@ -243,10 +243,18 @@ FileDialogSideBar::FileDialogSideBar(QWidget *parent) : QTreeView(parent) FileDialogSideBar::~FileDialogSideBar() { - m_proxyModel->deleteLater(); - m_proxyModel = nullptr; - m_model->deleteLater(); - m_model = nullptr; + if(m_proxyModel){ + m_proxyModel->deleteLater(); + m_proxyModel = nullptr; + } + if(m_model){ + m_model->deleteLater(); + m_model = nullptr; + } + if(m_delegate){ + m_delegate->deleteLater(); + m_delegate = nullptr; + } } void FileDialogSideBar::tableModeChanged(bool isTableMode) diff --git a/qt5-ukui-platformtheme/widget/filedialog/sidebar.h b/qt5-ukui-platformtheme/widget/filedialog/sidebar.h index 93ee1c8..f58468a 100644 --- a/qt5-ukui-platformtheme/widget/filedialog/sidebar.h +++ b/qt5-ukui-platformtheme/widget/filedialog/sidebar.h @@ -56,6 +56,18 @@ private: }; + +class SideBarItemDelegate : public QStyledItemDelegate +{ + friend class FileDialogSideBar; + explicit SideBarItemDelegate(QObject *parent = nullptr); + ~SideBarItemDelegate(){} + +// QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override; + void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; +}; + + class FileDialogSideBar : public QTreeView { @@ -73,6 +85,7 @@ public Q_SLOTS: private: Peony::SideBarProxyFilterSortModel *m_proxyModel = nullptr; Peony::SideBarModel *m_model = nullptr; + SideBarItemDelegate *m_delegate = nullptr; Q_SIGNALS: void goToUriRequest(const QString &uri, bool addToHistory = true, bool forceUpdate = false); @@ -80,17 +93,6 @@ Q_SIGNALS: }; -class SideBarItemDelegate : public QStyledItemDelegate -{ - friend class FileDialogSideBar; - explicit SideBarItemDelegate(QObject *parent = nullptr); - ~SideBarItemDelegate(){} - -// QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override; - void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; -}; - - class SideBarStyle : public QProxyStyle { public: diff --git a/qt5-ukui-platformtheme/widget/filedialog/ui_kyfiledialog.cpp b/qt5-ukui-platformtheme/widget/filedialog/ui_kyfiledialog.cpp index c5b49ac..aef5ee9 100644 --- a/qt5-ukui-platformtheme/widget/filedialog/ui_kyfiledialog.cpp +++ b/qt5-ukui-platformtheme/widget/filedialog/ui_kyfiledialog.cpp @@ -25,15 +25,234 @@ #include #include "kyfiledialog.h" #include "debug.h" +#include + //Ui_KyFileDialog::Ui_KyFileDialog(QDialog *parent) //{ // setupUi(parent); //} +Ui_KyFileDialog::Ui_KyFileDialog(QWidget *parent) : QWidget(parent) +{ + +} + +Ui_KyFileDialog::~Ui_KyFileDialog() +{ + pDebug << "Ui_KyFileDialog destory111.........."; +/* + if(m_pathbarWidget){ + m_pathbarWidget->deleteLater(); + m_pathbarWidget = nullptr; + } + qDebug() << "Ui_KyFileDialog destory122222.........."; + + if(m_pathbar){ + m_pathbar->deleteLater(); + m_pathbar = nullptr; + } + if(m_searchBtn){ + m_searchBtn->deleteLater(); + m_searchBtn = nullptr; + } + if(m_backButton){ + m_backButton->deleteLater(); + m_backButton = nullptr; + } + qDebug() << "Ui_KyFileDialog destory3223.........."; + + if(m_forwardButton){ + m_forwardButton->deleteLater(); + m_forwardButton = nullptr; + } + if(m_toParentButton){ + m_toParentButton->deleteLater(); + m_toParentButton = nullptr; + } + if(m_modeButton){ + m_modeButton->deleteLater(); + m_modeButton = nullptr; + } + if(m_sortButton){ + m_sortButton->deleteLater(); + m_sortButton = nullptr; + } + if(m_maximizeAndRestore){ + m_maximizeAndRestore->deleteLater(); + m_maximizeAndRestore = nullptr; + } + if(m_closeButton){ + m_closeButton->deleteLater(); + m_closeButton = nullptr; + } + if(m_modeMenu){ + m_modeMenu->deleteLater(); + m_modeMenu = nullptr; + } + qDebug() << "Ui_KyFileDialog destory3555423.........."; + + if(m_sortMenu){ + m_sortMenu->deleteLater(); + m_sortMenu = nullptr; + } + if(m_listModeAction){ + m_listModeAction->deleteLater(); + m_listModeAction = nullptr; + } + if(m_iconModeAction){ + m_iconModeAction->deleteLater(); + m_iconModeAction = nullptr; + } + if(m_sider){ + m_sider->deleteLater(); + m_sider = nullptr; + } + qDebug() << "Ui_KyFileDialog destory223322.........."; + + if(m_frame){ + m_frame->deleteLater(); + m_frame = nullptr; + } + if(m_splitter){ + m_splitter->deleteLater(); + m_splitter = nullptr; + } + if(vboxLayout){ + vboxLayout->deleteLater(); + vboxLayout = nullptr; + } + if(m_treeView){ + m_treeView->deleteLater(); + m_treeView = nullptr; + } + if(m_fileNameLabel){ + m_fileNameLabel->deleteLater(); + m_fileNameLabel = nullptr; + } + if(m_fileNameEdit){ + m_fileNameEdit->deleteLater(); + m_fileNameEdit = nullptr; + } + qDebug() << "Ui_KyFileDialog destory1245677.........."; + + if(m_fileTypeCombo){ + m_fileTypeCombo->deleteLater(); + m_fileTypeCombo = nullptr; + } + if(m_newFolderButton){ + m_newFolderButton->deleteLater(); + m_newFolderButton = nullptr; + } + if(m_acceptButton){ + m_acceptButton->deleteLater(); + m_acceptButton = nullptr; + } + if(m_rejectButton){ + m_rejectButton->deleteLater(); + m_rejectButton = nullptr; + } + qDebug() << "Ui_KyFileDialog destory23467899.........."; + + if(m_upSeperate){ + m_upSeperate->deleteLater(); + m_upSeperate = nullptr; + } + if(m_downSeperate){ + m_downSeperate->deleteLater(); + m_downSeperate = nullptr; + } + if(m_widget){ + m_widget->deleteLater(); + m_widget = nullptr; + } + qDebug() << "destory345.........."; + + if(m_container){ + qDebug() << "destory555.........."; + + m_container->deleteLater(); + m_container = nullptr; + qDebug() << "destory666.........."; + + } + qDebug() << "destory777.........."; + + if(m_siderWidget){ + m_siderWidget->deleteLater(); + m_siderWidget = nullptr; + } + + if(m_sortTypeGroup){ + m_sortTypeGroup->deleteLater(); + m_sortTypeGroup = nullptr; + } + if(m_fileName){ + m_fileName->deleteLater(); + m_fileName = nullptr; + } + if(m_modifiedDate){ + m_modifiedDate->deleteLater(); + m_modifiedDate = nullptr; + } + if(m_fileType){ + m_fileType->deleteLater(); + m_fileType = nullptr; + } + if(m_fileSize){ + m_fileSize->deleteLater(); + m_fileSize = nullptr; + } + if(m_originalPath){ + m_originalPath->deleteLater(); + m_originalPath = nullptr; + } + if(m_sortOrderGroup){ + m_sortOrderGroup->deleteLater(); + m_sortOrderGroup = nullptr; + } + if(m_descending){ + m_descending->deleteLater(); + m_descending = nullptr; + } + if(m_ascending){ + m_ascending->deleteLater(); + m_ascending = nullptr; + } + if(m_useGlobalSortAction){ + m_useGlobalSortAction->deleteLater(); + m_useGlobalSortAction = nullptr; + } + qDebug() << "Ui_KyFileDialog destory8888.........."; + + if(m_siderLayout){ + m_siderLayout->deleteLater(); + m_siderLayout = nullptr; + } +// if(m_gridLayout){ +// m_gridLayout->deleteLater(); +// m_gridLayout= nullptr; +// } + + if(m_hHeaderLayout){ + m_hHeaderLayout->deleteLater(); + m_hHeaderLayout = nullptr; + } + if(m_hLineEditLayout){ + m_hLineEditLayout->deleteLater(); + m_hLineEditLayout = nullptr; + } + if(m_hBtnLayout){ + m_hBtnLayout->deleteLater(); + m_hBtnLayout = nullptr; + } + qDebug() << "Ui_KyFileDialog destory123.........."; +*/ +} + void Ui_KyFileDialog::initSortMenu(QDialog *mKyFileDialog) { - m_sortButton = new MenuToolButton(); + m_sortButton = new MenuToolButton(this); m_sortMenu = new QMenu(m_sortButton); m_sortTypeGroup = new QActionGroup(m_sortMenu); @@ -88,7 +307,7 @@ void Ui_KyFileDialog::initSortMenu(QDialog *mKyFileDialog) void Ui_KyFileDialog::initModeMenu(QDialog *mKyFileDialog) { - m_modeButton = new MenuToolButton(); + m_modeButton = new MenuToolButton(this); m_modeButton->setPopupMode(QToolButton::InstantPopup); m_modeButton->setAutoRaise(true); m_modeButton->setFixedSize(QSize(57, 40)); @@ -104,36 +323,36 @@ void Ui_KyFileDialog::initModeMenu(QDialog *mKyFileDialog) void Ui_KyFileDialog::initSiderBar(QDialog *mKyFileDialog) { - m_siderWidget = new QWidget(); + m_siderWidget = new QWidget(this); m_siderLayout = new QVBoxLayout(); m_siderLayout->setContentsMargins(0,0,0,0); - m_sider = new FileDialogSideBar(); + m_sider = new FileDialogSideBar(this); m_sider->setAttribute(Qt::WA_TranslucentBackground); } void Ui_KyFileDialog::initHeaderBar(QDialog *mKyFileDialog) { - m_hHeaderLayout = new QHBoxLayout(); + m_hHeaderLayout = new QHBoxLayout(this); initModeMenu(mKyFileDialog); initSortMenu(mKyFileDialog); m_hHeaderLayout->setContentsMargins(0,0,8,0); m_hHeaderLayout->setObjectName(QString::fromUtf8("hboxLayout")); - m_backButton = new QToolButton(); - m_forwardButton = new QToolButton(); - m_toParentButton = new QToolButton(); + m_backButton = new QToolButton(this); + m_forwardButton = new QToolButton(this); + m_toParentButton = new QToolButton(this); - m_pathbarWidget = new FileDialogPathBar();//new Peony::AdvancedLocationBar(mKyFileDialog);// + m_pathbarWidget = new FileDialogPathBar(this);//new Peony::AdvancedLocationBar(mKyFileDialog);// m_pathbar = m_pathbarWidget->getPathBar(); m_pathbar->setMinimumWidth(250); m_pathbar->setFocusPolicy(Qt::FocusPolicy(m_pathbar->focusPolicy() & ~Qt::TabFocus)); - m_searchBtn = new QToolButton(); + m_searchBtn = new QToolButton(this); - m_maximizeAndRestore = new QToolButton(); + m_maximizeAndRestore = new QToolButton(this); - m_closeButton = new QToolButton(); + m_closeButton = new QToolButton(this); m_hHeaderLayout->setAlignment(Qt::AlignVCenter); m_hHeaderLayout->addWidget(m_backButton); @@ -150,9 +369,9 @@ void Ui_KyFileDialog::initHeaderBar(QDialog *mKyFileDialog) void Ui_KyFileDialog::initLineEditLayout(QDialog *mKyFileDialog) { - m_hLineEditLayout = new QHBoxLayout(); + m_hLineEditLayout = new QHBoxLayout(this); m_hLineEditLayout->setContentsMargins(4,0,24,0); - m_fileNameLabel = new QLabel(); + m_fileNameLabel = new QLabel(this); m_fileNameLabel->setObjectName(QString::fromUtf8("fileNameLabel")); QSizePolicy sizePolicy2(QSizePolicy::Minimum, QSizePolicy::Preferred); sizePolicy2.setHorizontalStretch(0); @@ -171,7 +390,7 @@ void Ui_KyFileDialog::initLineEditLayout(QDialog *mKyFileDialog) m_fileNameEdit->setSizePolicy(sizePolicy3); pDebug << "44444444444444444"; - m_fileTypeCombo = new FileDialogComboBox(); + m_fileTypeCombo = new FileDialogComboBox(this); QSizePolicy sizePolicy4(QSizePolicy::Expanding, QSizePolicy::Fixed); sizePolicy4.setHorizontalStretch(0); sizePolicy4.setVerticalStretch(0); @@ -188,7 +407,7 @@ void Ui_KyFileDialog::initLineEditLayout(QDialog *mKyFileDialog) void Ui_KyFileDialog::intiBtnLayout(QDialog *mKyFileDialog) { - m_hBtnLayout = new QHBoxLayout(); + m_hBtnLayout = new QHBoxLayout(this); m_hBtnLayout->addSpacing(20); m_hBtnLayout->setContentsMargins(0,0,24,0); m_newFolderButton =new QPushButton(mKyFileDialog); @@ -215,7 +434,10 @@ void Ui_KyFileDialog::setupUi(QDialog *mKyFileDialog) if(mKyFileDialog->objectName().isEmpty()) { mKyFileDialog->setObjectName(QString::fromUtf8("KyNativeFileDialog")); } - mKyFileDialog->resize(1160, 635); + auto sliderWidth = Peony::GlobalSettings::getInstance()->getValue(DEFAULT_SIDEBAR_WIDTH).toInt(); + int viewWidth = 125 * 6 + 24; + qDebug() << "width..." << sliderWidth + viewWidth; + mKyFileDialog->resize(sliderWidth + viewWidth, 635); mKyFileDialog->setSizeGripEnabled(true); mKyFileDialog->setAttribute(Qt::WA_TranslucentBackground); @@ -224,9 +446,9 @@ void Ui_KyFileDialog::setupUi(QDialog *mKyFileDialog) m_gridLayout = new QGridLayout(mKyFileDialog); m_gridLayout->setObjectName(QString::fromUtf8("gridLayout")); - m_container = new Peony::DirectoryViewContainer(); - m_frame = new QFrame(); - vboxLayout = new QVBoxLayout(); + m_container = new Peony::DirectoryViewContainer(this); + m_frame = new QFrame(this); + vboxLayout = new QVBoxLayout(this); initSiderBar(mKyFileDialog); @@ -264,7 +486,7 @@ void Ui_KyFileDialog::setupUi(QDialog *mKyFileDialog) m_frame->setFrameShape(QFrame::NoFrame); m_frame->setLayout(vboxLayout); - m_splitter = new QSplitter(); + m_splitter = new QSplitter(this); m_splitter->setAttribute(Qt::WA_TranslucentBackground); QSizePolicy sizePolicy1(QSizePolicy::Expanding, QSizePolicy::Expanding); sizePolicy1.setHorizontalStretch(0); @@ -276,9 +498,10 @@ void Ui_KyFileDialog::setupUi(QDialog *mKyFileDialog) m_siderLayout->addWidget(m_sider); m_siderWidget->setLayout(m_siderLayout); m_splitter->addWidget(m_siderWidget); - m_splitter->setStretchFactor(0, 20); m_splitter->addWidget(m_frame); - m_splitter->setStretchFactor(1, 40); + QList list; + list << sliderWidth << viewWidth; + m_splitter->setSizes(list); int siderWidIndex = m_splitter->indexOf(m_siderWidget); int frameIndex = m_splitter->indexOf(m_frame); m_splitter->setCollapsible(siderWidIndex, false); diff --git a/qt5-ukui-platformtheme/widget/filedialog/ui_kyfiledialog.h b/qt5-ukui-platformtheme/widget/filedialog/ui_kyfiledialog.h index a2c487c..ec69c0d 100644 --- a/qt5-ukui-platformtheme/widget/filedialog/ui_kyfiledialog.h +++ b/qt5-ukui-platformtheme/widget/filedialog/ui_kyfiledialog.h @@ -53,10 +53,12 @@ namespace Peony { class DirectoryViewContainer; } -class Ui_KyFileDialog +class Ui_KyFileDialog: public QWidget { -public: - // explicit Ui_KyFileDialog; + QOBJECT_H + public: + explicit Ui_KyFileDialog(QWidget *parent = nullptr); + ~Ui_KyFileDialog(); QGridLayout *m_gridLayout = nullptr; QHBoxLayout *m_hHeaderLayout = nullptr; diff --git a/qt5-ukui-platformtheme/widget/messagebox/message-box.cpp b/qt5-ukui-platformtheme/widget/messagebox/message-box.cpp index 4f984ea..f5bfeef 100644 --- a/qt5-ukui-platformtheme/widget/messagebox/message-box.cpp +++ b/qt5-ukui-platformtheme/widget/messagebox/message-box.cpp @@ -156,7 +156,7 @@ MessageBox::MessageBox(QWidget *parent) : QDialog(*new MessageBoxPrivate, parent Q_D(MessageBox); const QString locale = QLocale::system().name(); - QTranslator *translator = new QTranslator(); + QTranslator *translator = new QTranslator(this); if (translator->load("/usr/share/qt5-ukui-platformtheme/qt5-ukui-platformtheme_" + locale)) { if(!QApplication::installTranslator(translator)) qWarning() << "Install translator failed!" << locale; @@ -1361,7 +1361,10 @@ MessageBoxHelper::MessageBoxHelper() : QPlatformMessageDialogHelper(), mMessageB MessageBoxHelper::~MessageBoxHelper() { - + if(mMessageBox){ + mMessageBox->deleteLater(); + mMessageBox = nullptr; + } } void MessageBoxHelper::exec() @@ -1383,7 +1386,7 @@ bool MessageBoxHelper::show(Qt::WindowFlags windowFlags, Qt::WindowModality wind { initDialog(windowFlags, windowModality, parent); - if (parent) { + if (parent && mMessageBox->find(parent->winId())) { if (QWidget *p = mMessageBox->find(parent->winId())) { for(QMessageBox *mb : p->findChildren()) { @@ -1425,6 +1428,9 @@ bool MessageBoxHelper::show(Qt::WindowFlags windowFlags, Qt::WindowModality wind for (QMessageBox *mb : p->findChildren()) { if (mb->icon() == options()->icon() && mb->windowTitle() == options()->windowTitle() && mb->text() == options()->text() && mb->informativeText() == options()->informativeText() && mb->detailedText() == options()->detailedText()) { + if(mb->escapeButton() && mMessageBox->escapeButton() != mb->escapeButton()) + mMessageBox->setEscapeButton(mb->escapeButton()); + if(mb->defaultButton()){ QString btnText = mb->defaultButton()->text(); foreach (QAbstractButton* btn, mMessageBox->buttons()) { @@ -1454,13 +1460,16 @@ bool MessageBoxHelper::show(Qt::WindowFlags windowFlags, Qt::WindowModality wind mMessageBox->setWindowFlag(Qt::Dialog); } - if(parent == nullptr) + if(parent == nullptr || mMessageBox->find(parent->winId()) == nullptr) { QList widgets = QApplication::allWidgets(); foreach (QWidget *w, widgets) { if(QMessageBox *mb = qobject_cast(w)) { if (mb->icon() == options()->icon() && mb->windowTitle() == options()->windowTitle() && mb->text() == options()->text() && mb->informativeText() == options()->informativeText() && mb->detailedText() == options()->detailedText()) { + if(mb->escapeButton() && mMessageBox->escapeButton() != mb->escapeButton()) + mMessageBox->setEscapeButton(mb->escapeButton()); + if(mb->defaultButton() == nullptr) break; QString btnText = mb->defaultButton()->text();