Skip to content

Commit cababc2

Browse files
committed
Fixed issue with context menu being responsive on post side.
1 parent 2173ff2 commit cababc2

3 files changed

Lines changed: 16 additions & 7 deletions

File tree

FEBioStudio/GLView.cpp

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1351,8 +1351,14 @@ void CGLView::customInit()
13511351

13521352
void CGLView::ToggleContextMenu()
13531353
{
1354-
if (m_menu->visible()) m_menu->hide();
1355-
else m_menu->show();
1354+
GLViewSettings& vs = GetViewSettings();
1355+
vs.showContextMenu = !vs.showContextMenu;
1356+
1357+
if (m_menu)
1358+
{
1359+
if (vs.showContextMenu) m_menu->show();
1360+
else m_menu->hide();
1361+
}
13561362
update();
13571363
}
13581364

@@ -1899,18 +1905,18 @@ void CGLView::DrawWidgets(QPainter& painter)
18991905
}
19001906

19011907
// only show menu on model docs
1902-
bool isMenuVisible = (m_menu ? m_menu->visible() : false);
19031908
if (m_menu)
19041909
{
1910+
bool showMenu = GetViewSettings().showContextMenu;
19051911
if (dynamic_cast<CModelDocument*>(doc) == nullptr)
1906-
m_menu->hide();
1912+
showMenu = false;
1913+
1914+
if (showMenu && !m_menu->visible()) m_menu->show();
1915+
if (!showMenu && m_menu->visible()) m_menu->hide();
19071916
}
19081917

19091918
GLPainter glpainter(&painter, nullptr);
19101919
m_Widget->DrawWidgets(&glpainter);
1911-
1912-
// reset menu's visible status
1913-
if (m_menu && isMenuVisible) m_menu->show();
19141920
}
19151921

19161922
void CGLView::ShowMeshData(bool b)

GLLib/GLViewSettings.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,4 +118,6 @@ void GLViewSettings::Defaults(int ntheme)
118118
m_explode = false;
119119
m_explode_direction = EXPLODE_X;
120120
m_explode_strength = 0.5;
121+
122+
showContextMenu = true;
121123
}

GLLib/GLViewSettings.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ struct GLViewSettings
165165

166166
// UI
167167
int m_apply; //!< emulate apply via middle mouse button
168+
bool showContextMenu;
168169

169170
GLViewSettings() { Defaults(0); }
170171
void Defaults(int ntheme = 0);

0 commit comments

Comments
 (0)