fix: 修复Dock模块窗口属性异常的问题

修复Dock模块窗口属性WindowInfo异常的问题

log:
Task: https://pms.uniontech.com/task-view-136759.html
Influence: 无
Change-Id: I9bf9e532ec003d4ba7d35d6a5ed0af4e3b5d299d
This commit is contained in:
weizhixiang
2022-05-26 18:10:53 +08:00
parent 2675e262e7
commit e817c291bc
16 changed files with 231 additions and 109 deletions

View File

@ -12,7 +12,7 @@ DockRect::DockRect()
QDebug operator<<(QDebug debug, const DockRect &rect)
{
debug << QString("Rect(%1, %2, %3, %4)").arg(rect.X)
debug << QString("DockRect(%1, %2, %3, %4)").arg(rect.X)
.arg(rect.Y)
.arg(rect.Width)
.arg(rect.Height);

View File

@ -0,0 +1,51 @@
#include "exportwindowinfo.h"
#include <QtDebug>
ExportWindowInfo::ExportWindowInfo()
: m_xid(0)
, m_flash(false)
{
}
ExportWindowInfo::ExportWindowInfo(uint32_t xid, const QString &title, bool flash)
: m_xid(xid)
, m_title(title)
, m_flash(flash)
{
}
QDebug operator<<(QDebug debug, const ExportWindowInfo &info)
{
debug << QString("ExportWindowInfo(%1, %2, %3)").arg(info.m_xid)
.arg(info.m_title)
.arg(info.m_flash);
return debug;
}
QDBusArgument &operator<<(QDBusArgument &arg, const ExportWindowInfo &info)
{
arg.beginStructure();
arg << info.m_xid << info.m_title << info.m_flash;
arg.endStructure();
return arg;
}
const QDBusArgument &operator>>(const QDBusArgument &arg, ExportWindowInfo &info)
{
arg.beginStructure();
arg >> info.m_xid >> info.m_title >> info.m_flash;
arg.endStructure();
return arg;
}
void registerExportWindowInfoMetaType()
{
qRegisterMetaType<ExportWindowInfo>("ExportWindowInfo");
qDBusRegisterMetaType<ExportWindowInfo>();
}

View File

@ -0,0 +1,31 @@
#ifndef EXPORTWINDOWINFO_H
#define EXPORTWINDOWINFO_H
#include <QRect>
#include <QDBusMetaType>
struct ExportWindowInfo
{
public:
ExportWindowInfo();
ExportWindowInfo(uint32_t xid, const QString &title, bool flash);
friend QDebug operator<<(QDebug debug, const ExportWindowInfo &rect);
friend const QDBusArgument &operator>>(const QDBusArgument &arg, ExportWindowInfo &rect);
friend QDBusArgument &operator<<(QDBusArgument &arg, const ExportWindowInfo &rect);
uint32_t getXid() {return m_xid;}
QString getTitle() {return m_title;}
bool getFlash() {return m_flash;}
private:
uint32_t m_xid;
QString m_title;
bool m_flash;
};
Q_DECLARE_METATYPE(ExportWindowInfo)
void registerExportWindowInfoMetaType();
#endif // EXPORTWINDOWINFO_H

View File

@ -0,0 +1,18 @@
#include "exportwindowinfolist.h"
void sortExprotWindowInfoList(ExportWindowInfoList &list)
{
qSort(list.begin(), list.end(), compareWindowXid);
}
void registerExportWindowInfoListMetaType()
{
qRegisterMetaType<ExportWindowInfoList>("ExportWindowInfoList");
qDBusRegisterMetaType<ExportWindowInfoList>();
}
// 按xid进行排序
bool compareWindowXid(ExportWindowInfo &info1, ExportWindowInfo &info2)
{
return info1.getXid() < info2.getXid();
}

View File

@ -0,0 +1,18 @@
#ifndef EXPORTWINDOWINFOLIST_H
#define EXPORTWINDOWINFOLIST_H
#include "exportwindowinfo.h"
#include <QtCore/QList>
#include <QDBusMetaType>
typedef QList<ExportWindowInfo> ExportWindowInfoList;
bool compareWindowXid(ExportWindowInfo &info1, ExportWindowInfo &info2);
void sortExprotWindowInfoList(ExportWindowInfoList &list);
Q_DECLARE_METATYPE(ExportWindowInfoList)
void registerExportWindowInfoListMetaType();
#endif // EXPORTWINDOWINFOLIST_H