-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fullscreen frame scrolling bounce effect
Change the swipeview control to listview Issue: linuxdeepin/developer-center#10365
- Loading branch information
1 parent
7c4b96a
commit cfa311d
Showing
7 changed files
with
322 additions
and
225 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. | ||
// | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
#include "itemspagemodel.h" | ||
#include "itemarrangementproxymodel.h" | ||
|
||
ItemsPageModel::ItemsPageModel(QObject *parent) | ||
: QAbstractListModel{parent} | ||
, m_topLevel(nullptr) | ||
, m_sourceModel(nullptr) | ||
{ | ||
|
||
} | ||
|
||
int ItemsPageModel::rowCount(const QModelIndex &parent) const | ||
{ | ||
Q_UNUSED(parent) | ||
|
||
if (!m_topLevel) { | ||
return 0; | ||
} | ||
|
||
return m_topLevel->pageCount(); | ||
} | ||
|
||
QVariant ItemsPageModel::data(const QModelIndex &index, int role) const | ||
{ | ||
Q_UNUSED(index) | ||
return QVariant(); | ||
} | ||
|
||
void ItemsPageModel::setModel(QAbstractItemModel *model) | ||
{ | ||
if (!model || model == m_sourceModel) { | ||
return; | ||
} | ||
|
||
m_sourceModel = model; | ||
emit sourceModelChanged(model); | ||
|
||
m_topLevel = qobject_cast<ItemArrangementProxyModel*>(m_sourceModel)->itemsPage(); | ||
if (m_topLevel) { | ||
|
||
m_topLevel->disconnect(SIGNAL(sigPageAdded(int, int)), this); | ||
m_topLevel->disconnect(SIGNAL(sigPageRemoved(int, int)), this); | ||
|
||
connect(m_topLevel, &ItemsPage::sigPageAdded, this, [ = ] (int first, int last) { | ||
beginInsertRows(QModelIndex(), first, last); | ||
endInsertRows(); | ||
}); | ||
|
||
connect(m_topLevel, &ItemsPage::sigPageRemoved, this, [ = ] (int first, int last) { | ||
beginRemoveRows(QModelIndex(), first, last); | ||
endRemoveRows(); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. | ||
// | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
#ifndef ITEMSPAGEMODEL_H | ||
#define ITEMSPAGEMODEL_H | ||
|
||
#include <QtQml/qqml.h> | ||
#include <QAbstractListModel> | ||
|
||
#include "itemspage.h" | ||
|
||
class ItemsPageModel : public QAbstractListModel | ||
{ | ||
Q_OBJECT | ||
|
||
Q_PROPERTY(QAbstractItemModel *sourceModel READ sourceModel WRITE setModel NOTIFY sourceModelChanged) | ||
QML_NAMED_ELEMENT(ItemsPageModel) | ||
|
||
public: | ||
explicit ItemsPageModel(QObject *parent = nullptr); | ||
|
||
Q_INVOKABLE int rowCount(const QModelIndex &parent = QModelIndex()) const override; | ||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; | ||
|
||
QAbstractItemModel *sourceModel() { return m_sourceModel; } | ||
void setModel(QAbstractItemModel *model); | ||
|
||
signals: | ||
void sourceModelChanged(QObject *); | ||
|
||
private: | ||
ItemsPage *m_topLevel; | ||
QAbstractItemModel *m_sourceModel; | ||
}; | ||
|
||
#endif // ITEMSPAGEMODEL_H |