Skip to content

Commit

Permalink
fix: [workspace] drag file to weixin failed in some platform.
Browse files Browse the repository at this point in the history
1. If not set the mimeData text, the weixin will ignore the drag event.
2. The weixin not override the drag event, it use the default of qt5.15.
3. So, file manager set the text.

Log: fix issue
Bug: https://pms.uniontech.com/bug-view-248591.html
  • Loading branch information
GongHeng2017 committed Apr 2, 2024
1 parent 619ea2c commit 441e311
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ DFMBASE_USE_NAMESPACE
DFMGLOBAL_USE_NAMESPACE
using namespace ddplugin_canvas;

inline constexpr char kCanvas[] { "canvas" };

CanvasProxyModelPrivate::CanvasProxyModelPrivate(CanvasProxyModel *qq)
: QObject(qq), q(qq)
{
Expand Down Expand Up @@ -715,7 +717,7 @@ QMimeData *CanvasProxyModel::mimeData(const QModelIndexList &indexes) const
} else {
mimedt->setUrls(urls);
}

mimedt->setText(kCanvas);
// set user id
SysInfoUtils::setMimeDataUserId(mimedt);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
DFMBASE_USE_NAMESPACE
using namespace ddplugin_organizer;

inline constexpr char kCollection[] { "collection" };

CollectionModelPrivate::CollectionModelPrivate(CollectionModel *qq)

Check warning on line 27 in src/plugins/desktop/ddplugin-organizer/models/collectionmodel.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Member variable 'CollectionModelPrivate::q' is not initialized in the constructor.
: QObject(qq), q(qq)
{
Expand Down Expand Up @@ -482,9 +484,8 @@ QMimeData *CollectionModel::mimeData(const QModelIndexList &indexes) const

for (const QModelIndex &idx : indexes)
urls << fileUrl(idx);

mm->setText(kCollection);
mm->setUrls(urls);

// set user id
SysInfoUtils::setMimeDataUserId(mm);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ DFMGLOBAL_USE_NAMESPACE
DFMBASE_USE_NAMESPACE
using namespace dfmplugin_workspace;

inline constexpr char kFileManager[] { "fileManager" };

FileViewModel::FileViewModel(QAbstractItemView *parent)
: QAbstractItemModel(parent)

Expand Down Expand Up @@ -452,7 +454,7 @@ QMimeData *FileViewModel::mimeData(const QModelIndexList &indexes) const
}

QMimeData *data = new QMimeData();

data->setText(kFileManager);
data->setUrls(urls);
SysInfoUtils::setMimeDataUserId(data);

Expand Down

0 comments on commit 441e311

Please sign in to comment.