Skip to content

Add option to reposition toolbars in other corners - #5022

Open
xLPMG wants to merge 6 commits into
Stellarium:masterfrom
xLPMG:adjustable-toolbar-location
Open

Add option to reposition toolbars in other corners#5022
xLPMG wants to merge 6 commits into
Stellarium:masterfrom
xLPMG:adjustable-toolbar-location

Conversation

@xLPMG

@xLPMG xLPMG commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

I came across issue #4783 and thought "why not?". I decided to give it a try and got this working version:

The "Tools" tab in the Configuration dialog has two checkboxes which let the user move the toolbars to the top, to the right or both. This makes it possible to position the toolbars in any of the four corners, which should be enough customization.

Fixes #685 #4783

Screenshots (if appropriate):

Screenshot 2026-07-03 at 00 51 49 Screenshot 2026-07-03 at 00 52 26

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • This change requires a documentation update
  • Housekeeping

How Has This Been Tested?

Manually on MacOS 26.5.1

Checklist:

  • My code follows the code style of this project.
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (header file)
  • I have updated the respective chapter in the Stellarium User Guide
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

Great PR! Please pay attention to the following items before merging:

Files matching src/**/*.cpp:

  • Are possibly unused includes removed?

Files matching guide/**:

  • Did you remember to update screenshots to match new updates?
  • Did you remember to grammar check in changed part of documentation?

This is an automatically generated QA checklist based on modified files.

Comment thread src/gui/StelGuiItems.hpp Outdated
@gzotti gzotti linked an issue Jul 3, 2026 that may be closed by this pull request
@gzotti

gzotti commented Jul 3, 2026

Copy link
Copy Markdown
Member

Not sure if we really need that. OTOH it was requested twice in 7 years, so OK. Just that the names become increasingly weird. BottomStelBar sounds like a design decision from 2002 (?). Should we think about renaming a few GUI classes, e.g.:

  • DialogMenuBar for what used to be on the left vertical.
  • ToolMenuBar for what used to be on the bottom horizontal.

Have you tested how this works together with Oculars plugin GUI (top-right corner), and with the Calendars screen output (bottom-right corner)? What about InfoText output, is that shifted down? Does it move up when the 'BottomStelBar' (now at top) retracts?

The checkmarks in the config GUI might look better as Comboboxes: Dialog buttons [Left Edge/Right Edge], Tool Buttons [Bottom Edge/Top Edge]

@alex-w alex-w added this to GUI Jul 3, 2026
@github-project-automation github-project-automation Bot moved this to Backlog in GUI Jul 3, 2026
@alex-w alex-w added the subsystem: gui The issue is related to GUI subsystem of planetarium... label Jul 3, 2026
@xLPMG

xLPMG commented Jul 3, 2026

Copy link
Copy Markdown
Contributor Author

Not sure if we really need that. OTOH it was requested twice in 7 years, so OK. Just that the names become increasingly weird. BottomStelBar sounds like a design decision from 2002 (?). Should we think about renaming a few GUI classes, e.g.:

  • DialogMenuBar for what used to be on the left vertical.
  • ToolMenuBar for what used to be on the bottom horizontal.

Have you tested how this works together with Oculars plugin GUI (top-right corner), and with the Calendars screen output (bottom-right corner)? What about InfoText output, is that shifted down? Does it move up when the 'BottomStelBar' (now at top) retracts?

The checkmarks in the config GUI might look better as Comboboxes: Dialog buttons [Left Edge/Right Edge], Tool Buttons [Bottom Edge/Top Edge]

Yes the names are a little weird now, but I wanted to keep the changes minimal. I interpreted it like "this tool bar was named BottomStelBar because that where it lives by default and it keeps this name, even if the user decides to optionally show it at the top instead". If you are fine with more code changes, then renaming won't be a problem.

It fully overlaps the Oculars plugin, but I do not see this as an issue. If the user wants to use the Oculars GUI, then they shouldn't put the toolbar in the same corner if they want to use it correctly. They can always turn off the Oculars GUI or choose any of the three other corners for the toolbars.

I tested the Calendar plugin now and only the vertical bar slightly overlaps, but as far as i can see it, the vertical bar also overlaps the info text even in its default position (bottom left) on smaller screens.

With the latest commit, the info panel shifts down and retracts when the horizontal bar is at the top. It also moves to the right if the vertical bar is at the top.

As for the comboboxes: sure, changed this in the latest commit.

@gzotti

gzotti commented Jul 3, 2026

Copy link
Copy Markdown
Member

OK, renamings can be made in a separate commit later. I tried it, and it does work quite well. However, when vertical bar is right, the mouse-over context help (tooltip) is not visible. I even like bottom-right as it avoids the InfoText collision. But the collision with the Oculars plugin button bar should be handled in Oculars. Not sure @alex-w @10110111, just enable a warning in the Oculars config GUI that main GUI should be moved to any other corner? Or can the button panel be moved out of the corner easily? The actual collision looks bad and will cause troubles.

Combobox is better, but side-by-side please, not stacked, to make better use of screen space. Or actually, as we in fact have only four settings, a single combobox in the upper area (Planetarium Options, bottom-right I see space for it) and a single enum property could be enough: Menu Bars: [0=bottom-left, 1=bottom-right, 2=top-left, 3=top-right].

@alex-w

alex-w commented Jul 3, 2026

Copy link
Copy Markdown
Member

I see issue for pixel distance between text and borders on toolbar (please see text when toolbar on bottom and on top).

@xLPMG

xLPMG commented Jul 3, 2026

Copy link
Copy Markdown
Contributor Author

I do like your suggestions of DialogMenuBar, ToolMenuBar and calling them "menu bars" together, but the term "toolbars" is already used throughout the project to refer to both of them, so I'd rather just stay consistent with the current code for now. (or rename everything consistenly but thats extra effort and complexity)

@alex-w

alex-w commented Jul 3, 2026

Copy link
Copy Markdown
Member

OK, renamings can be made in a separate commit later. I tried it, and it does work quite well. However, when vertical bar is right, the mouse-over context help (tooltip) is not visible. I even like bottom-right as it avoids the InfoText collision. But the collision with the Oculars plugin button bar should be handled in Oculars. Not sure @alex-w @10110111, just enable a warning in the Oculars config GUI that main GUI should be moved to any other corner? Or can the button panel be moved out of the corner easily? The actual collision looks bad and will cause troubles.

Oculars GUI panel created a bit hackish and I'm not sure that it can be moved easy... In any wat currently top-right variant give ugly look.

Combobox is better, but side-by-side please, not stacked, to make better use of screen space. Or actually, as we in fact have only four settings, a single combobox in the upper area (Planetarium Options, bottom-right I see space for it) and a single enum property could be enough: Menu Bars: [0=bottom-left, 1=bottom-right, 2=top-left, 3=top-right].

Hmm... Are you remember for hidden font settings (available for advanced users)? :) But yes, the new options should be more compact.

@gzotti

gzotti commented Jul 3, 2026

Copy link
Copy Markdown
Member

Hmm... Are you remember for hidden font settings (available for advanced users)? :) But yes, the new options should be more compact.

There is empty space right of "Screen button scale". The potentially hidden font area is above.

@gzotti

gzotti commented Jul 11, 2026

Copy link
Copy Markdown
Member

We could make drawing the Oculars GUI depend on toolbar corner not being top-right. It's not a setting you change all the time. If you use the plugin, just use another corner, or the Oculars GUI toolbar is not available.

@gzotti

gzotti commented Jul 16, 2026

Copy link
Copy Markdown
Member

Here is a first attempt to move the Oculars panel out of the way.

diff --git a/plugins/Oculars/src/gui/OcularsGuiPanel.cpp b/plugins/Oculars/src/gui/OcularsGuiPanel.cpp
index 609928f6ac..deb9c63166 100644
--- a/plugins/Oculars/src/gui/OcularsGuiPanel.cpp
+++ b/plugins/Oculars/src/gui/OcularsGuiPanel.cpp
@@ -19,7 +19,9 @@ Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA  02110-1335, USA.

 #include "Oculars.hpp"
 #include "OcularsGuiPanel.hpp"
+#include "SkyGui.hpp"
 #include "StelApp.hpp"
+#include "StelGui.hpp"
 #include "StelGuiItems.hpp"
 #include "StelTranslator.hpp"
 #include "StelActionMgr.hpp"
@@ -240,6 +242,10 @@ OcularsGuiPanel::OcularsGuiPanel(Oculars* plugin,
        //Night mode
        connect(&stelApp, SIGNAL(colorSchemeChanged(const QString&)), this, SLOT(setColorScheme(const QString&)));
        setColorScheme(stelApp.getCurrentStelStyle());
+
+
+       StelGui *gui=dynamic_cast<StelGui*>(StelApp::getInstance().getGui());
+       connect(gui, SIGNAL(toolbarCornerChanged(int)), this, SLOT(updatePosition()));
 }

 OcularsGuiPanel::~OcularsGuiPanel()
@@ -311,6 +317,7 @@ void OcularsGuiPanel::foldGui()

 void OcularsGuiPanel::updatePosition()
 {
+       const double cornerRadius = 12.0;
        updateGeometry();
        /*qDebug() << "Widget:" << size()
                << "Buttonbar:" << buttonBar->size()
@@ -320,11 +327,17 @@ void OcularsGuiPanel::updatePosition()
                << "Layout" << mainLayout->geometry();*/
        qreal xPos = parentWidget->size().width() - size().width();
        qreal yPos = 0;
+       const int buttonBarCorner=StelApp::getInstance().getStelPropertyManager()
+               ->getStelPropertyValue("StelGui.toolbarCorner").toInt(); // (0=BL, 1=BR, 2=TL, 3=TR)
+       if (buttonBarCorner ==3)
+       {
+               yPos += (cornerRadius + static_cast<SkyGui*>(parentWidget)->getLeftBarWidth());
+               xPos -= (cornerRadius + static_cast<SkyGui*>(parentWidget)->getBottomBarHeight());
+       }
        setPos(xPos, yPos);

        //Update border/shading
        QPainterPath newBorderPath;
-       double cornerRadius = 12.0;
        QPointF verticalBorderStart = geometry().topLeft() + QPointF(-0.5,0.5);
        QPointF horizontalBorderEnd = geometry().bottomRight() + QPointF(-0.5,0.5);
        QPointF cornerArcStart(verticalBorderStart.x(),
@@ -334,6 +347,7 @@ void OcularsGuiPanel::updatePosition()
        newBorderPath.arcTo(cornerArcStart.x(), cornerArcStart.y(), cornerRadius, cornerRadius, 180, 90);
        newBorderPath.lineTo(horizontalBorderEnd);
        newBorderPath.lineTo(horizontalBorderEnd.x(), verticalBorderStart.y());
+       newBorderPath.closeSubpath();
        borderPath->setPath(newBorderPath);
 }

(@10110111 I don't know why, but I cannot apply the new connect syntax here. --> EDIT: Solved)

@10110111

This comment was marked as resolved.

@gzotti

This comment was marked as resolved.

@gzotti

gzotti commented Jul 26, 2026

Copy link
Copy Markdown
Member

Any further work or comments here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

subsystem: gui The issue is related to GUI subsystem of planetarium...

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

Change Toolbar Position Change toolbar position

4 participants