forked from qt-creator/qt-creator
Use categories for Tutorials page
Instead of adding the category into the title with "Help: ..." etc, use the actual categorized view that we already use for examples and marketplace. Set the corresponding meta data in the manifest file and read it also for tutorials. Change-Id: Id9081518c1c0afee8d080af3ca8a5dca5cdde775 Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -325,6 +325,21 @@ static bool isValidExampleOrDemo(ExampleItem *item)
|
||||
return ok || debugExamples();
|
||||
}
|
||||
|
||||
// ordered list of "known" categories
|
||||
// TODO this should be defined in the manifest
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(QStringList,
|
||||
defaultOrder,
|
||||
{QStringList() << "Application Examples"
|
||||
<< "Desktop"
|
||||
<< "Mobile"
|
||||
<< "Embedded"
|
||||
<< "Graphics"
|
||||
<< "Input/Output"
|
||||
<< "Connectivity"
|
||||
<< "Networking"
|
||||
<< "Positioning & Location"
|
||||
<< "Internationalization"});
|
||||
|
||||
void ExamplesViewController::updateExamples()
|
||||
{
|
||||
QString examplesInstallPath;
|
||||
@@ -366,9 +381,10 @@ void ExamplesViewController::updateExamples()
|
||||
}
|
||||
}
|
||||
|
||||
const bool sortIntoCategories = qtVersion >= *minQtVersionForCategories;
|
||||
const bool sortIntoCategories = !m_isExamples || qtVersion >= *minQtVersionForCategories;
|
||||
const QStringList order = m_isExamples ? *defaultOrder : QStringList();
|
||||
const QList<std::pair<Section, QList<ExampleItem *>>> sections
|
||||
= getCategories(items, sortIntoCategories);
|
||||
= getCategories(items, sortIntoCategories, order, m_isExamples);
|
||||
for (int i = 0; i < sections.size(); ++i) {
|
||||
m_view->addSection(sections.at(i).first,
|
||||
static_container_cast<ListItem *>(sections.at(i).second));
|
||||
|
||||
Reference in New Issue
Block a user