cabana: Add menu item that resets the window layout (#28390)

pull/28394/head
Angus Gratton 2 years ago committed by GitHub
parent 67b27b7496
commit 92d8295096
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      tools/cabana/mainwin.cc
  2. 1
      tools/cabana/mainwin.h

@ -32,6 +32,9 @@ MainWindow::MainWindow() : QMainWindow() {
createStatusBar(); createStatusBar();
createShortcuts(); createShortcuts();
// save default window state to allow resetting it
default_state = saveState();
// restore states // restore states
restoreGeometry(settings.geometry); restoreGeometry(settings.geometry);
if (isMaximized()) { if (isMaximized()) {
@ -135,6 +138,10 @@ void MainWindow::createActions() {
commands_act->setDefaultWidget(new QUndoView(UndoStack::instance())); commands_act->setDefaultWidget(new QUndoView(UndoStack::instance()));
commands_menu->addAction(commands_act); commands_menu->addAction(commands_act);
edit_menu->addSeparator();
edit_menu->addAction(tr("Reset Window Layout"),
[this]() { restoreState(default_state); });
tools_menu = menuBar()->addMenu(tr("&Tools")); tools_menu = menuBar()->addMenu(tr("&Tools"));
tools_menu->addAction(tr("Find &Similar Bits"), this, &MainWindow::findSimilarBits); tools_menu->addAction(tr("Find &Similar Bits"), this, &MainWindow::findSimilarBits);
tools_menu->addAction(tr("&Find Signal"), this, &MainWindow::findSignal); tools_menu->addAction(tr("&Find Signal"), this, &MainWindow::findSignal);

@ -98,6 +98,7 @@ protected:
QString car_fingerprint; QString car_fingerprint;
int prev_undostack_index = 0; int prev_undostack_index = 0;
int prev_undostack_count = 0; int prev_undostack_count = 0;
QByteArray default_state;
friend class OnlineHelp; friend class OnlineHelp;
}; };

Loading…
Cancel
Save