0
0
mirror of https://github.com/yse/easy_profiler.git synced 2024-12-26 08:01:51 +08:00

#125 [UI] fixed popup crash on Linux

This commit is contained in:
Victor Zarubkin 2019-10-06 17:34:42 +03:00
parent c9bef28533
commit d4b414eb73
3 changed files with 14 additions and 5 deletions

View File

@ -7,6 +7,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
find_package(Qt5Widgets)
if (Qt5Widgets_FOUND)
message(STATUS "Using Qt v${Qt5Widgets_VERSION}")
if (NOT("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") AND WIN32)
set(APPLICATION_PLATFORM WIN32)
endif ()

View File

@ -557,7 +557,7 @@ bool BackgroundItem::contains(const QPointF& scenePos) const
void BackgroundItem::onWindowActivationChanged(bool isActiveWindow)
{
if (!isActiveWindow)
if (!isActiveWindow && qApp->activeWindow() != m_tooltip)
{
delete m_tooltip;
m_tooltip = nullptr;
@ -705,11 +705,17 @@ BlocksGraphicsView::~BlocksGraphicsView()
void BlocksGraphicsView::onWindowActivationChanged()
{
const bool isActive = window()->isActiveWindow();
if (!isActive)
if (!isActive && qApp->activeWindow() != m_popupWidget)
{
removePopup();
}
if (m_backgroundItem != nullptr)
{
m_backgroundItem->onWindowActivationChanged(isActive);
}
}
void BlocksGraphicsView::removePopup()
{
@ -2921,9 +2927,11 @@ ThreadNamesWidget::~ThreadNamesWidget()
void ThreadNamesWidget::onWindowActivationChanged()
{
if (!window()->isActiveWindow())
if (!window()->isActiveWindow() && qApp->activeWindow() != m_popupWidget)
{
removePopup();
}
}
void ThreadNamesWidget::removePopup()
{

View File

@ -323,8 +323,8 @@ MainWindow::MainWindow() : Parent(), m_theme("default"), m_lastAddress("localhos
auto graphicsView = new DiagramWidget(this);
graphicsView->setObjectName("ProfilerGUI_Diagram_GraphicsView");
connect(this, &MainWindow::activationChanged, graphicsView->view(), &BlocksGraphicsView::onWindowActivationChanged);
connect(this, &MainWindow::activationChanged, graphicsView->threadsView(), &ThreadNamesWidget::onWindowActivationChanged);
connect(this, &MainWindow::activationChanged, graphicsView->view(), &BlocksGraphicsView::onWindowActivationChanged, Qt::QueuedConnection);
connect(this, &MainWindow::activationChanged, graphicsView->threadsView(), &ThreadNamesWidget::onWindowActivationChanged, Qt::QueuedConnection);
m_graphicsView->setWidget(graphicsView);
m_treeWidget = new DockWidget("Hierarchy", this);