mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 17:33:05 +00:00
fix: 修复从任务栏拖出托盘应用后托盘不弹出的问题
1.当图标只剩下一个的时候,遍历获取展开图标错误 2.在系统图标删除之前,需要将内置的插件返回的widget的parent设置为nullptr,防止在系统图标删除的时候把插件的widget给删除了 3、在拖动图标的过程中,不从原来的系统中删除原来的图标,再释放后,再将原来的图标删除 Log: Influence: 从任务栏拖动微信或企业微信,观察托盘是否弹出 Bug: https://pms.uniontech.com/bug-view-171497.html Change-Id: Iacbfe3406112e92a68d268beaaea3c1a3c3afe7c
This commit is contained in:
parent
4c4d06310b
commit
077d6f056f
@ -318,8 +318,6 @@ void DockTrayWindow::initConnection()
|
|||||||
connect(m_model, &TrayModel::rowCountChanged, this, &DockTrayWindow::onUpdateComponentSize);
|
connect(m_model, &TrayModel::rowCountChanged, this, &DockTrayWindow::onUpdateComponentSize);
|
||||||
connect(m_model, &TrayModel::rowCountChanged, m_trayView, &TrayGridView::onUpdateEditorView);
|
connect(m_model, &TrayModel::rowCountChanged, m_trayView, &TrayGridView::onUpdateEditorView);
|
||||||
connect(m_model, &TrayModel::requestRefreshEditor, m_trayView, &TrayGridView::onUpdateEditorView);
|
connect(m_model, &TrayModel::requestRefreshEditor, m_trayView, &TrayGridView::onUpdateEditorView);
|
||||||
connect(m_trayView, &TrayGridView::requestRemove, m_model, &TrayModel::removeRow);
|
|
||||||
connect(m_trayView, &TrayGridView::requestRemove, this, &DockTrayWindow::onUpdateComponentSize);
|
|
||||||
connect(m_trayView, &TrayGridView::dragFinished, this, [ this ] {
|
connect(m_trayView, &TrayGridView::dragFinished, this, [ this ] {
|
||||||
// 如果拖拽结束,则隐藏托盘
|
// 如果拖拽结束,则隐藏托盘
|
||||||
Q_EMIT m_delegate->requestDrag(false);
|
Q_EMIT m_delegate->requestDrag(false);
|
||||||
|
@ -151,7 +151,7 @@ void TrayDelegate::setEditorData(QWidget *editor, const QModelIndex &index) cons
|
|||||||
{
|
{
|
||||||
BaseTrayWidget *widget = static_cast<BaseTrayWidget *>(editor);
|
BaseTrayWidget *widget = static_cast<BaseTrayWidget *>(editor);
|
||||||
if (widget) {
|
if (widget) {
|
||||||
widget->setNeedShow(true);
|
widget->setNeedShow(!index.data(TrayModel::Blank).toBool());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,7 +222,7 @@ ExpandIconWidget *TrayDelegate::expandWidget()
|
|||||||
if (!dataModel)
|
if (!dataModel)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
for (int i = 0; i < dataModel->rowCount() - 1; i++) {
|
for (int i = 0; i < dataModel->rowCount(); i++) {
|
||||||
QModelIndex index = dataModel->index(i, 0);
|
QModelIndex index = dataModel->index(i, 0);
|
||||||
ExpandIconWidget *widget = qobject_cast<ExpandIconWidget *>(m_listView->indexWidget(index));
|
ExpandIconWidget *widget = qobject_cast<ExpandIconWidget *>(m_listView->indexWidget(index));
|
||||||
if (widget)
|
if (widget)
|
||||||
|
@ -388,6 +388,26 @@ const QModelIndex TrayGridView::getIndexFromPos(QPoint currentPoint) const
|
|||||||
return QModelIndex();
|
return QModelIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TrayGridView::mouseInDock()
|
||||||
|
{
|
||||||
|
QPoint mousePosition = QCursor::pos();
|
||||||
|
QRect dockRect(topLevelWidget()->pos(), topLevelWidget()->size());
|
||||||
|
switch (m_positon) {
|
||||||
|
case Dock::Position::Bottom: {
|
||||||
|
return mousePosition.y() > dockRect.top();
|
||||||
|
}
|
||||||
|
case Dock::Position::Left: {
|
||||||
|
return mousePosition.x() < dockRect.right();
|
||||||
|
}
|
||||||
|
case Dock::Position::Top: {
|
||||||
|
return mousePosition.y() < dockRect.bottom();
|
||||||
|
}
|
||||||
|
case Dock::Position::Right: {
|
||||||
|
return mousePosition.x() > dockRect.left();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void TrayGridView::handleDropEvent(QDropEvent *e)
|
void TrayGridView::handleDropEvent(QDropEvent *e)
|
||||||
{
|
{
|
||||||
setState(DListView::NoState);
|
setState(DListView::NoState);
|
||||||
@ -492,7 +512,7 @@ bool TrayGridView::beginDrag(Qt::DropActions supportedActions)
|
|||||||
listModel->setDragKey(modelIndex.data(TrayModel::Role::KeyRole).toString());
|
listModel->setDragKey(modelIndex.data(TrayModel::Role::KeyRole).toString());
|
||||||
listModel->setDragingIndex(modelIndex);
|
listModel->setDragingIndex(modelIndex);
|
||||||
// 删除当前的图标
|
// 删除当前的图标
|
||||||
WinInfo winInfo = listModel->takeIndex(modelIndex);
|
WinInfo winInfo = listModel->getWinInfo(modelIndex);
|
||||||
|
|
||||||
Qt::DropAction dropAct = drag->exec(supportedActions);
|
Qt::DropAction dropAct = drag->exec(supportedActions);
|
||||||
|
|
||||||
@ -504,12 +524,15 @@ bool TrayGridView::beginDrag(Qt::DropActions supportedActions)
|
|||||||
if (listModel->isIconTray()) {
|
if (listModel->isIconTray()) {
|
||||||
// 如果当前是从托盘区域释放,按照原来的流程走
|
// 如果当前是从托盘区域释放,按照原来的流程走
|
||||||
QPropertyAnimation *posAni = new QPropertyAnimation(pixLabel, "pos", pixLabel);
|
QPropertyAnimation *posAni = new QPropertyAnimation(pixLabel, "pos", pixLabel);
|
||||||
connect(posAni, &QPropertyAnimation::finished, [ this, listModel, pixLabel, modelIndex, winInfo ] () {
|
connect(posAni, &QPropertyAnimation::finished, [ this, listModel, pixLabel, winInfo ] () {
|
||||||
pixLabel->hide();
|
pixLabel->hide();
|
||||||
pixLabel->deleteLater();
|
pixLabel->deleteLater();
|
||||||
listModel->setDragKey(QString());
|
listModel->setDragKey(QString());
|
||||||
listModel->insertRow(modelIndex.row(), winInfo);
|
|
||||||
clearDragModelIndex();
|
clearDragModelIndex();
|
||||||
|
QModelIndex dropIndex = indexAt(m_dropPos);
|
||||||
|
// 拖转完成后,将拖动的图标插入到新的位置
|
||||||
|
//listModel->moveToIndex(winInfo, dropIndex.row());
|
||||||
|
listModel->dropSwap(dropIndex.row());
|
||||||
listModel->setExpandVisible(!TrayModel::getIconModel()->isEmpty());
|
listModel->setExpandVisible(!TrayModel::getIconModel()->isEmpty());
|
||||||
|
|
||||||
m_dropPos = QPoint();
|
m_dropPos = QPoint();
|
||||||
@ -518,7 +541,7 @@ bool TrayGridView::beginDrag(Qt::DropActions supportedActions)
|
|||||||
onUpdateEditorView();
|
onUpdateEditorView();
|
||||||
Q_EMIT dragFinished();
|
Q_EMIT dragFinished();
|
||||||
});
|
});
|
||||||
|
// 拖拽完成后,将当前拖拽的item从原来的列表中移除,后来会根据实际情况将item插入到特定的列表中
|
||||||
posAni->setEasingCurve(QEasingCurve::Linear);
|
posAni->setEasingCurve(QEasingCurve::Linear);
|
||||||
posAni->setDuration(m_aniDuringTime);
|
posAni->setDuration(m_aniDuringTime);
|
||||||
posAni->setStartValue((QCursor::pos() - QPoint(0, pixLabel->height() / 2)));
|
posAni->setStartValue((QCursor::pos() - QPoint(0, pixLabel->height() / 2)));
|
||||||
@ -528,19 +551,25 @@ bool TrayGridView::beginDrag(Qt::DropActions supportedActions)
|
|||||||
|
|
||||||
Q_EMIT dragFinished();
|
Q_EMIT dragFinished();
|
||||||
} else {
|
} else {
|
||||||
// 如果当前是从任务栏区域释放,则将释放后的图标放到托盘
|
|
||||||
listModel->setDragKey(QString());
|
listModel->setDragKey(QString());
|
||||||
clearDragModelIndex();
|
clearDragModelIndex();
|
||||||
TrayModel *trayModel = TrayModel::getIconModel();
|
TrayModel *trayModel = TrayModel::getIconModel();
|
||||||
trayModel->addRow(winInfo);
|
if (!mouseInDock()) {
|
||||||
|
listModel->removeWinInfo(winInfo);
|
||||||
|
trayModel->addRow(winInfo);
|
||||||
|
trayModel->saveConfig(-1, winInfo);
|
||||||
|
}
|
||||||
|
// 如果是任务栏的的托盘区,则更新是否显示展开入口
|
||||||
|
listModel->setExpandVisible(trayModel->rowCount() > 0, false);
|
||||||
|
|
||||||
m_dragPos = QPoint();
|
m_dragPos = QPoint();
|
||||||
m_dropPos = QPoint();
|
m_dropPos = QPoint();
|
||||||
|
|
||||||
trayModel->saveConfig(-1, winInfo);
|
|
||||||
Q_EMIT dragFinished();
|
Q_EMIT dragFinished();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
// 拖拽完成后,将当前拖拽的item从原来的列表中移除,后来会根据实际情况将item插入到特定的列表中
|
||||||
|
listModel->removeWinInfo(winInfo);
|
||||||
|
// 这里是将图标从一个区域移动到另外一个区域
|
||||||
listModel->setDragKey(QString());
|
listModel->setDragKey(QString());
|
||||||
clearDragModelIndex();
|
clearDragModelIndex();
|
||||||
if (listModel->isIconTray()) {
|
if (listModel->isIconTray()) {
|
||||||
|
@ -51,7 +51,6 @@ public Q_SLOTS:
|
|||||||
void onUpdateEditorView();
|
void onUpdateEditorView();
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void requestRemove(const QString &);
|
|
||||||
void dragLeaved();
|
void dragLeaved();
|
||||||
void dragEntered();
|
void dragEntered();
|
||||||
void dragFinished();
|
void dragFinished();
|
||||||
@ -76,6 +75,7 @@ private:
|
|||||||
void initUi();
|
void initUi();
|
||||||
void createAnimation(const int pos, const bool moveNext, const bool isLastAni);
|
void createAnimation(const int pos, const bool moveNext, const bool isLastAni);
|
||||||
const QModelIndex getIndexFromPos(QPoint currentPoint) const;
|
const QModelIndex getIndexFromPos(QPoint currentPoint) const;
|
||||||
|
bool mouseInDock();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QEasingCurve::Type m_aniCurveType;
|
QEasingCurve::Type m_aniCurveType;
|
||||||
|
@ -93,19 +93,16 @@ void TrayModel::dropSwap(int newPos)
|
|||||||
if (!m_dragModelIndex.isValid())
|
if (!m_dragModelIndex.isValid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
removeRows(m_dragModelIndex.row(), 1, QModelIndex());
|
int row = m_dragModelIndex.row();
|
||||||
dropInsert(newPos);
|
|
||||||
|
|
||||||
emit QAbstractItemModel::dataChanged(m_dragModelIndex, m_dropModelIndex);
|
if (row < m_winInfos.size())
|
||||||
}
|
m_dragInfo = m_winInfos.takeAt(row);
|
||||||
|
|
||||||
void TrayModel::dropInsert(int newPos)
|
|
||||||
{
|
|
||||||
beginInsertRows(QModelIndex(), newPos, newPos);
|
|
||||||
WinInfo name = m_dragInfo;
|
WinInfo name = m_dragInfo;
|
||||||
m_winInfos.insert(newPos, name);
|
m_winInfos.insert(newPos, name);
|
||||||
// 更新输入法的位置
|
|
||||||
endInsertRows();
|
emit QAbstractItemModel::dataChanged(m_dragModelIndex, m_dropModelIndex);
|
||||||
|
requestRefreshEditor();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrayModel::clearDragDropIndex()
|
void TrayModel::clearDragDropIndex()
|
||||||
@ -115,7 +112,6 @@ void TrayModel::clearDragDropIndex()
|
|||||||
|
|
||||||
m_dragModelIndex = m_dropModelIndex = QModelIndex();
|
m_dragModelIndex = m_dropModelIndex = QModelIndex();
|
||||||
|
|
||||||
Q_EMIT requestRefreshEditor();
|
|
||||||
emit QAbstractItemModel::dataChanged(startIndex, endIndex);
|
emit QAbstractItemModel::dataChanged(startIndex, endIndex);
|
||||||
emit QAbstractItemModel::dataChanged(endIndex, startIndex);
|
emit QAbstractItemModel::dataChanged(endIndex, startIndex);
|
||||||
}
|
}
|
||||||
@ -125,7 +121,6 @@ void TrayModel::setDragingIndex(const QModelIndex index)
|
|||||||
m_dragModelIndex = index;
|
m_dragModelIndex = index;
|
||||||
m_dropModelIndex = index;
|
m_dropModelIndex = index;
|
||||||
|
|
||||||
Q_EMIT requestRefreshEditor();
|
|
||||||
emit QAbstractListModel::dataChanged(index, index);
|
emit QAbstractListModel::dataChanged(index, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -278,7 +273,6 @@ QVariant TrayModel::data(const QModelIndex &index, int role) const
|
|||||||
bool TrayModel::removeRows(int row, int count, const QModelIndex &parent)
|
bool TrayModel::removeRows(int row, int count, const QModelIndex &parent)
|
||||||
{
|
{
|
||||||
Q_UNUSED(count);
|
Q_UNUSED(count);
|
||||||
Q_UNUSED(parent);
|
|
||||||
|
|
||||||
if (m_winInfos.size() - 1 < row)
|
if (m_winInfos.size() - 1 < row)
|
||||||
return false;
|
return false;
|
||||||
@ -353,20 +347,13 @@ void TrayModel::clear()
|
|||||||
Q_EMIT rowCountChanged();
|
Q_EMIT rowCountChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
WinInfo TrayModel::takeIndex(const QModelIndex &index)
|
WinInfo TrayModel::getWinInfo(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
int row = index.row();
|
int row = index.row();
|
||||||
if (row < 0 || row >= m_winInfos.size())
|
if (row < 0 || row >= m_winInfos.size())
|
||||||
return WinInfo();
|
return WinInfo();
|
||||||
|
|
||||||
WinInfo win = m_winInfos[row];
|
return m_winInfos[row];
|
||||||
beginResetModel();
|
|
||||||
m_winInfos.removeAt(row);
|
|
||||||
endResetModel();
|
|
||||||
|
|
||||||
Q_EMIT rowCountChanged();
|
|
||||||
|
|
||||||
return win;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrayModel::onXEmbedTrayAdded(quint32 winId)
|
void TrayModel::onXEmbedTrayAdded(quint32 winId)
|
||||||
@ -462,6 +449,21 @@ void TrayModel::saveConfig(int index, const WinInfo &winInfo)
|
|||||||
SETTINGCONFIG->setValue(DOCKQUICKTRAYNAME, m_fixedTrayNames);
|
SETTINGCONFIG->setValue(DOCKQUICKTRAYNAME, m_fixedTrayNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TrayModel::removeWinInfo(WinInfo winInfo)
|
||||||
|
{
|
||||||
|
for (const WinInfo &info : m_winInfos) {
|
||||||
|
if (winInfo == info) {
|
||||||
|
int index = m_winInfos.indexOf(info);
|
||||||
|
beginRemoveRows(QModelIndex(), index, index);
|
||||||
|
m_winInfos.removeOne(info);
|
||||||
|
endRemoveRows();
|
||||||
|
|
||||||
|
Q_EMIT rowCountChanged();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool TrayModel::inTrayConfig(const QString itemKey) const
|
bool TrayModel::inTrayConfig(const QString itemKey) const
|
||||||
{
|
{
|
||||||
if (m_isTrayIcon) {
|
if (m_isTrayIcon) {
|
||||||
@ -640,7 +642,7 @@ void TrayModel::onIndicatorAdded(const QString &indicatorName)
|
|||||||
|
|
||||||
const QString &itemKey = IndicatorTrayItem::toIndicatorKey(indicatorName);
|
const QString &itemKey = IndicatorTrayItem::toIndicatorKey(indicatorName);
|
||||||
for (const WinInfo &info : m_winInfos) {
|
for (const WinInfo &info : m_winInfos) {
|
||||||
if (info.key == itemKey)
|
if (info.itemKey == itemKey)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -648,7 +650,7 @@ void TrayModel::onIndicatorAdded(const QString &indicatorName)
|
|||||||
WinInfo info;
|
WinInfo info;
|
||||||
info.type = Incicator;
|
info.type = Incicator;
|
||||||
info.key = itemKey;
|
info.key = itemKey;
|
||||||
info.itemKey = IndicatorTrayItem::toIndicatorKey(indicatorName);
|
info.itemKey = itemKey;
|
||||||
m_winInfos.append(info);
|
m_winInfos.append(info);
|
||||||
|
|
||||||
sortItems();
|
sortItems();
|
||||||
@ -754,7 +756,7 @@ void TrayModel::onSettingChanged(const QString &key, const QVariant &value)
|
|||||||
void TrayModel::removeRow(const QString &itemKey)
|
void TrayModel::removeRow(const QString &itemKey)
|
||||||
{
|
{
|
||||||
for (const WinInfo &info : m_winInfos) {
|
for (const WinInfo &info : m_winInfos) {
|
||||||
if (info.key == itemKey) {
|
if (info.itemKey == itemKey) {
|
||||||
int index = m_winInfos.indexOf(info);
|
int index = m_winInfos.indexOf(info);
|
||||||
beginRemoveRows(QModelIndex(), index, index);
|
beginRemoveRows(QModelIndex(), index, index);
|
||||||
m_winInfos.removeOne(info);
|
m_winInfos.removeOne(info);
|
||||||
|
@ -91,7 +91,6 @@ public:
|
|||||||
static TrayModel *getIconModel();
|
static TrayModel *getIconModel();
|
||||||
|
|
||||||
void dropSwap(int newPos);
|
void dropSwap(int newPos);
|
||||||
void dropInsert(int newPos);
|
|
||||||
|
|
||||||
void clearDragDropIndex();
|
void clearDragDropIndex();
|
||||||
void setDragingIndex(const QModelIndex index);
|
void setDragingIndex(const QModelIndex index);
|
||||||
@ -111,8 +110,9 @@ public:
|
|||||||
bool isEmpty() const;
|
bool isEmpty() const;
|
||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
WinInfo takeIndex(const QModelIndex &index);
|
WinInfo getWinInfo(const QModelIndex &index);
|
||||||
void saveConfig(int index, const WinInfo &winInfo);
|
void saveConfig(int index, const WinInfo &winInfo);
|
||||||
|
void removeWinInfo(WinInfo winInfo);
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void requestUpdateIcon(quint32);
|
void requestUpdateIcon(quint32);
|
||||||
@ -121,7 +121,6 @@ Q_SIGNALS:
|
|||||||
void requestRefreshEditor();
|
void requestRefreshEditor();
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void removeRow(const QString &itemKey);
|
|
||||||
void addRow(WinInfo info);
|
void addRow(WinInfo info);
|
||||||
void insertRow(int index, WinInfo info);
|
void insertRow(int index, WinInfo info);
|
||||||
|
|
||||||
@ -152,6 +151,7 @@ protected:
|
|||||||
Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE;
|
Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void removeRow(const QString &itemKey);
|
||||||
bool exist(const QString &itemKey);
|
bool exist(const QString &itemKey);
|
||||||
QString fileNameByServiceName(const QString &serviceName) const;
|
QString fileNameByServiceName(const QString &serviceName) const;
|
||||||
bool isTypeWriting(const QString &servicePath) const;
|
bool isTypeWriting(const QString &servicePath) const;
|
||||||
|
@ -171,7 +171,6 @@ TrayGridWidget *ExpandIconWidget::popupTrayView()
|
|||||||
connect(trayDelegate, &TrayDelegate::removeRow, trayView, [ = ](const QModelIndex &index) {
|
connect(trayDelegate, &TrayDelegate::removeRow, trayView, [ = ](const QModelIndex &index) {
|
||||||
trayView->model()->removeRow(index.row(),index.parent());
|
trayView->model()->removeRow(index.row(),index.parent());
|
||||||
});
|
});
|
||||||
connect(trayView, &TrayGridView::requestRemove, trayModel, &TrayModel::removeRow);
|
|
||||||
connect(trayModel, &TrayModel::requestOpenEditor, trayView, [ trayView ](const QModelIndex &index) {
|
connect(trayModel, &TrayModel::requestOpenEditor, trayView, [ trayView ](const QModelIndex &index) {
|
||||||
trayView->openPersistentEditor(index);
|
trayView->openPersistentEditor(index);
|
||||||
});
|
});
|
||||||
@ -335,7 +334,7 @@ ExpandIconWidget *TrayGridWidget::expandWidget() const
|
|||||||
if (!dataModel)
|
if (!dataModel)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
for (int i = 0; i < dataModel->rowCount() - 1; i++) {
|
for (int i = 0; i < dataModel->rowCount(); i++) {
|
||||||
QModelIndex index = dataModel->index(i, 0);
|
QModelIndex index = dataModel->index(i, 0);
|
||||||
ExpandIconWidget *widget = qobject_cast<ExpandIconWidget *>(m_referGridView->indexWidget(index));
|
ExpandIconWidget *widget = qobject_cast<ExpandIconWidget *>(m_referGridView->indexWidget(index));
|
||||||
if (widget)
|
if (widget)
|
||||||
|
@ -47,9 +47,11 @@ SystemPluginItem::SystemPluginItem(PluginsItemInterface *const pluginInter, cons
|
|||||||
{
|
{
|
||||||
qDebug() << "load tray plugins item: " << m_pluginInter->pluginName() << itemKey << m_centralWidget;
|
qDebug() << "load tray plugins item: " << m_pluginInter->pluginName() << itemKey << m_centralWidget;
|
||||||
|
|
||||||
m_centralWidget->setParent(this);
|
if (m_centralWidget) {
|
||||||
m_centralWidget->setVisible(true);
|
m_centralWidget->setParent(this);
|
||||||
m_centralWidget->installEventFilter(this);
|
m_centralWidget->setVisible(true);
|
||||||
|
m_centralWidget->installEventFilter(this);
|
||||||
|
}
|
||||||
|
|
||||||
QBoxLayout *hLayout = new QHBoxLayout(this);
|
QBoxLayout *hLayout = new QHBoxLayout(this);
|
||||||
hLayout->addWidget(m_centralWidget);
|
hLayout->addWidget(m_centralWidget);
|
||||||
@ -89,6 +91,8 @@ SystemPluginItem::SystemPluginItem(PluginsItemInterface *const pluginInter, cons
|
|||||||
m_popupAdjustDelayTimer->setInterval(10);
|
m_popupAdjustDelayTimer->setInterval(10);
|
||||||
m_popupAdjustDelayTimer->setSingleShot(true);
|
m_popupAdjustDelayTimer->setSingleShot(true);
|
||||||
|
|
||||||
|
installEventFilter(this);
|
||||||
|
|
||||||
connect(m_popupTipsDelayTimer, &QTimer::timeout, this, &SystemPluginItem::showHoverTips);
|
connect(m_popupTipsDelayTimer, &QTimer::timeout, this, &SystemPluginItem::showHoverTips);
|
||||||
connect(m_popupAdjustDelayTimer, &QTimer::timeout, this, &SystemPluginItem::updatePopupPosition, Qt::QueuedConnection);
|
connect(m_popupAdjustDelayTimer, &QTimer::timeout, this, &SystemPluginItem::updatePopupPosition, Qt::QueuedConnection);
|
||||||
connect(m_contextMenu, &QMenu::triggered, this, &SystemPluginItem::menuActionClicked);
|
connect(m_contextMenu, &QMenu::triggered, this, &SystemPluginItem::menuActionClicked);
|
||||||
@ -188,6 +192,14 @@ bool SystemPluginItem::event(QEvent *event)
|
|||||||
return BaseTrayWidget::event(event);
|
return BaseTrayWidget::event(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SystemPluginItem::eventFilter(QObject *watched, QEvent *event)
|
||||||
|
{
|
||||||
|
if (watched == this && event->type() == QEvent::DeferredDelete)
|
||||||
|
m_centralWidget->setParent(nullptr);
|
||||||
|
|
||||||
|
return BaseTrayWidget::eventFilter(watched, event);
|
||||||
|
}
|
||||||
|
|
||||||
void SystemPluginItem::enterEvent(QEvent *event)
|
void SystemPluginItem::enterEvent(QEvent *event)
|
||||||
{
|
{
|
||||||
if (checkGSettingsControl()) {
|
if (checkGSettingsControl()) {
|
||||||
|
@ -67,6 +67,7 @@ signals:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool event(QEvent *event) override;
|
bool event(QEvent *event) override;
|
||||||
|
bool eventFilter(QObject *watched, QEvent *event) override;
|
||||||
void enterEvent(QEvent *event) override;
|
void enterEvent(QEvent *event) override;
|
||||||
void leaveEvent(QEvent *event) override;
|
void leaveEvent(QEvent *event) override;
|
||||||
void mousePressEvent(QMouseEvent *event) override;
|
void mousePressEvent(QMouseEvent *event) override;
|
||||||
|
@ -270,7 +270,6 @@ void TrayManagerWindow::initUi()
|
|||||||
|
|
||||||
void TrayManagerWindow::initConnection()
|
void TrayManagerWindow::initConnection()
|
||||||
{
|
{
|
||||||
connect(m_trayView, &TrayGridView::requestRemove, m_model, &TrayModel::removeRow);
|
|
||||||
connect(m_model, &TrayModel::rowCountChanged, this, &TrayManagerWindow::onTrayCountChanged);
|
connect(m_model, &TrayModel::rowCountChanged, this, &TrayManagerWindow::onTrayCountChanged);
|
||||||
connect(m_model, &TrayModel::rowCountChanged, m_trayView, &TrayGridView::onUpdateEditorView);
|
connect(m_model, &TrayModel::rowCountChanged, m_trayView, &TrayGridView::onUpdateEditorView);
|
||||||
connect(m_model, &TrayModel::requestRefreshEditor, m_trayView, &TrayGridView::onUpdateEditorView);
|
connect(m_model, &TrayModel::requestRefreshEditor, m_trayView, &TrayGridView::onUpdateEditorView);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user