Right click to open panel and select tool (#2008)

* Right click to open panel and select tool

* Renamed slots
This commit is contained in:
Dearsh Oberoi
2021-10-27 14:10:32 +05:30
committed by GitHub
parent 2107ef38d0
commit de7eeb4d64
7 changed files with 50 additions and 6 deletions

View File

@@ -318,15 +318,47 @@ void CaptureWidget::initButtons()
if (visibleButtonTypes.contains(t)) {
connect(b,
&CaptureToolButton::pressedButton,
&CaptureToolButton::pressedButtonLeftClick,
this,
&CaptureWidget::setState);
&CaptureWidget::handleButtonLeftClick);
if (b->tool()->isSelectable()) {
connect(b,
&CaptureToolButton::pressedButtonRightClick,
this,
&CaptureWidget::handleButtonRightClick);
}
vectorButtons << b;
}
}
m_buttonHandler->setButtons(vectorButtons);
}
void CaptureWidget::handleButtonRightClick(CaptureToolButton* b)
{
if (!b) {
return;
}
// if button already selected, do not deselect it on right click
if (!m_activeButton || m_activeButton != b) {
setState(b);
}
if (!m_panel->isVisible()) {
m_panel->show();
}
}
void CaptureWidget::handleButtonLeftClick(CaptureToolButton* b)
{
if (!b) {
return;
}
setState(b);
}
void CaptureWidget::initHelpMessage()
{
QList<QPair<QString, QString>> keyMap;