* @brief Searches among the example projects based on the text introduce in the search bar of the welcome screen. * @param searchtext - the text based on which we'll have to search * @return Returns the results */
| 317 | * @return Returns the results |
| 318 | */ |
| 319 | QVariant WelcomeScreenHelper::searchExampleProjects(const QString& searchtext) { |
| 320 | QStringList results; |
| 321 | |
| 322 | // search based on tags |
| 323 | for (auto tag = m_tagMap.begin(); tag != m_tagMap.end(); ++tag) { |
| 324 | if (tag.key().contains(searchtext)) { |
| 325 | for (QString example : tag.value()) { |
| 326 | if (!results.contains(example)) |
| 327 | results.append(example); |
| 328 | } |
| 329 | } |
| 330 | } |
| 331 | |
| 332 | // search based on name |
| 333 | for (QString example : m_projectNameList) { |
| 334 | if (example.contains(searchtext) && !results.contains(example)) |
| 335 | results.append(example); |
| 336 | } |
| 337 | |
| 338 | return QVariant(results); |
| 339 | } |
| 340 | |
| 341 | /** |
| 342 | * @brief Sets the width scale for the given section, which will be saved. |