@@ -41,7 +41,7 @@ DockGlobalElementModel::DockGlobalElementModel(QAbstractItemModel *appsModel, Do
4141 }
4242 std::for_each (m_data.begin (), m_data.end (), [this , first, last](auto &data) {
4343 if (std::get<1 >(data) == m_appsModel && std::get<2 >(data) >= first) {
44- data = std::make_tuple (std::get<0 >(data), std::get<1 >(data), std::get<2 >(data) - - ((last - first) + 1 ));
44+ data = std::make_tuple (std::get<0 >(data), std::get<1 >(data), std::get<2 >(data) - ((last - first) + 1 ));
4545 }
4646 });
4747 });
@@ -293,7 +293,21 @@ QVariant DockGlobalElementModel::data(const QModelIndex &index, int role) const
293293 if (model == m_activeAppModel) {
294294 return QStringList{model->index (row, 0 ).data (TaskManager::WinIdRole).toString ()};
295295 }
296- return QVariant ();
296+ // For m_appsModel data, we need to find all related windows
297+ QStringList windowIds;
298+ for (int i = 0 ; i < m_activeAppModel->rowCount (); ++i) {
299+ QModelIndex appIndex = m_activeAppModel->index (i, 0 );
300+ QVariant identityData = appIndex.data (TaskManager::IdentityRole);
301+ QStringList identities = identityData.toStringList ();
302+
303+ if (identities.contains (id)) {
304+ QString winId = appIndex.data (TaskManager::WinIdRole).toString ();
305+ if (!winId.isEmpty () && winId != " 0" ) {
306+ windowIds.append (winId);
307+ }
308+ }
309+ }
310+ return windowIds;
297311 }
298312 case TaskManager::MenusRole: {
299313 return getMenus (index);
@@ -384,25 +398,6 @@ void DockGlobalElementModel::requestUpdateWindowGeometry(const QModelIndex &inde
384398 Q_UNUSED (delegate)
385399}
386400
387- void DockGlobalElementModel::requestPreview (const QModelIndexList &indexes,
388- QObject *relativePositionItem,
389- int32_t previewXoffset,
390- int32_t previewYoffset,
391- uint32_t direction) const
392- {
393- QModelIndexList sourceIndexes;
394- for (auto index : indexes) {
395- auto data = m_data.value (index.row ());
396- auto id = std::get<0 >(data);
397- auto sourceModel = std::get<1 >(data);
398- auto sourceRow = std::get<2 >(data);
399- if (sourceModel == m_activeAppModel) {
400- sourceIndexes.append (sourceModel->index (sourceRow, 0 ));
401- }
402- }
403- m_activeAppModel->requestPreview (sourceIndexes, relativePositionItem, previewXoffset, previewYoffset, direction);
404- }
405-
406401void DockGlobalElementModel::requestWindowsView (const QModelIndexList &indexes) const
407402{
408403 Q_UNUSED (indexes)
0 commit comments