mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-11-11 04:35:05 +01:00
qt: Only register graphics debugger as observer if visible. (#6875)
This commit is contained in:
parent
33a2113b71
commit
baca2bfc6b
@ -64,15 +64,22 @@ void GPUCommandStreamItemModel::OnGXCommandFinishedInternal(int total_command_co
|
||||
}
|
||||
|
||||
GPUCommandStreamWidget::GPUCommandStreamWidget(QWidget* parent)
|
||||
: QDockWidget(tr("Graphics Debugger"), parent) {
|
||||
: QDockWidget(tr("Graphics Debugger"), parent), model(this) {
|
||||
setObjectName(QStringLiteral("GraphicsDebugger"));
|
||||
|
||||
GPUCommandStreamItemModel* command_model = new GPUCommandStreamItemModel(this);
|
||||
g_debugger.RegisterObserver(command_model);
|
||||
|
||||
QListView* command_list = new QListView;
|
||||
command_list->setModel(command_model);
|
||||
auto* command_list = new QListView;
|
||||
command_list->setModel(&model);
|
||||
command_list->setFont(GetMonospaceFont());
|
||||
|
||||
setWidget(command_list);
|
||||
}
|
||||
|
||||
void GPUCommandStreamWidget::showEvent(QShowEvent* event) {
|
||||
g_debugger.RegisterObserver(&model);
|
||||
QDockWidget::showEvent(event);
|
||||
}
|
||||
|
||||
void GPUCommandStreamWidget::hideEvent(QHideEvent* event) {
|
||||
g_debugger.UnregisterObserver(&model);
|
||||
QDockWidget::hideEvent(event);
|
||||
}
|
||||
|
@ -37,5 +37,10 @@ class GPUCommandStreamWidget : public QDockWidget {
|
||||
public:
|
||||
GPUCommandStreamWidget(QWidget* parent = nullptr);
|
||||
|
||||
protected:
|
||||
void showEvent(QShowEvent* event) override;
|
||||
void hideEvent(QHideEvent* event) override;
|
||||
|
||||
private:
|
||||
GPUCommandStreamItemModel model;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user