forked from qt-creator/qt-creator
QmlDesigner: Allow .ui.qml file in component creation
Change-Id: I3ae5822820c365d0cbc7d679c6365a25f34b1637 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -51,6 +51,7 @@ ComponentNameDialog::~ComponentNameDialog()
|
||||
|
||||
bool ComponentNameDialog::go(QString *proposedName,
|
||||
QString *proposedPath,
|
||||
QString *proposedSuffix,
|
||||
const QStringList &properties,
|
||||
const QStringList &sourcePreview,
|
||||
const QString &oldFileName,
|
||||
@@ -60,6 +61,8 @@ bool ComponentNameDialog::go(QString *proposedName,
|
||||
Q_ASSERT(proposedName);
|
||||
Q_ASSERT(proposedPath);
|
||||
|
||||
const bool isUiFile = QFileInfo(oldFileName).completeSuffix() == "ui.qml";
|
||||
|
||||
ComponentNameDialog d(parent);
|
||||
d.ui->componentNameEdit->setNamespacesEnabled(false);
|
||||
d.ui->componentNameEdit->setLowerCaseFileName(false);
|
||||
@@ -71,6 +74,8 @@ bool ComponentNameDialog::go(QString *proposedName,
|
||||
d.ui->pathEdit->setHistoryCompleter(QLatin1String("QmlJs.Component.History"));
|
||||
d.ui->pathEdit->setPath(*proposedPath);
|
||||
d.ui->label->setText(tr("Property assignments for %1:").arg(oldFileName));
|
||||
d.ui->checkBox->setChecked(isUiFile);
|
||||
d.ui->checkBox->setVisible(isUiFile);
|
||||
d.m_sourcePreview = sourcePreview;
|
||||
|
||||
d.setProperties(properties);
|
||||
@@ -84,6 +89,11 @@ bool ComponentNameDialog::go(QString *proposedName,
|
||||
*proposedName = d.ui->componentNameEdit->text();
|
||||
*proposedPath = d.ui->pathEdit->path();
|
||||
|
||||
if (d.ui->checkBox->isChecked())
|
||||
*proposedSuffix = "ui.qml";
|
||||
else
|
||||
*proposedSuffix = "qml";
|
||||
|
||||
if (result)
|
||||
*result = d.propertiesToKeep();
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user