QmlDesigner: Allow .ui.qml file in component creation

Change-Id: I3ae5822820c365d0cbc7d679c6365a25f34b1637
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Thomas Hartmann
2016-09-29 15:38:29 +02:00
parent 920386220b
commit 5a3aa3fc3e
4 changed files with 23 additions and 4 deletions

View File

@@ -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;