Shortcut bar: reopen at the cursor, wrap to a width the user sets

After customising, the bar now opens at the cursor like every other
time, instead of where the customising window was.

A size grip in the bar's corner sets its width. The tiles are laid out
in rows that wrap at that width, so a bar with many commands and pinned
elements becomes a block rather than one long strip; the height follows
the rows, and the width is saved. Until the user sets one, the tiles
stay on one row, as before. The grip is driven by hand: QSizeGrip asks
the window manager to resize, and on X11 a popup is not managed, so
nothing would happen. The hint line wraps rather than being cut off at
narrow widths.

The customising window remembers the size it was left at.

Discussion #1033.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ispyisail
2026-09-27 03:15:07 +13:00
parent 5bd55801e9
commit 47e5a8072b
4 changed files with 178 additions and 7 deletions
+28
View File
@@ -160,3 +160,31 @@ bool ShortcutBarSettings::hasElements(Context context)
const QStringList list = ids(context);
return std::any_of(list.cbegin(), list.cend(), &ShortcutBarSettings::isElement);
}
/**
@return the width the user gave the bar with its size grip, or 0 when
they never did: the tiles then stay on one row
*/
int ShortcutBarSettings::barWidth()
{
return QSettings().value(QStringLiteral("diagrameditor/shortcut_bar/width"), 0).toInt();
}
void ShortcutBarSettings::setBarWidth(int width)
{
QSettings().setValue(QStringLiteral("diagrameditor/shortcut_bar/width"), width);
}
/**
@return the size the user left the customising window at, or an invalid
size when it was never opened
*/
QSize ShortcutBarSettings::editorSize()
{
return QSettings().value(QStringLiteral("diagrameditor/shortcut_bar/editor_size")).toSize();
}
void ShortcutBarSettings::setEditorSize(const QSize &size)
{
QSettings().setValue(QStringLiteral("diagrameditor/shortcut_bar/editor_size"), size);
}