Make connection unique for annotation visibility actions

This event is sent three times at startup and two times per tab at tab
change, so let's make sure we setup the connections only once.
remotes/origin/work/aacid/annoying_braces
Simone Gaiarin 6 years ago committed by Albert Astals Cid
parent 1a581c4135
commit f2338f4022
  1. 4
      ui/annotationactionhandler.cpp

@ -715,8 +715,8 @@ void AnnotationActionHandler::setupAnnotationToolBarVisibilityAction()
Q_ASSERT(itToolBar != toolbars.end());
KToolBar *annotationToolBar = mw->toolBar(QStringLiteral("annotationToolBar"));
d->aShowToolBar->setChecked(annotationToolBar->isVisible());
connect(annotationToolBar, &QToolBar::visibilityChanged, d->aShowToolBar, &QAction::setChecked);
connect(d->aShowToolBar, &QAction::toggled, annotationToolBar, &KToolBar::setVisible);
connect(annotationToolBar, &QToolBar::visibilityChanged, d->aShowToolBar, &QAction::setChecked, Qt::UniqueConnection);
connect(d->aShowToolBar, &QAction::toggled, annotationToolBar, &KToolBar::setVisible, Qt::UniqueConnection);
connect(d->aShowToolBar, &QAction::toggled, this, [this](bool checked) { d->slotToolBarVisibilityChanged(checked); });
}

Loading…
Cancel
Save