mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 17:33:05 +00:00
abstractdockitem add show and hide preview function
This commit is contained in:
parent
7d704b2d82
commit
6ace2a5af9
@ -11,7 +11,6 @@ AppItem::AppItem(QWidget *parent) :
|
||||
connect(dockCons, &DockModeData::dockModeChanged,this, &AppItem::slotDockModeChanged);
|
||||
|
||||
initMenu();
|
||||
initPreviewAR();
|
||||
}
|
||||
|
||||
QWidget *AppItem::getContents()
|
||||
@ -216,13 +215,6 @@ void AppItem::initMenu()
|
||||
m_menuManager = new DBusMenuManager(this);
|
||||
}
|
||||
|
||||
void AppItem::initPreviewAR()
|
||||
{
|
||||
m_previewAR = new ArrowRectangle();
|
||||
m_previewAR->setHeight(130);
|
||||
m_previewAR->setWidth(200);
|
||||
}
|
||||
|
||||
void AppItem::showMenu()
|
||||
{
|
||||
if (m_menuManager->isValid()){
|
||||
@ -245,20 +237,6 @@ void AppItem::showMenu()
|
||||
}
|
||||
}
|
||||
|
||||
void AppItem::showPreview()
|
||||
{
|
||||
QWidget *tmpContent = getContents();
|
||||
m_previewAR->setMinimumSize(tmpContent->width() + Dock::APP_PREVIEW_MARGIN * 2,tmpContent->height() + Dock::APP_PREVIEW_MARGIN * 2);
|
||||
m_previewAR->resize(tmpContent->width() + Dock::APP_PREVIEW_MARGIN * 2,tmpContent->height() + Dock::APP_PREVIEW_MARGIN * 2);
|
||||
m_previewAR->setContent(getContents());
|
||||
m_previewAR->showAtBottom(globalX() + width() / 2,globalY() - 5);
|
||||
}
|
||||
|
||||
void AppItem::hidePreview()
|
||||
{
|
||||
m_previewAR->delayHide();
|
||||
}
|
||||
|
||||
void AppItem::mousePressEvent(QMouseEvent * event)
|
||||
{
|
||||
//qWarning() << "mouse press...";
|
||||
|
@ -84,18 +84,14 @@ private:
|
||||
void updateXids();
|
||||
void updateMenuJsonString();
|
||||
void initMenu();
|
||||
void initPreviewAR();
|
||||
|
||||
void showMenu();
|
||||
void showPreview();
|
||||
void hidePreview();
|
||||
|
||||
private:
|
||||
AppItemData m_itemData;
|
||||
DockModeData *dockCons = DockModeData::instance();
|
||||
AppBackground * appBackground = NULL;
|
||||
AppIcon * m_appIcon = NULL;
|
||||
ArrowRectangle *m_previewAR = NULL;
|
||||
|
||||
DBusEntryProxyer *m_entryProxyer = NULL;
|
||||
DBusClientManager *m_clientmanager = NULL;
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <QFrame>
|
||||
#include <QLabel>
|
||||
#include "Widgets/appicon.h"
|
||||
#include "Widgets/arrowrectangle.h"
|
||||
|
||||
class AbstractDockItem : public QFrame
|
||||
{
|
||||
@ -35,6 +36,20 @@ public:
|
||||
int globalX(){return mapToGlobal(QPoint(0,0)).x();}
|
||||
int globalY(){return mapToGlobal(QPoint(0,0)).y();}
|
||||
QPoint globalPos(){return mapToGlobal(QPoint(0,0));}
|
||||
|
||||
void showPreview(){
|
||||
QWidget *tmpContent = getContents();
|
||||
m_previewAR->setMinimumSize(tmpContent->width(),tmpContent->height());
|
||||
m_previewAR->resize(tmpContent->width(),tmpContent->height());
|
||||
m_previewAR->setContent(getContents());
|
||||
m_previewAR->showAtBottom(globalX() + width() / 2,globalY() - 5);
|
||||
}
|
||||
|
||||
void hidePreview(int interval = 300){
|
||||
m_previewAR->delayHide(interval);
|
||||
}
|
||||
|
||||
|
||||
signals:
|
||||
void dragStart();
|
||||
void dragEntered(QDragEnterEvent * event);
|
||||
@ -51,6 +66,7 @@ protected:
|
||||
|
||||
bool m_moveable = true;
|
||||
bool m_isActived = false;
|
||||
ArrowRectangle *m_previewAR = new ArrowRectangle();
|
||||
|
||||
QPoint m_itemNextPos;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user