8#include "activityinfo.h"
9#include "concatenatetasksproxymodel.h"
10#include "flattentaskgroupsproxymodel.h"
11#include "taskfilterproxymodel.h"
12#include "taskgroupingproxymodel.h"
14#include "virtualdesktopinfo.h"
16#include "launchertasksmodel.h"
17#include "startuptasksmodel.h"
18#include "windowtasksmodel.h"
20#include "launchertasksmodel_p.h"
22#include <QGuiApplication>
32class Q_DECL_HIDDEN TasksModel::Private
35 Private(TasksModel *q);
38 static int instanceCount;
40 static WindowTasksModel *windowTasksModel;
41 static StartupTasksModel *startupTasksModel;
42 LauncherTasksModel *launcherTasksModel =
nullptr;
43 ConcatenateTasksProxyModel *concatProxyModel =
nullptr;
44 TaskFilterProxyModel *filterProxyModel =
nullptr;
45 TaskGroupingProxyModel *groupingProxyModel =
nullptr;
46 FlattenTaskGroupsProxyModel *flattenGroupsProxyModel =
nullptr;
47 AbstractTasksModelIface *abstractTasksSourceModel =
nullptr;
49 bool anyTaskDemandsAttention =
false;
51 int launcherCount = 0;
53 SortMode sortMode = SortAlpha;
54 bool separateLaunchers =
true;
55 bool launchInPlace =
false;
56 bool hideActivatedLaunchers =
true;
57 bool launchersEverSet =
false;
58 bool launcherSortingDirty =
false;
59 bool launcherCheckNeeded =
false;
62 bool sortRowInsertQueueStale =
false;
63 std::shared_ptr<VirtualDesktopInfo> virtualDesktopInfo;
65 std::shared_ptr<ActivityInfo> activityInfo;
67 bool groupInline =
false;
68 int groupingWindowTasksThreshold = -1;
70 bool usedByQml =
false;
71 bool componentComplete =
false;
74 void initLauncherTasksModel();
75 void updateAnyTaskDemandsAttention();
76 void updateManualSortMap();
77 void consolidateManualSortMapForGroup(
const QModelIndex &groupingProxyIndex);
78 void updateGroupInline();
80 void updateActivityTaskCounts();
88class TasksModel::TasksModelLessThan
91 inline TasksModelLessThan(
const QAbstractItemModel *s, TasksModel *p,
bool sortOnlyLaunchers)
94 , sortOnlyLaunchers(sortOnlyLaunchers)
98 inline bool operator()(
int r1,
int r2)
const
102 return tasksModel->d->lessThan(i1, i2, sortOnlyLaunchers);
107 const TasksModel *tasksModel;
108 bool sortOnlyLaunchers;
111int TasksModel::Private::instanceCount = 0;
112WindowTasksModel *TasksModel::Private::windowTasksModel =
nullptr;
113StartupTasksModel *TasksModel::Private::startupTasksModel =
nullptr;
115TasksModel::Private::Private(TasksModel *q)
121TasksModel::Private::~Private()
125 if (!instanceCount) {
126 delete windowTasksModel;
127 windowTasksModel =
nullptr;
128 delete startupTasksModel;
129 startupTasksModel =
nullptr;
133void TasksModel::Private::initModels()
143 concatProxyModel =
new ConcatenateTasksProxyModel(q);
145 if (!windowTasksModel) {
146 windowTasksModel =
new WindowTasksModel();
149 concatProxyModel->addSourceModel(windowTasksModel);
152 if (sortMode == SortActivity) {
153 updateActivityTaskCounts();
158 if (sortMode == SortActivity) {
159 updateActivityTaskCounts();
164 Q_EMIT q->activeTaskChanged();
172 Q_UNUSED(bottomRight)
174 if (sortMode == SortActivity && roles.
contains(AbstractTasksModel::Activities)) {
175 updateActivityTaskCounts();
178 if (roles.
contains(AbstractTasksModel::IsActive)) {
179 Q_EMIT q->activeTaskChanged();
190 if (sortMode == SortManual && roles.
contains(AbstractTasksModel::SkipTaskbar)) {
191 updateManualSortMap();
195 if (!startupTasksModel) {
196 startupTasksModel =
new StartupTasksModel();
199 concatProxyModel->addSourceModel(startupTasksModel);
206 if (sortMode != SortManual) {
210 const int delta = (
end -
start) + 1;
211 for (
auto it = sortedPreFilterRows.begin(); it != sortedPreFilterRows.end(); ++it) {
212 if ((*it) >=
start) {
217 for (
int i =
start; i <=
end; ++i) {
218 sortedPreFilterRows.append(i);
220 if (!separateLaunchers) {
221 if (sortRowInsertQueueStale) {
222 sortRowInsertQueue.clear();
223 sortRowInsertQueueStale =
false;
226 sortRowInsertQueue.append(sortedPreFilterRows.count() - 1);
237 if (sortMode == SortManual) {
238 updateManualSortMap();
246 if (sortMode != SortManual) {
250 if (sortRowInsertQueueStale) {
251 sortRowInsertQueue.clear();
252 sortRowInsertQueueStale =
false;
255 for (
int i = first; i <= last; ++i) {
256 sortedPreFilterRows.removeOne(i);
259 const int delta = (last - first) + 1;
260 for (
auto it = sortedPreFilterRows.begin(); it != sortedPreFilterRows.end(); ++it) {
267 filterProxyModel =
new TaskFilterProxyModel(q);
268 filterProxyModel->setSourceModel(concatProxyModel);
269 QObject::connect(filterProxyModel, &TaskFilterProxyModel::virtualDesktopChanged, q, &TasksModel::virtualDesktopChanged);
270 QObject::connect(filterProxyModel, &TaskFilterProxyModel::screenGeometryChanged, q, &TasksModel::screenGeometryChanged);
271 QObject::connect(filterProxyModel, &TaskFilterProxyModel::regionGeometryChanged, q, &TasksModel::regionGeometryChanged);
272 QObject::connect(filterProxyModel, &TaskFilterProxyModel::activityChanged, q, &TasksModel::activityChanged);
273 QObject::connect(filterProxyModel, &TaskFilterProxyModel::filterByVirtualDesktopChanged, q, &TasksModel::filterByVirtualDesktopChanged);
274 QObject::connect(filterProxyModel, &TaskFilterProxyModel::filterByScreenChanged, q, &TasksModel::filterByScreenChanged);
275 QObject::connect(filterProxyModel, &TaskFilterProxyModel::filterByActivityChanged, q, &TasksModel::filterByActivityChanged);
276 QObject::connect(filterProxyModel, &TaskFilterProxyModel::filterByRegionChanged, q, &TasksModel::filterByRegionChanged);
277 QObject::connect(filterProxyModel, &TaskFilterProxyModel::filterMinimizedChanged, q, &TasksModel::filterMinimizedChanged);
278 QObject::connect(filterProxyModel, &TaskFilterProxyModel::filterNotMinimizedChanged, q, &TasksModel::filterNotMinimizedChanged);
279 QObject::connect(filterProxyModel, &TaskFilterProxyModel::filterNotMaximizedChanged, q, &TasksModel::filterNotMaximizedChanged);
280 QObject::connect(filterProxyModel, &TaskFilterProxyModel::filterHiddenChanged, q, &TasksModel::filterHiddenChanged);
282 groupingProxyModel =
new TaskGroupingProxyModel(q);
283 groupingProxyModel->setSourceModel(filterProxyModel);
284 QObject::connect(groupingProxyModel, &TaskGroupingProxyModel::groupModeChanged, q, &TasksModel::groupModeChanged);
285 QObject::connect(groupingProxyModel, &TaskGroupingProxyModel::blacklistedAppIdsChanged, q, &TasksModel::groupingAppIdBlacklistChanged);
286 QObject::connect(groupingProxyModel, &TaskGroupingProxyModel::blacklistedLauncherUrlsChanged, q, &TasksModel::groupingLauncherUrlBlacklistChanged);
290 if (sortMode == SortManual) {
291 consolidateManualSortMapForGroup(parent);
298 bool demandsAttentionUpdateNeeded =
false;
300 for (
int i = first; i <= last; ++i) {
301 const QModelIndex &sourceIndex = groupingProxyModel->index(i, 0);
304 if (sourceIndex.
data(AbstractTasksModel::IsDemandingAttention).
toBool()) {
305 demandsAttentionUpdateNeeded =
true;
309 if (sourceIndex.
data(AbstractTasksModel::IsWindow).
toBool()) {
312 for (
int j = 0; j < filterProxyModel->rowCount(); ++j) {
313 QModelIndex filterIndex = filterProxyModel->index(j, 0);
315 if (!filterIndex.
data(AbstractTasksModel::IsStartup).
toBool()) {
321 Q_EMIT filterProxyModel->dataChanged(filterIndex, filterIndex);
327 if (sourceIndex.
data(AbstractTasksModel::IsWindow).
toBool() || sourceIndex.
data(AbstractTasksModel::IsStartup).
toBool()) {
328 for (
int j = 0; j < filterProxyModel->rowCount(); ++j) {
329 const QModelIndex &filterIndex = filterProxyModel->index(j, 0);
331 if (!filterIndex.
data(AbstractTasksModel::IsLauncher).
toBool()) {
335 if (appsMatch(sourceIndex, filterIndex)) {
336 Q_EMIT filterProxyModel->dataChanged(filterIndex, filterIndex);
342 if (!anyTaskDemandsAttention && demandsAttentionUpdateNeeded) {
343 updateAnyTaskDemandsAttention();
353 for (
int i = first; i <= last; ++i) {
354 const QModelIndex &sourceIndex = groupingProxyModel->index(i, 0);
369 if (!launcherCheckNeeded && launcherTasksModel
370 && (sourceIndex.
data(AbstractTasksModel::IsWindow).
toBool() || sourceIndex.
data(AbstractTasksModel::IsStartup).
toBool())) {
371 launcherCheckNeeded =
true;
381 if (launcherCheckNeeded) {
382 for (
int i = 0; i < filterProxyModel->rowCount(); ++i) {
383 const QModelIndex &idx = filterProxyModel->index(i, 0);
385 if (idx.
data(AbstractTasksModel::IsLauncher).
toBool()) {
386 Q_EMIT filterProxyModel->dataChanged(idx, idx);
390 launcherCheckNeeded =
false;
396 if (anyTaskDemandsAttention) {
397 updateAnyTaskDemandsAttention();
406 Q_UNUSED(bottomRight)
413 if (roles.
isEmpty() || roles.
contains(AbstractTasksModel::IsDemandingAttention)) {
414 updateAnyTaskDemandsAttention();
418 for (
int i = topLeft.
row(); i <= bottomRight.
row(); ++i) {
419 const QModelIndex &sourceIndex = groupingProxyModel->index(i, 0);
423 if (sourceIndex.
data(AbstractTasksModel::IsWindow).
toBool()) {
424 for (
int i = 0; i < filterProxyModel->rowCount(); ++i) {
425 const QModelIndex &filterIndex = filterProxyModel->index(i, 0);
427 if (!filterIndex.
data(AbstractTasksModel::IsLauncher).
toBool()) {
431 if (appsMatch(sourceIndex, filterIndex)) {
432 Q_EMIT filterProxyModel->dataChanged(filterIndex, filterIndex);
442 updateAnyTaskDemandsAttention();
446void TasksModel::Private::updateAnyTaskDemandsAttention()
448 bool taskFound =
false;
450 for (
int i = 0; i < groupingProxyModel->rowCount(); ++i) {
451 if (groupingProxyModel->index(i, 0).data(AbstractTasksModel::IsDemandingAttention).toBool()) {
457 if (taskFound != anyTaskDemandsAttention) {
458 anyTaskDemandsAttention = taskFound;
459 Q_EMIT q->anyTaskDemandsAttentionChanged();
463void TasksModel::Private::initLauncherTasksModel()
465 if (launcherTasksModel) {
469 launcherTasksModel =
new LauncherTasksModel(q);
470 QObject::connect(launcherTasksModel, &LauncherTasksModel::launcherListChanged, q, &TasksModel::launcherListChanged);
471 QObject::connect(launcherTasksModel, &LauncherTasksModel::launcherListChanged, q, &TasksModel::updateLauncherCount);
478 QObject::connect(launcherTasksModel, &LauncherTasksModel::launcherListChanged, q, [
this]() {
479 Q_EMIT q->dataChanged(q->index(0, 0), q->index(q->rowCount() - 1, 0),
QList<int>{AbstractTasksModel::HasLauncher});
485 if (roles.
contains(AbstractTasksModel::AppId) || roles.
contains(AbstractTasksModel::LauncherUrlWithoutIcon)) {
486 for (
int i = topLeft.
row(); i <= bottomRight.
row(); ++i) {
489 if (!index.
data(AbstractTasksModel::IsLauncher).
toBool()) {
490 Q_EMIT q->dataChanged(index, index,
QList<int>{AbstractTasksModel::HasLauncher});
496 concatProxyModel->addSourceModel(launcherTasksModel);
499void TasksModel::Private::updateManualSortMap()
502 if (sortedPreFilterRows.isEmpty()) {
503 sortedPreFilterRows.reserve(concatProxyModel->rowCount());
505 for (
int i = 0; i < concatProxyModel->rowCount(); ++i) {
506 sortedPreFilterRows.append(i);
510 TasksModelLessThan lt(concatProxyModel, q,
false);
511 std::stable_sort(sortedPreFilterRows.begin(), sortedPreFilterRows.end(), lt);
514 if (q->groupMode() != GroupDisabled) {
515 for (
int i = 0; i < groupingProxyModel->rowCount(); ++i) {
516 const QModelIndex &groupingIndex = groupingProxyModel->index(i, 0);
518 if (groupingIndex.
data(AbstractTasksModel::IsGroupParent).
toBool()) {
519 consolidateManualSortMapForGroup(groupingIndex);
528 if (separateLaunchers) {
530 TasksModelLessThan lt(concatProxyModel, q,
true);
531 std::stable_sort(sortedPreFilterRows.begin(), sortedPreFilterRows.end(), lt);
537 while (i.hasNext()) {
540 const int row = i.value();
541 const QModelIndex &idx = concatProxyModel->index(sortedPreFilterRows.at(row), 0);
550 if (idx.
data(AbstractTasksModel::IsWindow).
toBool() && idx.
data(AbstractTasksModel::SkipTaskbar).
toBool()) {
562 sortRowInsertQueueStale =
true;
573 if (launchersEverSet && !idx.
data(AbstractTasksModel::IsLauncher).
toBool()) {
574 for (
int j = (row - 1); j >= 0; --j) {
575 const QModelIndex &concatProxyIndex = concatProxyModel->index(sortedPreFilterRows.at(j), 0);
580 if (appsMatch(concatProxyIndex, idx) && filterProxyModel->acceptsRow(concatProxyIndex.
row())) {
581 sortedPreFilterRows.move(row, j + 1);
594 if (!moved && idx.
data(AbstractTasksModel::IsLauncher).
toBool()) {
595 for (
int j = 0; j < row; ++j) {
596 const QModelIndex &concatProxyIndex = concatProxyModel->index(sortedPreFilterRows.at(j), 0);
598 if (concatProxyIndex.
data(AbstractTasksModel::IsLauncher).
toBool()
599 || launcherTasksModel->launcherPosition(concatProxyIndex.
data(AbstractTasksModel::LauncherUrlWithoutIcon).
toUrl()) != -1) {
606 sortedPreFilterRows.move(row, insertPos);
612 if (moved && !launchersEverSet) {
613 for (
int j = (sortedPreFilterRows.count() - 1); j >= 0; --j) {
614 const QModelIndex &concatProxyIndex = concatProxyModel->index(sortedPreFilterRows.at(j), 0);
616 if (!concatProxyIndex.
data(AbstractTasksModel::IsLauncher).
toBool()
617 && idx.
data(AbstractTasksModel::LauncherUrlWithoutIcon) == concatProxyIndex.
data(AbstractTasksModel::LauncherUrlWithoutIcon)) {
618 sortedPreFilterRows.move(j, insertPos);
630void TasksModel::Private::consolidateManualSortMapForGroup(
const QModelIndex &groupingProxyIndex)
635 const int childCount = groupingProxyModel->rowCount(groupingProxyIndex);
641 const QModelIndex &leader = groupingProxyModel->index(0, 0, groupingProxyIndex);
642 const QModelIndex &preFilterLeader = filterProxyModel->mapToSource(groupingProxyModel->mapToSource(leader));
646 for (
int i = 1; i < childCount; ++i) {
647 const QModelIndex &child = groupingProxyModel->index(i, 0, groupingProxyIndex);
648 const QModelIndex &preFilterChild = filterProxyModel->mapToSource(groupingProxyModel->mapToSource(child));
649 const int leaderPos = sortedPreFilterRows.indexOf(preFilterLeader.
row());
650 const int childPos = sortedPreFilterRows.indexOf(preFilterChild.
row());
651 const int insertPos = (leaderPos + i) + ((leaderPos + i) > childPos ? -1 : 0);
652 sortedPreFilterRows.move(childPos, insertPos);
656void TasksModel::Private::updateGroupInline()
658 if (usedByQml && !componentComplete) {
662 bool hadSourceModel = (q->sourceModel() !=
nullptr);
664 if (q->groupMode() != GroupDisabled && groupInline) {
665 if (flattenGroupsProxyModel) {
672 groupingProxyModel->setGroupDemandingAttention(
true);
676 groupingProxyModel->setWindowTasksThreshold(-1);
678 flattenGroupsProxyModel =
new FlattenTaskGroupsProxyModel(q);
679 flattenGroupsProxyModel->setSourceModel(groupingProxyModel);
681 abstractTasksSourceModel = flattenGroupsProxyModel;
682 q->setSourceModel(flattenGroupsProxyModel);
684 if (sortMode == SortManual) {
688 if (hadSourceModel && !flattenGroupsProxyModel) {
692 groupingProxyModel->setGroupDemandingAttention(
false);
693 groupingProxyModel->setWindowTasksThreshold(groupingWindowTasksThreshold);
695 abstractTasksSourceModel = groupingProxyModel;
696 q->setSourceModel(groupingProxyModel);
698 delete flattenGroupsProxyModel;
699 flattenGroupsProxyModel =
nullptr;
701 if (hadSourceModel && sortMode == SortManual) {
708 if (!hadSourceModel) {
722 if (flattenGroupsProxyModel) {
723 return filterProxyModel->mapToSource(groupingProxyModel->mapToSource(flattenGroupsProxyModel->mapToSource(sourceIndex)));
725 return filterProxyModel->mapToSource(groupingProxyModel->mapToSource(sourceIndex));
729void TasksModel::Private::updateActivityTaskCounts()
733 activityTaskCounts.clear();
735 if (!windowTasksModel || !activityInfo) {
739 for (
const auto activities = activityInfo->runningActivities();
const QString &activity : activities) {
740 activityTaskCounts.insert(activity, 0);
743 for (
int i = 0; i < windowTasksModel->rowCount(); ++i) {
744 const QModelIndex &windowIndex = windowTasksModel->index(i, 0);
750 while (it.hasNext()) {
752 it.setValue(it.value() + 1);
755 for (
const QString &activity : activities) {
756 ++activityTaskCounts[activity];
762void TasksModel::Private::forceResort()
766 q->setDynamicSortFilter(
false);
767 q->setDynamicSortFilter(
true);
770bool TasksModel::Private::lessThan(
const QModelIndex &left,
const QModelIndex &right,
bool sortOnlyLaunchers)
const
776 if (separateLaunchers) {
777 if (
left.data(AbstractTasksModel::IsLauncher).toBool() &&
right.data(AbstractTasksModel::IsLauncher).toBool()) {
779 }
else if (
left.data(AbstractTasksModel::IsLauncher).toBool() && !
right.data(AbstractTasksModel::IsLauncher).toBool()) {
781 const int leftPos = q->launcherPosition(
left.data(AbstractTasksModel::LauncherUrlWithoutIcon).toUrl());
782 const int rightPos = q->launcherPosition(
right.data(AbstractTasksModel::LauncherUrlWithoutIcon).toUrl());
784 if (rightPos != -1) {
785 return (leftPos < rightPos);
790 }
else if (!
left.data(AbstractTasksModel::IsLauncher).toBool() &&
right.data(AbstractTasksModel::IsLauncher).toBool()) {
792 const int leftPos = q->launcherPosition(
left.data(AbstractTasksModel::LauncherUrlWithoutIcon).toUrl());
793 const int rightPos = q->launcherPosition(
right.data(AbstractTasksModel::LauncherUrlWithoutIcon).toUrl());
796 return (leftPos < rightPos);
801 }
else if (launchInPlace) {
802 const int leftPos = q->launcherPosition(
left.data(AbstractTasksModel::LauncherUrlWithoutIcon).toUrl());
803 const int rightPos = q->launcherPosition(
right.data(AbstractTasksModel::LauncherUrlWithoutIcon).toUrl());
805 if (leftPos != -1 && rightPos != -1) {
806 return (leftPos < rightPos);
807 }
else if (leftPos != -1 && rightPos == -1) {
809 }
else if (leftPos == -1 && rightPos != -1) {
816 if (sortOnlyLaunchers && !sortedPreFilterRows.isEmpty()) {
817 return (sortedPreFilterRows.indexOf(
left.row()) < sortedPreFilterRows.indexOf(
right.row()));
822 case SortLastActivated: {
823 QTime leftSortTime, rightSortTime;
826 if (
left.parent().isValid()) {
827 leftSortTime =
left.parent().data(AbstractTasksModel::LastActivated).toTime();
829 leftSortTime =
left.data(AbstractTasksModel::LastActivated).toTime();
836 if (
right.parent().isValid()) {
837 rightSortTime =
right.parent().data(AbstractTasksModel::LastActivated).toTime();
839 rightSortTime =
right.data(AbstractTasksModel::LastActivated).toTime();
842 if (!rightSortTime.
isValid()) {
846 if (leftSortTime != rightSortTime) {
848 return leftSortTime > rightSortTime;
854 case SortVirtualDesktop: {
855 const bool leftAll =
left.data(AbstractTasksModel::IsOnAllVirtualDesktops).toBool();
856 const bool rightAll =
right.data(AbstractTasksModel::IsOnAllVirtualDesktops).toBool();
858 if (leftAll && !rightAll) {
860 }
else if (rightAll && !leftAll) {
864 if (!(leftAll && rightAll)) {
865 const QVariantList &leftDesktops =
left.data(AbstractTasksModel::VirtualDesktops).toList();
867 int leftDesktopPos = virtualDesktopInfo->numberOfDesktops();
869 for (
const QVariant &desktop : leftDesktops) {
870 const int desktopPos = virtualDesktopInfo->position(desktop);
872 if (desktopPos <= leftDesktopPos) {
873 leftDesktop = desktop;
874 leftDesktopPos = desktopPos;
878 const QVariantList &rightDesktops =
right.data(AbstractTasksModel::VirtualDesktops).toList();
880 int rightDesktopPos = virtualDesktopInfo->numberOfDesktops();
882 for (
const QVariant &desktop : rightDesktops) {
883 const int desktopPos = virtualDesktopInfo->position(desktop);
885 if (desktopPos <= rightDesktopPos) {
886 rightDesktop = desktop;
887 rightDesktopPos = desktopPos;
891 if (!leftDesktop.
isNull() && !rightDesktop.
isNull() && (leftDesktop != rightDesktop)) {
892 return (virtualDesktopInfo->position(leftDesktop) < virtualDesktopInfo->position(rightDesktop));
893 }
else if (!leftDesktop.
isNull() && rightDesktop.
isNull()) {
895 }
else if (leftDesktop.
isNull() && !rightDesktop.
isNull()) {
906 const QStringList &leftActivities =
left.data(AbstractTasksModel::Activities).toStringList();
907 int leftScore = std::accumulate(leftActivities.
cbegin(), leftActivities.
cend(), -1, [
this](
int a,
const QString &activity) {
908 return a + activityTaskCounts[activity];
911 const QStringList &rightActivities =
right.data(AbstractTasksModel::Activities).toStringList();
912 int rightScore = std::accumulate(rightActivities.
cbegin(), rightActivities.
cend(), -1, [
this](
int a,
const QString &activity) {
913 return a + activityTaskCounts[activity];
916 if (leftScore == -1 || rightScore == -1) {
917 const int sumScore = std::accumulate(activityTaskCounts.constBegin(), activityTaskCounts.constEnd(), 0);
919 if (leftScore == -1) {
920 leftScore = sumScore;
923 if (rightScore == -1) {
924 rightScore = sumScore;
928 if (leftScore != rightScore) {
929 return (leftScore > rightScore);
936 if (sortMode == SortDisabled) {
955 QString leftSortString =
left.data(AbstractTasksModel::AppName).toString();
957 if (leftSortString.
isEmpty()) {
961 QString rightSortString =
right.data(AbstractTasksModel::AppName).toString();
963 if (rightSortString.
isEmpty()) {
970 if (sortResult == 0) {
974 return (sortResult < 0);
980TasksModel::TasksModel(
QObject *parent)
982 , d(new Private(this))
989 connect(
this, &TasksModel::sourceModelChanged,
this, &TasksModel::countChanged);
1000 d->updateGroupInline();
1004TasksModel::~TasksModel()
1010 if (d->windowTasksModel) {
1011 return d->windowTasksModel->roleNames();
1017int TasksModel::rowCount(
const QModelIndex &parent)
const
1024 if (role == AbstractTasksModel::HasLauncher && proxyIndex.
isValid() && proxyIndex.
row() < rowCount()) {
1025 if (proxyIndex.
data(AbstractTasksModel::IsLauncher).
toBool()) {
1028 if (!d->launcherTasksModel) {
1031 for (
int i = 0; i < d->launcherTasksModel->rowCount(); ++i) {
1032 const QModelIndex &launcherIndex = d->launcherTasksModel->index(i, 0);
1034 if (appsMatch(proxyIndex, launcherIndex)) {
1041 }
else if (rowCount(proxyIndex) && role == AbstractTasksModel::WinIdList) {
1042 QVariantList winIds;
1044 for (
int i = 0; i < rowCount(proxyIndex); ++i) {
1045 winIds.append(index(i, 0, proxyIndex).data(AbstractTasksModel::WinIdList).toList());
1054void TasksModel::updateLauncherCount()
1056 if (!d->launcherTasksModel) {
1062 for (
int i = 0; i < rowCount(); ++i) {
1063 if (index(i, 0).data(AbstractTasksModel::IsLauncher).toBool()) {
1068 if (d->launcherCount != count) {
1069 d->launcherCount = count;
1070 Q_EMIT launcherCountChanged();
1074int TasksModel::launcherCount()
const
1076 return d->launcherCount;
1079bool TasksModel::anyTaskDemandsAttention()
const
1081 return d->anyTaskDemandsAttention;
1086 return d->filterProxyModel->virtualDesktop();
1089void TasksModel::setVirtualDesktop(
const QVariant &desktop)
1091 d->filterProxyModel->setVirtualDesktop(desktop);
1096 return d->filterProxyModel->screenGeometry();
1099void TasksModel::setScreenGeometry(
const QRect &geometry)
1101 d->filterProxyModel->setScreenGeometry(geometry);
1106 return d->filterProxyModel->regionGeometry();
1109void TasksModel::setRegionGeometry(
const QRect &geometry)
1111 d->filterProxyModel->setRegionGeometry(geometry);
1116 return d->filterProxyModel->activity();
1119void TasksModel::setActivity(
const QString &activity)
1121 d->filterProxyModel->setActivity(activity);
1124bool TasksModel::filterByVirtualDesktop()
const
1126 return d->filterProxyModel->filterByVirtualDesktop();
1129void TasksModel::setFilterByVirtualDesktop(
bool filter)
1131 d->filterProxyModel->setFilterByVirtualDesktop(filter);
1134bool TasksModel::filterByScreen()
const
1136 return d->filterProxyModel->filterByScreen();
1139void TasksModel::setFilterByScreen(
bool filter)
1141 d->filterProxyModel->setFilterByScreen(filter);
1144bool TasksModel::filterByActivity()
const
1146 return d->filterProxyModel->filterByActivity();
1149void TasksModel::setFilterByActivity(
bool filter)
1151 d->filterProxyModel->setFilterByActivity(filter);
1154RegionFilterMode::Mode TasksModel::filterByRegion()
const
1156 return d->filterProxyModel->filterByRegion();
1159void TasksModel::setFilterByRegion(RegionFilterMode::Mode mode)
1161 d->filterProxyModel->setFilterByRegion(mode);
1164bool TasksModel::filterMinimized()
const
1166 return d->filterProxyModel->filterMinimized();
1169void TasksModel::setFilterMinimized(
bool filter)
1171 d->filterProxyModel->setFilterMinimized(filter);
1174bool TasksModel::filterNotMinimized()
const
1176 return d->filterProxyModel->filterNotMinimized();
1179void TasksModel::setFilterNotMinimized(
bool filter)
1181 d->filterProxyModel->setFilterNotMinimized(filter);
1184bool TasksModel::filterNotMaximized()
const
1186 return d->filterProxyModel->filterNotMaximized();
1189void TasksModel::setFilterNotMaximized(
bool filter)
1191 d->filterProxyModel->setFilterNotMaximized(filter);
1194bool TasksModel::filterHidden()
const
1196 return d->filterProxyModel->filterHidden();
1199void TasksModel::setFilterHidden(
bool filter)
1201 d->filterProxyModel->setFilterHidden(filter);
1211 if (d->sortMode != mode) {
1212 if (mode == SortManual) {
1213 d->updateManualSortMap();
1214 }
else if (d->sortMode == SortManual) {
1215 d->sortedPreFilterRows.clear();
1218 if (mode == SortVirtualDesktop) {
1219 d->virtualDesktopInfo = virtualDesktopInfo();
1220 setSortRole(AbstractTasksModel::VirtualDesktops);
1221 }
else if (d->sortMode == SortVirtualDesktop) {
1222 d->virtualDesktopInfo =
nullptr;
1226 if (mode == SortActivity) {
1227 d->activityInfo = activityInfo();
1229 d->updateActivityTaskCounts();
1230 setSortRole(AbstractTasksModel::Activities);
1231 }
else if (d->sortMode == SortActivity) {
1232 d->activityInfo =
nullptr;
1234 d->activityTaskCounts.clear();
1238 if (mode == SortLastActivated) {
1239 setSortRole(AbstractTasksModel::LastActivated);
1246 Q_EMIT sortModeChanged();
1250bool TasksModel::separateLaunchers()
const
1252 return d->separateLaunchers;
1255void TasksModel::setSeparateLaunchers(
bool separate)
1257 if (d->separateLaunchers != separate) {
1258 d->separateLaunchers = separate;
1260 d->updateManualSortMap();
1263 Q_EMIT separateLaunchersChanged();
1267bool TasksModel::launchInPlace()
const
1269 return d->launchInPlace;
1272void TasksModel::setLaunchInPlace(
bool launchInPlace)
1274 if (d->launchInPlace != launchInPlace) {
1275 d->launchInPlace = launchInPlace;
1279 Q_EMIT launchInPlaceChanged();
1285 if (!d->groupingProxyModel) {
1286 return GroupDisabled;
1289 return d->groupingProxyModel->groupMode();
1292bool TasksModel::hideActivatedLaunchers()
const
1294 return d->hideActivatedLaunchers;
1297void TasksModel::setHideActivatedLaunchers(
bool hideActivatedLaunchers)
1299 if (d->hideActivatedLaunchers != hideActivatedLaunchers) {
1300 d->hideActivatedLaunchers = hideActivatedLaunchers;
1302 d->updateManualSortMap();
1305 Q_EMIT hideActivatedLaunchersChanged();
1311 if (d->groupingProxyModel) {
1312 if (mode == GroupDisabled && d->flattenGroupsProxyModel) {
1313 d->flattenGroupsProxyModel->setSourceModel(
nullptr);
1316 d->groupingProxyModel->setGroupMode(mode);
1317 d->updateGroupInline();
1321bool TasksModel::groupInline()
const
1323 return d->groupInline;
1326void TasksModel::setGroupInline(
bool groupInline)
1328 if (d->groupInline != groupInline) {
1329 d->groupInline = groupInline;
1331 d->updateGroupInline();
1333 Q_EMIT groupInlineChanged();
1337int TasksModel::groupingWindowTasksThreshold()
const
1339 return d->groupingWindowTasksThreshold;
1342void TasksModel::setGroupingWindowTasksThreshold(
int threshold)
1344 if (d->groupingWindowTasksThreshold != threshold) {
1345 d->groupingWindowTasksThreshold = threshold;
1347 if (!d->groupInline && d->groupingProxyModel) {
1348 d->groupingProxyModel->setWindowTasksThreshold(threshold);
1351 Q_EMIT groupingWindowTasksThresholdChanged();
1357 if (!d->groupingProxyModel) {
1361 return d->groupingProxyModel->blacklistedAppIds();
1366 if (d->groupingProxyModel) {
1367 d->groupingProxyModel->setBlacklistedAppIds(list);
1373 if (!d->groupingProxyModel) {
1377 return d->groupingProxyModel->blacklistedLauncherUrls();
1380void TasksModel::setGroupingLauncherUrlBlacklist(
const QStringList &list)
1382 if (d->groupingProxyModel) {
1383 d->groupingProxyModel->setBlacklistedLauncherUrls(list);
1387bool TasksModel::taskReorderingEnabled()
const
1389 return dynamicSortFilter();
1392void TasksModel::setTaskReorderingEnabled(
bool enabled)
1394 enabled ? setDynamicSortFilter(
true) : setDynamicSortFilter(
false);
1396 Q_EMIT taskReorderingEnabledChanged();
1401 if (d->launcherTasksModel) {
1402 return d->launcherTasksModel->launcherList();
1410 d->initLauncherTasksModel();
1411 d->launcherTasksModel->setLauncherList(launchers);
1412 d->launchersEverSet =
true;
1415bool TasksModel::requestAddLauncher(
const QUrl &url)
1417 d->initLauncherTasksModel();
1419 bool added = d->launcherTasksModel->requestAddLauncher(url);
1424 if (added && d->sortMode == SortManual && (d->launchInPlace || !d->separateLaunchers)) {
1425 d->updateManualSortMap();
1432bool TasksModel::requestRemoveLauncher(
const QUrl &url)
1434 if (d->launcherTasksModel) {
1435 bool removed = d->launcherTasksModel->requestRemoveLauncher(url);
1440 if (removed && d->sortMode == SortManual && (d->launchInPlace || !d->separateLaunchers)) {
1441 d->updateManualSortMap();
1451bool TasksModel::requestAddLauncherToActivity(
const QUrl &url,
const QString &activity)
1453 d->initLauncherTasksModel();
1455 bool added = d->launcherTasksModel->requestAddLauncherToActivity(url, activity);
1460 if (added && d->sortMode == SortManual && (d->launchInPlace || !d->separateLaunchers)) {
1461 d->updateManualSortMap();
1468bool TasksModel::requestRemoveLauncherFromActivity(
const QUrl &url,
const QString &activity)
1470 if (d->launcherTasksModel) {
1471 bool removed = d->launcherTasksModel->requestRemoveLauncherFromActivity(url, activity);
1476 if (removed && d->sortMode == SortManual && (d->launchInPlace || !d->separateLaunchers)) {
1477 d->updateManualSortMap();
1489 if (d->launcherTasksModel) {
1490 return d->launcherTasksModel->launcherActivities(url);
1496int TasksModel::launcherPosition(
const QUrl &url)
const
1498 if (d->launcherTasksModel) {
1499 return d->launcherTasksModel->launcherPosition(url);
1508 d->abstractTasksSourceModel->requestActivate(mapToSource(index));
1515 d->abstractTasksSourceModel->requestNewInstance(mapToSource(index));
1522 d->abstractTasksSourceModel->requestOpenUrls(mapToSource(index), urls);
1529 d->abstractTasksSourceModel->requestClose(mapToSource(index));
1536 d->abstractTasksSourceModel->requestMove(mapToSource(index));
1543 d->abstractTasksSourceModel->requestResize(mapToSource(index));
1550 d->abstractTasksSourceModel->requestToggleMinimized(mapToSource(index));
1557 d->abstractTasksSourceModel->requestToggleMaximized(mapToSource(index));
1564 d->abstractTasksSourceModel->requestToggleKeepAbove(mapToSource(index));
1571 d->abstractTasksSourceModel->requestToggleKeepBelow(mapToSource(index));
1578 d->abstractTasksSourceModel->requestToggleFullScreen(mapToSource(index));
1585 d->abstractTasksSourceModel->requestToggleShaded(mapToSource(index));
1589void TasksModel::requestVirtualDesktops(
const QModelIndex &index,
const QVariantList &desktops)
1592 d->abstractTasksSourceModel->requestVirtualDesktops(mapToSource(index), desktops);
1599 d->abstractTasksSourceModel->requestNewVirtualDesktop(mapToSource(index));
1606 d->groupingProxyModel->requestActivities(mapToSource(index), activities);
1615 d->abstractTasksSourceModel->requestPublishDelegateGeometry(mapToSource(index), geometry, delegate);
1621 const QModelIndex &target = (d->flattenGroupsProxyModel ? d->flattenGroupsProxyModel->mapToSource(mapToSource(index)) : mapToSource(index));
1622 d->groupingProxyModel->requestToggleGrouping(target);
1635 if (d->sortMode != SortManual || row == newPos || newPos < 0 || newPos >= rowCount(parent)) {
1640 bool isLauncherMove =
false;
1644 if (idx.
data(AbstractTasksModel::IsLauncher).
toBool()) {
1645 isLauncherMove =
true;
1647 }
else if ((d->launchInPlace || !d->separateLaunchers) && idx.
data(AbstractTasksModel::IsWindow).
toBool()) {
1648 const QUrl &launcherUrl = idx.
data(AbstractTasksModel::LauncherUrlWithoutIcon).
toUrl();
1649 const int launcherPos = launcherPosition(launcherUrl);
1651 if (launcherPos != -1) {
1652 isLauncherMove =
true;
1659 if (d->separateLaunchers && !parent.
isValid() ) {
1661 if (d->launcherTasksModel) {
1662 if (d->launchInPlace) {
1663 firstTask = d->launcherTasksModel->rowCountForActivity(activity());
1665 firstTask = launcherCount();
1670 if (isLauncherMove && newPos >= firstTask) {
1675 if (!isLauncherMove && newPos < firstTask) {
1681 if (d->flattenGroupsProxyModel) {
1682 QModelIndex groupingRowIndex = d->flattenGroupsProxyModel->mapToSource(mapToSource(index(row, 0)));
1684 QModelIndex groupingNewPosIndex = d->flattenGroupsProxyModel->mapToSource(mapToSource(index(newPos, 0)));
1688 if (groupingRowIndexParent.
isValid() && (groupingRowIndexParent == groupingNewPosIndex || groupingRowIndexParent == groupingNewPosIndexParent)) {
1693 int extraChildCount = 0;
1695 if (groupingRowIndexParent.
isValid()) {
1696 offset = groupingRowIndex.
row();
1697 extraChildCount = d->groupingProxyModel->rowCount(groupingRowIndexParent) - 1;
1698 groupingRowIndex = groupingRowIndexParent;
1701 if (groupingNewPosIndexParent.
isValid()) {
1702 int extra = d->groupingProxyModel->rowCount(groupingNewPosIndexParent) - 1;
1706 newPos -= groupingNewPosIndex.
row();
1707 groupingNewPosIndex = groupingNewPosIndexParent.
model()->
index(extra, 0, groupingNewPosIndexParent);
1709 newPos -= groupingNewPosIndex.
row();
1710 groupingNewPosIndex = groupingNewPosIndexParent;
1714 beginMoveRows(
QModelIndex(), (row - offset), (row - offset) + extraChildCount,
QModelIndex(), (newPos > row) ? newPos + 1 : newPos);
1716 row = d->sortedPreFilterRows.indexOf(d->filterProxyModel->mapToSource(d->groupingProxyModel->mapToSource(groupingRowIndex)).row());
1717 newPos = d->sortedPreFilterRows.indexOf(d->filterProxyModel->mapToSource(d->groupingProxyModel->mapToSource(groupingNewPosIndex)).row());
1720 d->sortedPreFilterRows.move(row, newPos);
1724 if (groupingRowIndexParent.
isValid()) {
1725 d->consolidateManualSortMapForGroup(groupingRowIndexParent);
1729 beginMoveRows(parent, row, row, parent, (newPos > row) ? newPos + 1 : newPos);
1732 const QModelIndex &groupingRowIndex = mapToSource(index(row, 0, parent));
1733 const QModelIndex &preFilterRowIndex = d->preFilterIndex(groupingRowIndex);
1735 const bool groupNotDisabled = !parent.
isValid() && groupMode() != GroupDisabled;
1737 if (groupNotDisabled) {
1738 if (newPos > row && row + 1 < rowCount(parent)) {
1739 adjacentGroupingRowIndex = mapToSource(index(row + 1, 0, parent) );
1740 }
else if (newPos < row && row - 1 >= 0) {
1741 adjacentGroupingRowIndex = mapToSource(index(row - 1, 0, parent) );
1745 row = d->sortedPreFilterRows.indexOf(preFilterRowIndex.
row());
1746 newPos = d->sortedPreFilterRows.indexOf(d->preFilterIndex(mapToSource(index(newPos, 0, parent))).row());
1749 d->sortedPreFilterRows.move(row, newPos);
1754 if (groupNotDisabled) {
1755 if (d->groupingProxyModel->rowCount(groupingRowIndex)) {
1756 d->consolidateManualSortMapForGroup(groupingRowIndex);
1761 if (
int childCount = d->groupingProxyModel->rowCount(adjacentGroupingRowIndex); childCount && adjacentGroupingRowIndex.
isValid()) {
1762 d->consolidateManualSortMapForGroup(adjacentGroupingRowIndex);
1764 newPos += childCount - 1;
1777 if (!d->separateLaunchers) {
1778 if (isLauncherMove) {
1779 const QModelIndex &idx = d->concatProxyModel->index(d->sortedPreFilterRows.at(newPos), 0);
1780 const QUrl &launcherUrl = idx.
data(AbstractTasksModel::LauncherUrlWithoutIcon).
toUrl();
1786 if (!idx.
data(AbstractTasksModel::IsLauncher).
toBool()) {
1787 const int launcherPos = d->launcherTasksModel->launcherPosition(launcherUrl);
1788 const QModelIndex &launcherIndex = d->launcherTasksModel->index(launcherPos, 0);
1789 const int sortIndex = d->sortedPreFilterRows.indexOf(d->concatProxyModel->mapFromSource(launcherIndex).row());
1790 d->sortedPreFilterRows.move(sortIndex, newPos);
1792 if (row > newPos && newPos >= 1) {
1793 const QModelIndex beforeIdx = d->concatProxyModel->index(d->sortedPreFilterRows.at(newPos - 1), 0);
1794 if (beforeIdx.
data(AbstractTasksModel::IsLauncher).
toBool()) {
1796 int afterPos = newPos + 1;
1797 for (; afterPos < d->sortedPreFilterRows.size(); ++afterPos) {
1798 const QModelIndex tempIdx = d->concatProxyModel->index(d->sortedPreFilterRows.at(afterPos), 0);
1799 if (!appsMatch(idx, tempIdx)) {
1804 const QModelIndex afterIdx = d->concatProxyModel->index(d->sortedPreFilterRows.at(afterPos), 0);
1805 if (appsMatch(beforeIdx, afterIdx)) {
1806 d->sortedPreFilterRows.move(newPos - 1, afterPos - 1);
1813 for (
int i = (d->sortedPreFilterRows.count() - 1); i >= 0; --i) {
1814 const QModelIndex &concatProxyIndex = d->concatProxyModel->index(d->sortedPreFilterRows.at(i), 0);
1816 if (launcherUrl == concatProxyIndex.
data(AbstractTasksModel::LauncherUrlWithoutIcon).
toUrl()) {
1817 d->sortedPreFilterRows.move(i, newPos);
1825 }
else if (newPos > 0 && newPos < d->sortedPreFilterRows.size() - 1) {
1833 const QModelIndex beforeIdx = d->concatProxyModel->index(d->sortedPreFilterRows.at(newPos - 1), 0, parent);
1834 const QModelIndex afterIdx = d->concatProxyModel->index(d->sortedPreFilterRows.at(newPos + 1), 0, parent);
1836 const bool hasLauncher = beforeIdx.
data(AbstractTasksModel::IsLauncher).
toBool() || afterIdx.
data(AbstractTasksModel::IsLauncher).
toBool();
1838 if (hasLauncher && appsMatch(beforeIdx, afterIdx)) {
1840 d->sortedPreFilterRows.move(newPos, newPos + (row < newPos ? 1 : -1));
1846 d->launcherSortingDirty = isLauncherMove;
1851void TasksModel::syncLaunchers()
1856 if (!d->launcherTasksModel || !d->launcherSortingDirty) {
1863 for (
const auto launchers = launcherList();
const QString &launcherUrlStr : launchers) {
1868 std::tie(launcherUrl, activities) = deserializeLauncher(launcherUrlStr);
1870 for (
int i = 0; i < rowCount(); ++i) {
1871 const QUrl &rowLauncherUrl = index(i, 0).
data(AbstractTasksModel::LauncherUrlWithoutIcon).
toUrl();
1882 if (launcherUrlsMatch(appDataFromUrl(launcherUrl).url, rowLauncherUrl, IgnoreQueryItems)) {
1889 sortedShownLaunchers.
insert(row, launcherUrlStr);
1891 sortedHiddenLaunchers << launcherUrlStr;
1896 if (d->sortMode == SortManual) {
1900 for (
int i = 0; i < d->launcherTasksModel->rowCount(); ++i) {
1901 const QModelIndex &launcherIndex = d->launcherTasksModel->index(i, 0);
1902 const QModelIndex &concatIndex = d->concatProxyModel->mapFromSource(launcherIndex);
1903 sortMapIndices << d->sortedPreFilterRows.
indexOf(concatIndex.
row());
1904 preFilterRows << concatIndex.
row();
1910 std::sort(sortMapIndices.
begin(), sortMapIndices.
end());
1912 for (
int i = 0; i < sortMapIndices.
count(); ++i) {
1913 d->sortedPreFilterRows.replace(sortMapIndices.
at(i), preFilterRows.
at(i));
1917 setLauncherList(sortedShownLaunchers.
values() + sortedHiddenLaunchers);
1923 d->launcherSortingDirty =
false;
1928 for (
int i = 0; i < rowCount(); ++i) {
1931 if (idx.
data(AbstractTasksModel::IsActive).
toBool()) {
1932 if (groupMode() != GroupDisabled && rowCount(idx)) {
1933 for (
int j = 0; j < rowCount(idx); ++j) {
1936 if (child.
data(AbstractTasksModel::IsActive).
toBool()) {
1951 if (row < 0 || row >= rowCount()) {
1955 if (childRow == -1) {
1956 return index(row, 0);
1960 if (childRow < rowCount(parent)) {
1961 return index(childRow, 0, parent);
1973void TasksModel::classBegin()
1975 d->usedByQml =
true;
1978void TasksModel::componentComplete()
1980 d->componentComplete =
true;
1983 d->updateGroupInline();
1986bool TasksModel::filterAcceptsRow(
int sourceRow,
const QModelIndex &sourceParent)
const
1994 const QModelIndex &sourceIndex = sourceModel()->index(sourceRow, 0);
1997 if (d->groupInline && d->flattenGroupsProxyModel && sourceIndex.
data(AbstractTasksModel::IsGroupParent).
toBool()) {
2005 if (sourceIndex.
data(AbstractTasksModel::IsStartup).
toBool()) {
2006 for (
int i = 0; i < d->filterProxyModel->rowCount(); ++i) {
2007 const QModelIndex &filterIndex = d->filterProxyModel->index(i, 0);
2009 if (!filterIndex.
data(AbstractTasksModel::IsWindow).
toBool()) {
2022 if (d->hideActivatedLaunchers && sourceIndex.
data(AbstractTasksModel::IsLauncher).
toBool()) {
2023 for (
int i = 0; i < d->filterProxyModel->rowCount(); ++i) {
2024 const QModelIndex &filteredIndex = d->filterProxyModel->index(i, 0);
2026 if (!filteredIndex.
data(AbstractTasksModel::IsWindow).
toBool() && !filteredIndex.
data(AbstractTasksModel::IsStartup).
toBool()) {
2030 if (appsMatch(sourceIndex, filteredIndex)) {
2042 if (d->sortMode == SortManual) {
2043 return (d->sortedPreFilterRows.indexOf(d->preFilterIndex(left).row()) < d->sortedPreFilterRows.indexOf(d->preFilterIndex(right).row()));
2046 return d->lessThan(left, right);
2049std::shared_ptr<VirtualDesktopInfo> TasksModel::virtualDesktopInfo()
const
2051 static std::weak_ptr<VirtualDesktopInfo> s_virtualDesktopInfo;
2052 if (s_virtualDesktopInfo.expired()) {
2053 auto ptr = std::make_shared<VirtualDesktopInfo>();
2054 s_virtualDesktopInfo = ptr;
2057 return s_virtualDesktopInfo.lock();
2060std::shared_ptr<ActivityInfo> TasksModel::activityInfo()
const
2062 static std::weak_ptr<ActivityInfo> s_activityInfo;
2063 if (s_activityInfo.expired()) {
2064 auto ptr = std::make_shared<ActivityInfo>();
2065 s_activityInfo = ptr;
2068 return s_activityInfo.lock();
Q_SCRIPTABLE Q_NOREPLY void start()
const QList< QKeySequence > & end()
QCA_EXPORT QString appName()
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QList< int > &roles)
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const const=0
void rowsAboutToBeInserted(const QModelIndex &parent, int start, int end)
void rowsAboutToBeRemoved(const QModelIndex &parent, int first, int last)
void rowsInserted(const QModelIndex &parent, int first, int last)
void rowsRemoved(const QModelIndex &parent, int first, int last)
const_reference at(qsizetype i) const const
const_iterator cbegin() const const
const_iterator cend() const const
bool contains(const AT &value) const const
qsizetype count() const const
qsizetype indexOf(const AT &value, qsizetype from) const const
bool isEmpty() const const
iterator insert(const Key &key, const T &value)
QList< T > values() const const
QVariant data(int role) const const
bool isValid() const const
const QAbstractItemModel * model() const const
QModelIndex parent() const const
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
virtual QVariant data(const QModelIndex &index, int role) const const override
virtual int rowCount(const QModelIndex &parent) const const override
bool isEmpty() const const
int localeAwareCompare(QStringView s1, QStringView s2)
QTextStream & left(QTextStream &stream)
QTextStream & right(QTextStream &stream)
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)
bool isValid(int h, int m, int s, int ms)
bool isNull() const const
bool toBool() const const
QString toString() const const
QStringList toStringList() const const