The icon dialog can now be closed on request

This commit is contained in:
Ivan Čukić 2014-03-27 20:11:28 +01:00
parent f53a976ae7
commit 04bf0ddaed
3 changed files with 14 additions and 0 deletions

View File

@ -57,6 +57,14 @@ QString IconDialog::openDialog()
return dialog->openDialog();
}
void IconDialog::closeDialog()
{
if (d->dialog) {
auto dialog = d->dialog.instance();
dialog->close();
}
}
IconDialog::~IconDialog()
{
}

View File

@ -47,6 +47,7 @@ public:
~IconDialog();
Q_INVOKABLE QString openDialog();
Q_INVOKABLE void closeDialog();
private:
D_PTR;

View File

@ -41,6 +41,11 @@ public:
return ptr;
}
operator bool() const
{
return !s_instance.expired();
}
private:
static std::weak_ptr<Target> s_instance;
};