Skip to content

Commit 079005d

Browse files
committed
Fixes #609 crash on startup when toggling sidebar visibility.
1 parent 0d28af6 commit 079005d

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/mainwindow.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ MainWindow::MainWindow(const QString &filePath, QWidget *parent)
115115
//
116116
editor->verticalScrollBar()->setStyle(new QCommonStyle());
117117
editor->horizontalScrollBar()->setStyle(new QCommonStyle());
118-
118+
119119
buildSidebar();
120120

121121
documentManager = new DocumentManager(editor, this);
@@ -1057,17 +1057,6 @@ void MainWindow::buildMenuBar()
10571057
htmlPreviewMenuAction->setChecked(appSettings->htmlPreviewVisible());
10581058
viewMenu->addAction(htmlPreviewMenuAction);
10591059

1060-
this->showSidebarAction = new QAction(tr("Show Sidebar"), this);
1061-
showSidebarAction->setCheckable(true);
1062-
showSidebarAction->setChecked(appSettings->sidebarVisible());
1063-
showSidebarAction->setShortcut(QKeySequence("CTRL+SPACE"));
1064-
showSidebarAction->setShortcutContext(Qt::WindowShortcut);
1065-
1066-
connect(this->showSidebarAction,
1067-
&QAction::toggled,
1068-
this,
1069-
&MainWindow::toggleSidebarVisible);
1070-
10711060
this->addAction(showSidebarAction);
10721061
viewMenu->addAction(showSidebarAction);
10731062

@@ -1313,6 +1302,17 @@ void MainWindow::buildStatusBar()
13131302

13141303
void MainWindow::buildSidebar()
13151304
{
1305+
this->showSidebarAction = new QAction(tr("Show Sidebar"), this);
1306+
showSidebarAction->setCheckable(true);
1307+
showSidebarAction->setChecked(appSettings->sidebarVisible());
1308+
showSidebarAction->setShortcut(QKeySequence("CTRL+SPACE"));
1309+
showSidebarAction->setShortcutContext(Qt::WindowShortcut);
1310+
1311+
connect(this->showSidebarAction,
1312+
&QAction::toggled,
1313+
this,
1314+
&MainWindow::toggleSidebarVisible);
1315+
13161316
cheatSheetWidget = new QListWidget(this);
13171317

13181318
cheatSheetWidget->setSelectionMode(QAbstractItemView::NoSelection);

0 commit comments

Comments
 (0)