Skip to content
Snippets Groups Projects
Commit 23bb4ff6 authored by Martin T. H. Sandsmark's avatar Martin T. H. Sandsmark Committed by Friedemann Kleint
Browse files

Custom wizard: Add setting for PathChooser's expectedKind.


Change-Id: Iff8955d0db20c5c00f8a1745ab1f4310482254cb
Reviewed-by: default avatarLeena Miettinen <riitta-leena.miettinen@digia.com>
Reviewed-by: default avatarDaniel Teske <daniel.teske@digia.com>
parent e255f15a
No related branches found
No related tags found
No related merge requests found
......@@ -431,13 +431,31 @@
\code
<field mandatory="true" name="QtCreatorSources">
<fieldcontrol class="Utils::PathChooser" defaulttext="" />
<fieldcontrol class="Utils::PathChooser" defaulttext="" expectedkind="existingdirectory"/>
<fielddescription>Qt Creator sources:</fielddescription>
</field>
\endcode
The \c defaulttext attribute specifies text that appears in the field by default.
The text attribute \c expectedkind specifies which type of path is expected:
\list
\li \c any accepts any kind of path.
\li \c file expects a file.
\li \c directory expects a directory.
\li \c existingdirectory expects an existing directory.
\li \c command expects an executable file.
\li \c existingcommand expects an existing, executable file.
\endlist
\section2 Check Boxes
To make check boxes appear selected by default, set the \c fieldcontrol attribute
......
......@@ -315,6 +315,20 @@ QWidget *CustomWizardFieldPage::registerPathChooser(const QString &fieldName,
const CustomWizardField &field)
{
Utils::PathChooser *pathChooser = new Utils::PathChooser;
const QString expectedKind = field.controlAttributes.value(QLatin1String("expectedkind")).toLower();
if (expectedKind == QLatin1String("existingdirectory"))
pathChooser->setExpectedKind(Utils::PathChooser::ExistingDirectory);
else if (expectedKind == QLatin1String("directory"))
pathChooser->setExpectedKind(Utils::PathChooser::Directory);
else if (expectedKind == QLatin1String("file"))
pathChooser->setExpectedKind(Utils::PathChooser::File);
else if (expectedKind == QLatin1String("existingcommand"))
pathChooser->setExpectedKind(Utils::PathChooser::ExistingCommand);
else if (expectedKind == QLatin1String("command"))
pathChooser->setExpectedKind(Utils::PathChooser::Command);
else if (expectedKind == QLatin1String("any"))
pathChooser->setExpectedKind(Utils::PathChooser::Any);
registerField(fieldName, pathChooser, "path", SIGNAL(changed(QString)));
const QString defaultText = field.controlAttributes.value(QLatin1String("defaulttext"));
m_pathChoosers.push_back(PathChooserData(pathChooser, defaultText));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment