mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-07 11:05:33 +08:00
refs #477, allow to detect an invisible dock widget parent by using CEnableForDockWidgetInfoArea for the view base
(by that I can tell if the parent dock widget is visible)
This commit is contained in:
committed by
Mathew Sutcliffe
parent
0c94922bd6
commit
3acf085b92
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "enablefordockwidgetinfoarea.h"
|
||||
#include "blackgui/guiutility.h"
|
||||
#include <QDockWidget>
|
||||
|
||||
using namespace BlackGui;
|
||||
|
||||
@@ -16,7 +17,6 @@ namespace BlackGui
|
||||
{
|
||||
namespace Components
|
||||
{
|
||||
|
||||
CEnableForDockWidgetInfoArea::CEnableForDockWidgetInfoArea(CDockWidgetInfoArea *parentInfoArea)
|
||||
{
|
||||
// it the parent is already an info area at this time, we keep it
|
||||
@@ -36,6 +36,12 @@ namespace BlackGui
|
||||
}
|
||||
|
||||
m_parentDockableInfoArea = parentDockableWidget;
|
||||
QMetaObject::Connection con = QDockWidget::connect(parentDockableWidget, &QDockWidget::destroyed, [this]
|
||||
{
|
||||
// break dependency to dockable widget
|
||||
this->m_parentDockableInfoArea = nullptr;
|
||||
});
|
||||
Q_ASSERT_X(con, Q_FUNC_INFO, "Connection failed");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,13 +16,13 @@
|
||||
#include "blackgui/dockwidgetinfoarea.h"
|
||||
#include "blackgui/infoarea.h"
|
||||
#include "blackgui/enableforframelesswindow.h"
|
||||
#include "blackmisc/qtconnectionlist.h"
|
||||
#include <QWidget>
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Components
|
||||
{
|
||||
|
||||
//! Helper class: If a component is residing in an dockable widget.
|
||||
//! This class provides access to its info area and dockable widget.
|
||||
class BLACKGUI_EXPORT CEnableForDockWidgetInfoArea
|
||||
@@ -34,6 +34,9 @@ namespace BlackGui
|
||||
//! Corresponding dockable widget in info area
|
||||
const BlackGui::CDockWidgetInfoArea *getDockWidgetInfoArea() const { return m_parentDockableInfoArea; }
|
||||
|
||||
//! Has dock area?
|
||||
bool hasDockWidgetArea() const { return m_parentDockableInfoArea; }
|
||||
|
||||
//! Corresponding dockable widget in info area
|
||||
//! \remarks Usually set from CDockWidgetInfoArea when it is fully initialized
|
||||
virtual bool setParentDockWidgetInfoArea(BlackGui::CDockWidgetInfoArea *parentDockableWidget);
|
||||
|
||||
@@ -97,10 +97,6 @@ namespace BlackGui
|
||||
foreach(CEnableForDockWidgetInfoArea * dwia, infoAreaDockWidgets)
|
||||
{
|
||||
Q_ASSERT_X(dwia, Q_FUNC_INFO, "Missing info area");
|
||||
|
||||
// KWB: potentially a risk when this object is deleted
|
||||
// but under normal situations the child object will be deleted as well, and we have
|
||||
// no multi-threaded GUI
|
||||
dwia->setParentDockWidgetInfoArea(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,6 @@ namespace BlackGui
|
||||
|
||||
//! The parent info areas
|
||||
const QList<const CInfoArea *> findParentInfoAreas() const;
|
||||
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -257,6 +257,11 @@ namespace BlackGui
|
||||
{
|
||||
if (!m_enabledLoadIndicator) { return; }
|
||||
if (this->m_showingLoadIndicator) { return; }
|
||||
if (this->hasDockWidgetArea())
|
||||
{
|
||||
if (!this->isVisibleWidget()) { return; }
|
||||
}
|
||||
|
||||
if (containerSizeDependent >= 0)
|
||||
{
|
||||
// really with indicator?
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#ifndef BLACKGUI_VIEWBASE_H
|
||||
#define BLACKGUI_VIEWBASE_H
|
||||
|
||||
#include "blackgui/components/enablefordockwidgetinfoarea.h"
|
||||
#include "blackgui/filters/filterdialog.h"
|
||||
#include "blackgui/filters/filterwidget.h"
|
||||
#include "blackgui/models/modelfilter.h"
|
||||
@@ -35,7 +36,8 @@ namespace BlackGui
|
||||
namespace Views
|
||||
{
|
||||
//! Non templated base class, allows Q_OBJECT and signals / slots to be used
|
||||
class BLACKGUI_EXPORT CViewBaseNonTemplate : public QTableView
|
||||
class BLACKGUI_EXPORT CViewBaseNonTemplate :
|
||||
public QTableView, public BlackGui::Components::CEnableForDockWidgetInfoArea
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
Reference in New Issue
Block a user