Commit 57f11f40 authored by Alessandro Portale's avatar Alessandro Portale
Browse files

Welcome: Store examples search text in settings



in QtCreator.ini under "WelcomePage/ExamplesSearchString".
The installer pre-set that setting, and in that way pre-
select a set of examples.

Change-Id: I8ac5a38ad0bd3f33875ef1997ccbf0352410dcc3
Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@digia.com>
parent dc66a01b
......@@ -56,8 +56,13 @@ Rectangle {
anchors.right: parent.right
anchors.leftMargin: 18
text: examplesModel.readSearchStringsFromSettings()
placeholderText: qsTr("Search in Examples...")
onTextChanged: examplesModel.parseSearchString(text)
onTextChanged: {
examplesModel.parseSearchString(text);
examplesModel.writeSearchStringToSettings(text);
}
}
ComboBox {
......
......@@ -54,6 +54,7 @@ static bool debugExamples()
}
static const char kSelectedExampleSetKey[] = "WelcomePage/SelectedExampleSet";
static const char kExamplesSearchStringKey[] = "WelcomePage/ExamplesSearchString";
void ExampleSetModel::writeCurrentIdToSettings(int currentIndex) const
{
......@@ -841,6 +842,16 @@ void ExamplesListModelFilter::filterForExampleSet(int index)
m_sourceModel->selectExampleSet(index);
}
void ExamplesListModelFilter::writeSearchStringToSettings(const QString &string)
{
Core::ICore::settings()->setValue(QLatin1String(kExamplesSearchStringKey), string);
}
QString ExamplesListModelFilter::readSearchStringsFromSettings()
{
return Core::ICore::settings()->value(QLatin1String(kExamplesSearchStringKey)).toString();
}
void ExamplesListModelFilter::setShowTutorialsOnly(bool showTutorialsOnly)
{
m_showTutorialsOnly = showTutorialsOnly;
......
......@@ -185,6 +185,8 @@ public:
QAbstractItemModel* exampleSetModel();
Q_INVOKABLE void filterForExampleSet(int index);
Q_INVOKABLE void writeSearchStringToSettings(const QString &string);
Q_INVOKABLE QString readSearchStringsFromSettings();
public slots:
void setFilterTags(const QStringList &arg)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment