diff --git a/src/data/extra/themes/moonlight/interface.qss b/src/data/extra/themes/moonlight/interface.qss index f104f88d..dfcf28e8 100644 --- a/src/data/extra/themes/moonlight/interface.qss +++ b/src/data/extra/themes/moonlight/interface.qss @@ -152,8 +152,14 @@ QToolBar::separator { background-color: @widgets#qtoolbar#separator#bg; } -QToolBarExtension { +QToolBarExtension#qt_toolbar_ext_button { background-color: @widgets#qtoolbar#extension#bg; + margin: 30px; +} + +QToolBarExtension#qt_toolbar_ext_button:hover { + background-color: @widgets#qtoolbar#extension#hover#bg; + margin: 30px; } /* QToolButton */ diff --git a/src/data/extra/themes/moonlight/palette.json b/src/data/extra/themes/moonlight/palette.json index 5cb570c8..a0092bc1 100644 --- a/src/data/extra/themes/moonlight/palette.json +++ b/src/data/extra/themes/moonlight/palette.json @@ -302,7 +302,10 @@ "bg" : "@widgets#separator#bg" }, "extension" : { - "bg" : "@base#normal#fg" + "bg" : "@base#normal#border", + "hover" : { + "bg" : "@base#hover#bg" + } } }, "qtoolbutton" : { diff --git a/src/data/extra/themes/pure/interface.qss b/src/data/extra/themes/pure/interface.qss index f104f88d..dfcf28e8 100644 --- a/src/data/extra/themes/pure/interface.qss +++ b/src/data/extra/themes/pure/interface.qss @@ -152,8 +152,14 @@ QToolBar::separator { background-color: @widgets#qtoolbar#separator#bg; } -QToolBarExtension { +QToolBarExtension#qt_toolbar_ext_button { background-color: @widgets#qtoolbar#extension#bg; + margin: 30px; +} + +QToolBarExtension#qt_toolbar_ext_button:hover { + background-color: @widgets#qtoolbar#extension#hover#bg; + margin: 30px; } /* QToolButton */ diff --git a/src/data/extra/themes/pure/palette.json b/src/data/extra/themes/pure/palette.json index 006761b1..f520c551 100644 --- a/src/data/extra/themes/pure/palette.json +++ b/src/data/extra/themes/pure/palette.json @@ -298,7 +298,10 @@ "bg" : "@widgets#separator#bg" }, "extension" : { - "bg" : "@base#normal#fg" + "bg" : "@base#normal#border", + "hover" : { + "bg" : "@base#hover#bg" + } } }, "qtoolbutton" : { diff --git a/src/utils/widgetutils.cpp b/src/utils/widgetutils.cpp index 4ef5ab56..de1ca843 100644 --- a/src/utils/widgetutils.cpp +++ b/src/utils/widgetutils.cpp @@ -415,5 +415,6 @@ void WidgetUtils::selectBaseName(QLineEdit *p_lineEdit) void WidgetUtils::setContentsMargins(QLayout *p_layout) { - p_layout->setContentsMargins(CONTENTS_MARGIN, CONTENTS_MARGIN, CONTENTS_MARGIN, CONTENTS_MARGIN); + // Use 0 bottom margin to align dock widgets with the content area. + p_layout->setContentsMargins(CONTENTS_MARGIN, CONTENTS_MARGIN, CONTENTS_MARGIN, 0); } diff --git a/src/widgets/markdownviewwindow.cpp b/src/widgets/markdownviewwindow.cpp index c278e2d0..6625d8eb 100644 --- a/src/widgets/markdownviewwindow.cpp +++ b/src/widgets/markdownviewwindow.cpp @@ -251,12 +251,6 @@ void MarkdownViewWindow::handleBufferChangedInternal(const QSharedPointersetIconSize(QSize(iconSize, iconSize)); - addToolBar(toolBar); addAction(toolBar, ViewWindowToolBarHelper::EditReadDiscard); diff --git a/src/widgets/outlinepopup.cpp b/src/widgets/outlinepopup.cpp index 14e350ae..f64c3c8a 100644 --- a/src/widgets/outlinepopup.cpp +++ b/src/widgets/outlinepopup.cpp @@ -14,11 +14,6 @@ OutlinePopup::OutlinePopup(QToolButton *p_btn, QWidget *p_parent) m_button(p_btn) { setupUI(); - - connect(this, &QMenu::aboutToShow, - this, [this]() { - m_viewer->setFocus(); - }); } void OutlinePopup::setupUI() @@ -41,8 +36,12 @@ void OutlinePopup::showEvent(QShowEvent* p_event) { QMenu::showEvent(p_event); - const auto p = pos(); - const auto btnRect = m_button->geometry(); - // Move it to right-aligned. - move(p.x() + btnRect.width() - geometry().width(), p.y()); + m_viewer->setFocus(); + + // Move it to be right-aligned. + if (m_button->isVisible()) { + const auto p = pos(); + const auto btnRect = m_button->geometry(); + move(p.x() + btnRect.width() - geometry().width(), p.y()); + } } diff --git a/src/widgets/textviewwindow.cpp b/src/widgets/textviewwindow.cpp index e26ec10a..44b11519 100644 --- a/src/widgets/textviewwindow.cpp +++ b/src/widgets/textviewwindow.cpp @@ -60,10 +60,6 @@ void TextViewWindow::setupUI() void TextViewWindow::setupToolBar() { auto toolBar = createToolBar(this); - const auto &editorConfig = ConfigMgr::getInst().getEditorConfig(); - const int iconSize = editorConfig.getToolBarIconSize(); - toolBar->setIconSize(QSize(iconSize, iconSize)); - addToolBar(toolBar); addAction(toolBar, ViewWindowToolBarHelper::Save); diff --git a/src/widgets/viewwindow.cpp b/src/widgets/viewwindow.cpp index 0f7e818d..799b5360 100644 --- a/src/widgets/viewwindow.cpp +++ b/src/widgets/viewwindow.cpp @@ -1146,6 +1146,16 @@ QToolBar *ViewWindow::createToolBar(QWidget *p_parent) { auto toolBar = new QToolBar(p_parent); toolBar->setProperty(PropertyDefs::c_viewWindowToolBar, true); + + const auto &editorConfig = ConfigMgr::getInst().getEditorConfig(); + const int iconSize = editorConfig.getToolBarIconSize(); + toolBar->setIconSize(QSize(iconSize, iconSize)); + + /* + auto extBtn = toolBar->findChild(QLatin1String("qt_toolbar_ext_button")); + Q_ASSERT(extBtn); + */ + return toolBar; }