diff --git a/share/qtcreator/welcomescreen/widgets/Delegate.qml b/share/qtcreator/welcomescreen/widgets/Delegate.qml index 23284c30f1e..ec76af2fd53 100644 --- a/share/qtcreator/welcomescreen/widgets/Delegate.qml +++ b/share/qtcreator/welcomescreen/widgets/Delegate.qml @@ -35,6 +35,18 @@ Rectangle { height: 240 width: 216 + Rectangle { + id: highlight + radius: 6 + visible: isHighlighted + color: colors.strongForegroundColor + anchors.fill: parent + anchors.topMargin: 2 + anchors.leftMargin: 4 + anchors.rightMargin: 4 + anchors.bottomMargin: 73 + } + property alias caption: captionItem.text property alias imageSource: imageItem.source property alias videoSource: videoIcon.source @@ -201,11 +213,11 @@ Rectangle { Rectangle { id: border color: "#00000000" - radius: 8 + radius: 6 anchors.rightMargin: 4 anchors.leftMargin: 4 anchors.bottomMargin: 4 - anchors.topMargin: 4 + anchors.topMargin: 1 visible: false anchors.fill: parent border.color: "#dddcdc" @@ -276,6 +288,11 @@ Rectangle { target: border visible: true } + + PropertyChanges { + target: highlight + opacity: 0 + } } ] diff --git a/src/plugins/qtsupport/exampleslistmodel.cpp b/src/plugins/qtsupport/exampleslistmodel.cpp index dbfab310722..602b70c17fb 100644 --- a/src/plugins/qtsupport/exampleslistmodel.cpp +++ b/src/plugins/qtsupport/exampleslistmodel.cpp @@ -167,6 +167,7 @@ ExamplesListModel::ExamplesListModel(QObject *parent) : roleNames[VideoUrl] = "videoUrl"; roleNames[VideoLength] = "videoLength"; roleNames[Platforms] = "platforms"; + roleNames[IsHighlighted] = "isHighlighted"; setRoleNames(roleNames); connect(Core::HelpManager::instance(), SIGNAL(setupFinished()), @@ -261,6 +262,10 @@ void ExamplesListModel::parseExamples(QXmlStreamReader *reader, item.projectPath = relativeOrInstallPath(item.projectPath, projectsOffset, examplesInstallPath); item.imageUrl = attributes.value(QLatin1String("imageUrl")).toString(); item.docUrl = attributes.value(QLatin1String("docUrl")).toString(); + + if (attributes.hasAttribute(QLatin1String("isHighlighted"))) + item.isHighlighted = attributes.value(QLatin1String("isHighlighted")).toString() == QLatin1String("true"); + } else if (reader->name() == QLatin1String("fileToOpen")) { item.filesToOpen.append(relativeOrInstallPath(reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement), projectsOffset, examplesInstallPath)); @@ -307,6 +312,10 @@ void ExamplesListModel::parseDemos(QXmlStreamReader *reader, item.projectPath = relativeOrInstallPath(item.projectPath, projectsOffset, demosInstallPath); item.imageUrl = attributes.value(QLatin1String("imageUrl")).toString(); item.docUrl = attributes.value(QLatin1String("docUrl")).toString(); + + if (attributes.hasAttribute(QLatin1String("isHighlighted"))) + item.isHighlighted = attributes.value(QLatin1String("isHighlighted")).toString() == QLatin1String("true"); + } else if (reader->name() == QLatin1String("fileToOpen")) { item.filesToOpen.append(relativeOrInstallPath(reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement), projectsOffset, demosInstallPath)); @@ -578,6 +587,13 @@ int ExamplesListModel::rowCount(const QModelIndex &) const return m_exampleItems.size(); } +QString prefixForItem(const ExampleItem &item) +{ + if (item.isHighlighted) + return QLatin1String("0000 "); + return QString(); +} + QVariant ExamplesListModel::data(const QModelIndex &index, int role) const { ensureInitialized(); @@ -590,7 +606,7 @@ QVariant ExamplesListModel::data(const QModelIndex &index, int role) const switch (role) { case Qt::DisplayRole: // for search only - return QString(item.name + QLatin1Char(' ') + item.tags.join(QLatin1String(" "))); + return QString(prefixForItem(item) + item.name + QLatin1Char(' ') + item.tags.join(QLatin1String(" "))); case Name: return item.name; case ProjectPath: @@ -621,6 +637,8 @@ QVariant ExamplesListModel::data(const QModelIndex &index, int role) const return item.videoLength; case Platforms: return item.platforms; + case IsHighlighted: + return item.isHighlighted; default: qDebug() << Q_FUNC_INFO << "role type not supported"; return QVariant(); diff --git a/src/plugins/qtsupport/exampleslistmodel.h b/src/plugins/qtsupport/exampleslistmodel.h index 978612af1b2..1a32c5b4930 100644 --- a/src/plugins/qtsupport/exampleslistmodel.h +++ b/src/plugins/qtsupport/exampleslistmodel.h @@ -44,7 +44,8 @@ enum ExampleRoles { Name = Qt::UserRole, ProjectPath, Description, ImageUrl, DocUrl, FilesToOpen, Tags, Difficulty, HasSourceCode, - Type, Dependencies, IsVideo, VideoUrl, VideoLength, Platforms + Type, Dependencies, IsVideo, VideoUrl, VideoLength, Platforms, + IsHighlighted }; enum InstructionalType @@ -54,7 +55,7 @@ enum InstructionalType struct ExampleItem { - ExampleItem(): difficulty(0), isVideo(false) {} + ExampleItem(): difficulty(0), isVideo(false), isHighlighted(false) {} InstructionalType type; QString name; QString projectPath; @@ -70,6 +71,7 @@ struct ExampleItem QString videoUrl; QString videoLength; QStringList platforms; + bool isHighlighted; }; class ExamplesListModel : public QAbstractListModel