Skip to content

Commit 38f10d6

Browse files
committed
Fix search field not always taking focus on startup
- Not sure if this is bug in Qt, but not setting the parent for ToolBar in the constructor seems to fix the issue
1 parent 4782cba commit 38f10d6

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

src/view/main_window.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ MainWindow::MainWindow()
5353
: m_aboutDlg(new Dialogs::AboutDialog(this))
5454
, m_settingsDlg(new Dialogs::SettingsDialog(this))
5555
, m_spinnerDlg(new Dialogs::SpinnerDialog(this))
56-
, m_toolBar(new Menus::ToolBar(this))
56+
, m_toolBar(new Menus::ToolBar)
5757
, m_whatsNewDlg(new Dialogs::WhatsNewDialog(this))
5858
, m_connectSelectedNodesAction(new QAction(tr("Connect selected nodes"), this))
5959
, m_disconnectSelectedNodesAction(new QAction(tr("Disconnect selected nodes"), this))

src/view/menus/tool_bar.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,8 @@
3333

3434
namespace Menus {
3535

36-
ToolBar::ToolBar(QWidget * parent)
37-
: QToolBar(parent)
38-
, m_autoSnapCheckBox(new QCheckBox(tr("Auto snap"), this))
36+
ToolBar::ToolBar()
37+
: m_autoSnapCheckBox(new QCheckBox(tr("Auto snap"), this))
3938
, m_copyOnDragCheckBox(new QCheckBox(tr("Copy on drag"), this))
4039
, m_cornerRadiusSpinBox(new QSpinBox(this))
4140
, m_arrowSizeSpinBox(new QDoubleSpinBox(this))

src/view/menus/tool_bar.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class ToolBar : public QToolBar
3939
Q_OBJECT
4040

4141
public:
42-
ToolBar(QWidget * parent = nullptr);
42+
ToolBar();
4343

4444
bool autoSnapEnabled() const;
4545

0 commit comments

Comments
 (0)