Added parameter to dialog
This commit is contained in:
parent
ebc961914d
commit
d4b3387be5
5 changed files with 44 additions and 7 deletions
|
@ -48,7 +48,7 @@ void LauncherTestsModel::openSampleDialogSync()
|
|||
void LauncherTestsModel::openWidgetDialog()
|
||||
{
|
||||
LOGI() << "cpp: before open ";
|
||||
RetVal<Val> rv = launcher()->open("musescore://devtools/launcher/testdialog");
|
||||
RetVal<Val> rv = launcher()->open("musescore://devtools/launcher/testdialog?title='And from its properties'");
|
||||
LOGI() << "cpp: after open ret: " << rv.ret.toString() << ", val: " << rv.val.toString();
|
||||
}
|
||||
|
||||
|
|
|
@ -38,3 +38,18 @@ TestDialog::~TestDialog()
|
|||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
QString TestDialog::title() const
|
||||
{
|
||||
return m_title;
|
||||
}
|
||||
|
||||
void TestDialog::setTitle(QString title)
|
||||
{
|
||||
if (m_title == title) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_title = title;
|
||||
ui->labelTestParam->setText(m_title);
|
||||
}
|
||||
|
|
|
@ -31,13 +31,24 @@ class TestDialog : public QDialog
|
|||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged)
|
||||
|
||||
public:
|
||||
TestDialog(const TestDialog& dialog);
|
||||
explicit TestDialog(QWidget* parent = nullptr);
|
||||
~TestDialog();
|
||||
|
||||
QString title() const;
|
||||
|
||||
public slots:
|
||||
void setTitle(QString title);
|
||||
|
||||
signals:
|
||||
void titleChanged(QString title);
|
||||
|
||||
private:
|
||||
Ui::TestDialog* ui;
|
||||
QString m_title;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,16 @@
|
|||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="2" column="0">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
|
@ -25,12 +35,12 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<widget class="QLabel" name="labelTestParam">
|
||||
<property name="text">
|
||||
<string>Test param</string>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -41,7 +41,8 @@ void UiModule::resolveImports()
|
|||
{
|
||||
auto lr = framework::ioc()->resolve<framework::ILauncherUriRegister>(moduleName());
|
||||
if (lr) {
|
||||
lr->registerUri("musescore://devtools/launcher/testdialog", QMetaType::type("TestDialog"));
|
||||
lr->registerUri("musescore://devtools/launcher/testdialog",
|
||||
ContainerMeta { ContainerType::QWidget, QMetaType::type("TestDialog") });
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue