mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 17:33:05 +00:00
fixed(appitem):appitem undock on 2d
This commit is contained in:
parent
988e44ebb0
commit
cd405aee3e
@ -53,6 +53,7 @@ public:
|
|||||||
void setDockInfo(Dock::Position dockPosition, const QRect &dockGeometry);
|
void setDockInfo(Dock::Position dockPosition, const QRect &dockGeometry);
|
||||||
|
|
||||||
inline ItemType itemType() const Q_DECL_OVERRIDE { return App; }
|
inline ItemType itemType() const Q_DECL_OVERRIDE { return App; }
|
||||||
|
QPixmap appIcon(){ return m_appIcon; }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void requestActivateWindow(const WId wid) const;
|
void requestActivateWindow(const WId wid) const;
|
||||||
|
@ -44,6 +44,7 @@ public:
|
|||||||
void setAppPixmap(const QPixmap &pix);
|
void setAppPixmap(const QPixmap &pix);
|
||||||
void setDockInfo(Dock::Position dockPosition, const QRect &dockGeometry);
|
void setDockInfo(Dock::Position dockPosition, const QRect &dockGeometry);
|
||||||
void setOriginPos(const QPoint position);
|
void setOriginPos(const QPoint position);
|
||||||
|
bool isRemoveAble();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
||||||
@ -58,7 +59,6 @@ private:
|
|||||||
void showGoBackAnimation();
|
void showGoBackAnimation();
|
||||||
void onRemoveAnimationStateChanged(QAbstractAnimation::State newState,
|
void onRemoveAnimationStateChanged(QAbstractAnimation::State newState,
|
||||||
QAbstractAnimation::State oldState);
|
QAbstractAnimation::State oldState);
|
||||||
bool isRemoveAble();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AppGraphicsObject *m_object;
|
AppGraphicsObject *m_object;
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
#include <DGuiApplicationHelper>
|
#include <DGuiApplicationHelper>
|
||||||
|
#include <DWindowManagerHelper>
|
||||||
|
|
||||||
#define SPLITER_SIZE 2
|
#define SPLITER_SIZE 2
|
||||||
|
|
||||||
@ -549,18 +550,27 @@ void MainPanelControl::startDrag(DockItem *item)
|
|||||||
QDrag *drag = nullptr;
|
QDrag *drag = nullptr;
|
||||||
if (item->itemType() == DockItem::App) {
|
if (item->itemType() == DockItem::App) {
|
||||||
AppDrag *appDrag = new AppDrag(item);
|
AppDrag *appDrag = new AppDrag(item);
|
||||||
appDrag->setPixmap(pixmap);
|
|
||||||
m_appDragWidget = appDrag->appDragWidget();
|
m_appDragWidget = appDrag->appDragWidget();
|
||||||
|
|
||||||
connect(m_appDragWidget, &AppDragWidget::destroyed, this, [ = ] {
|
connect(m_appDragWidget, &AppDragWidget::destroyed, this, [ = ] {
|
||||||
m_appDragWidget = nullptr;
|
m_appDragWidget = nullptr;
|
||||||
});
|
});
|
||||||
|
|
||||||
m_appDragWidget->show();
|
|
||||||
|
|
||||||
appDrag->appDragWidget()->setOriginPos((m_appAreaSonWidget->mapToGlobal(item->pos())));
|
appDrag->appDragWidget()->setOriginPos((m_appAreaSonWidget->mapToGlobal(item->pos())));
|
||||||
appDrag->appDragWidget()->setDockInfo(m_position, QRect(mapToGlobal(pos()), size()));
|
appDrag->appDragWidget()->setDockInfo(m_position, QRect(mapToGlobal(pos()), size()));
|
||||||
static_cast<QGraphicsView *>(m_appDragWidget)->viewport()->installEventFilter(this);
|
|
||||||
|
if (DWindowManagerHelper::instance()->hasComposite()) {
|
||||||
|
appDrag->setPixmap(pixmap);
|
||||||
|
m_appDragWidget->show();
|
||||||
|
|
||||||
|
static_cast<QGraphicsView *>(m_appDragWidget)->viewport()->installEventFilter(this);
|
||||||
|
} else {
|
||||||
|
const QPixmap &dragPix = qobject_cast<AppItem *>(item)->appIcon();
|
||||||
|
|
||||||
|
appDrag->QDrag::setPixmap(dragPix);
|
||||||
|
appDrag->setHotSpot(dragPix.rect().center() / dragPix.devicePixelRatioF());
|
||||||
|
}
|
||||||
|
|
||||||
drag = appDrag;
|
drag = appDrag;
|
||||||
} else {
|
} else {
|
||||||
@ -571,6 +581,12 @@ void MainPanelControl::startDrag(DockItem *item)
|
|||||||
drag->setMimeData(new QMimeData);
|
drag->setMimeData(new QMimeData);
|
||||||
drag->exec(Qt::MoveAction);
|
drag->exec(Qt::MoveAction);
|
||||||
|
|
||||||
|
// app关闭特效情况下移除
|
||||||
|
if (item->itemType() == DockItem::App && !DWindowManagerHelper::instance()->hasComposite()) {
|
||||||
|
if (m_appDragWidget->isRemoveAble())
|
||||||
|
qobject_cast<AppItem *>(item)->undock();
|
||||||
|
}
|
||||||
|
|
||||||
m_appDragWidget = nullptr;
|
m_appDragWidget = nullptr;
|
||||||
item->setDraging(false);
|
item->setDraging(false);
|
||||||
item->update();
|
item->update();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user