From b5172761560f7df1e44e01bb24e7c6f06d0f00b2 Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Mon, 26 Jul 2021 16:40:20 +0200 Subject: [PATCH] Fix layout margins and z-order of some dialogs (#834) * Fix layout margins on paged dialogs * Make sure non-modal dialogs are only shown once and are on top --- nw/gui/custom.py | 10 +++++----- nw/guimain.py | 14 ++++++++++++-- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/nw/gui/custom.py b/nw/gui/custom.py index 2a0e3407..eb04c5b7 100644 --- a/nw/gui/custom.py +++ b/nw/gui/custom.py @@ -393,11 +393,11 @@ class PagedDialog(QDialog): self._outerBox.addLayout(self._buttonBox) # Default Margins - qM = self._outerBox.contentsMargins() - mL = qM.left() - mR = qM.right() - mT = qM.top() - mB = qM.bottom() + thisStyle = self.style() + mL = thisStyle.pixelMetric(QStyle.PM_LayoutLeftMargin) + mR = thisStyle.pixelMetric(QStyle.PM_LayoutRightMargin) + mT = thisStyle.pixelMetric(QStyle.PM_LayoutLeftMargin) + mB = thisStyle.pixelMetric(QStyle.PM_LayoutBottomMargin) # Set Margins self.setContentsMargins(0, 0, 0, 0) diff --git a/nw/guimain.py b/nw/guimain.py index 936bfcda..c485988f 100644 --- a/nw/guimain.py +++ b/nw/guimain.py @@ -1002,9 +1002,13 @@ class GuiMain(QMainWindow): self.treeView.flushTreeOrder() - dlgDetails = GuiProjectDetails(self) + dlgDetails = getGuiItem("GuiProjectDetails") + if dlgDetails is None: + dlgDetails = GuiProjectDetails(self) + dlgDetails.setModal(False) dlgDetails.show() + dlgDetails.raise_() return @@ -1021,6 +1025,7 @@ class GuiMain(QMainWindow): dlgBuild.setModal(False) dlgBuild.show() + dlgBuild.raise_() qApp.processEvents() dlgBuild.viewCachedDoc() @@ -1055,6 +1060,7 @@ class GuiMain(QMainWindow): dlgStats.setModal(False) dlgStats.show() + dlgStats.raise_() qApp.processEvents() dlgStats.populateGUI() @@ -1063,9 +1069,13 @@ class GuiMain(QMainWindow): def showAboutNWDialog(self, showNotes=False): """Show the about dialog for novelWriter. """ - dlgAbout = GuiAbout(self) + dlgAbout = getGuiItem("GuiAbout") + if dlgAbout is None: + dlgAbout = GuiAbout(self) + dlgAbout.setModal(True) dlgAbout.show() + dlgAbout.raise_() qApp.processEvents() dlgAbout.populateGUI()