mirror of
https://github.com/isledecomp/SIEdit.git
synced 2024-11-27 01:25:45 -05:00
app: reset data panel when a file is replaced
This commit is contained in:
parent
bc4ddfd7ac
commit
a1080e726a
3 changed files with 10 additions and 1 deletions
|
@ -146,13 +146,15 @@ void MainWindow::ReplaceObject(si::Object *obj)
|
|||
{
|
||||
QString s = QFileDialog::getOpenFileName(this, tr("Replace Object"));
|
||||
if (!s.isEmpty()) {
|
||||
if (!obj->ReplaceWithFile(
|
||||
if (obj->ReplaceWithFile(
|
||||
#ifdef Q_OS_WINDOWS
|
||||
s.toStdWString().c_str()
|
||||
#else
|
||||
s.toUtf8()
|
||||
#endif
|
||||
)) {
|
||||
static_cast<Panel*>(config_stack_->currentWidget())->ResetData();
|
||||
} else {
|
||||
QMessageBox::critical(this, QString(), tr("Failed to open to file \"%1\".").arg(s));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,11 @@ void Panel::SetData(void *data)
|
|||
}
|
||||
}
|
||||
|
||||
void Panel::ResetData()
|
||||
{
|
||||
SetData(data_);
|
||||
}
|
||||
|
||||
void Panel::FinishLayout()
|
||||
{
|
||||
outer_layout_->addStretch();
|
||||
|
|
|
@ -13,6 +13,8 @@ public:
|
|||
void *GetData() const { return data_; }
|
||||
void SetData(void *data);
|
||||
|
||||
void ResetData();
|
||||
|
||||
signals:
|
||||
|
||||
protected:
|
||||
|
|
Loading…
Reference in a new issue