|
@@ -14,11 +14,6 @@ OutlinePopup::OutlinePopup(QToolButton *p_btn, QWidget *p_parent)
|
|
|
m_button(p_btn)
|
|
|
{
|
|
|
setupUI();
|
|
|
-
|
|
|
- connect(this, &QMenu::aboutToShow,
|
|
|
- this, [this]() {
|
|
|
- m_viewer->setFocus();
|
|
|
- });
|
|
|
}
|
|
|
|
|
|
void OutlinePopup::setupUI()
|
|
@@ -41,8 +36,12 @@ void OutlinePopup::showEvent(QShowEvent* p_event)
|
|
|
{
|
|
|
QMenu::showEvent(p_event);
|
|
|
|
|
|
- const auto p = pos();
|
|
|
- const auto btnRect = m_button->geometry();
|
|
|
- // Move it to right-aligned.
|
|
|
- move(p.x() + btnRect.width() - geometry().width(), p.y());
|
|
|
+ m_viewer->setFocus();
|
|
|
+
|
|
|
+ // Move it to be right-aligned.
|
|
|
+ if (m_button->isVisible()) {
|
|
|
+ const auto p = pos();
|
|
|
+ const auto btnRect = m_button->geometry();
|
|
|
+ move(p.x() + btnRect.width() - geometry().width(), p.y());
|
|
|
+ }
|
|
|
}
|