mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-22 19:00:14 -05:00
citra-qt/command list: Do not recreate a widget after each selection
Recreating / replacing a widget is slow since it triggers a layout pass.
This commit is contained in:
parent
e663751f8b
commit
b335cce22e
1 changed files with 10 additions and 10 deletions
|
@ -262,7 +262,7 @@ void GPUCommandListWidget::OnCommandDoubleClicked(const QModelIndex& index) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GPUCommandListWidget::SetCommandInfo(const QModelIndex& index) {
|
void GPUCommandListWidget::SetCommandInfo(const QModelIndex& index) {
|
||||||
QWidget* new_info_widget;
|
QWidget* new_info_widget = nullptr;
|
||||||
|
|
||||||
const unsigned int command_id = list_widget->model()->data(index, GPUCommandListModel::CommandIdRole).toUInt();
|
const unsigned int command_id = list_widget->model()->data(index, GPUCommandListModel::CommandIdRole).toUInt();
|
||||||
if (COMMAND_IN_RANGE(command_id, texture0) ||
|
if (COMMAND_IN_RANGE(command_id, texture0) ||
|
||||||
|
@ -283,14 +283,15 @@ void GPUCommandListWidget::SetCommandInfo(const QModelIndex& index) {
|
||||||
auto info = Pica::DebugUtils::TextureInfo::FromPicaRegister(config, format);
|
auto info = Pica::DebugUtils::TextureInfo::FromPicaRegister(config, format);
|
||||||
u8* src = Memory::GetPhysicalPointer(config.GetPhysicalAddress());
|
u8* src = Memory::GetPhysicalPointer(config.GetPhysicalAddress());
|
||||||
new_info_widget = new TextureInfoWidget(src, info);
|
new_info_widget = new TextureInfoWidget(src, info);
|
||||||
} else {
|
|
||||||
new_info_widget = new QWidget;
|
|
||||||
}
|
}
|
||||||
|
if (command_info_widget) {
|
||||||
widget()->layout()->removeWidget(command_info_widget);
|
delete command_info_widget;
|
||||||
delete command_info_widget;
|
command_info_widget = nullptr;
|
||||||
widget()->layout()->addWidget(new_info_widget);
|
}
|
||||||
command_info_widget = new_info_widget;
|
if (new_info_widget) {
|
||||||
|
widget()->layout()->addWidget(new_info_widget);
|
||||||
|
command_info_widget = new_info_widget;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#undef COMMAND_IN_RANGE
|
#undef COMMAND_IN_RANGE
|
||||||
|
|
||||||
|
@ -328,7 +329,7 @@ GPUCommandListWidget::GPUCommandListWidget(QWidget* parent) : QDockWidget(tr("Pi
|
||||||
|
|
||||||
connect(copy_all, SIGNAL(clicked()), this, SLOT(CopyAllToClipboard()));
|
connect(copy_all, SIGNAL(clicked()), this, SLOT(CopyAllToClipboard()));
|
||||||
|
|
||||||
command_info_widget = new QWidget;
|
command_info_widget = nullptr;
|
||||||
|
|
||||||
QVBoxLayout* main_layout = new QVBoxLayout;
|
QVBoxLayout* main_layout = new QVBoxLayout;
|
||||||
main_layout->addWidget(list_widget);
|
main_layout->addWidget(list_widget);
|
||||||
|
@ -338,7 +339,6 @@ GPUCommandListWidget::GPUCommandListWidget(QWidget* parent) : QDockWidget(tr("Pi
|
||||||
sub_layout->addWidget(copy_all);
|
sub_layout->addWidget(copy_all);
|
||||||
main_layout->addLayout(sub_layout);
|
main_layout->addLayout(sub_layout);
|
||||||
}
|
}
|
||||||
main_layout->addWidget(command_info_widget);
|
|
||||||
main_widget->setLayout(main_layout);
|
main_widget->setLayout(main_layout);
|
||||||
|
|
||||||
setWidget(main_widget);
|
setWidget(main_widget);
|
||||||
|
|
Loading…
Reference in a new issue