mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 17:33:05 +00:00
Fix screenmask show error and drag item error
This commit is contained in:
parent
d566addbce
commit
eaf5c6a305
@ -13,7 +13,7 @@ void AppManager::updateEntries()
|
|||||||
for (int i = 0; i < entryList.count(); i ++)
|
for (int i = 0; i < entryList.count(); i ++)
|
||||||
{
|
{
|
||||||
DBusEntryProxyer *dep = new DBusEntryProxyer(entryList.at(i).path());
|
DBusEntryProxyer *dep = new DBusEntryProxyer(entryList.at(i).path());
|
||||||
if (dep->isValid() && dep->type() == "App")
|
if (dep->isValid() && dep->type() == "App" && dep->data().value("title") != "dde-dock")
|
||||||
{
|
{
|
||||||
AppItem *item = new AppItem();
|
AppItem *item = new AppItem();
|
||||||
item->setEntryProxyer(dep);
|
item->setEntryProxyer(dep);
|
||||||
|
@ -61,10 +61,6 @@ void Panel::showScreenMask()
|
|||||||
connect(maskWidget,SIGNAL(itemDropped(QPoint)),this,SLOT(slotItemDropped()));
|
connect(maskWidget,SIGNAL(itemDropped(QPoint)),this,SLOT(slotItemDropped()));
|
||||||
connect(maskWidget,SIGNAL(itemEntered()),this,SLOT(slotEnteredMask()));
|
connect(maskWidget,SIGNAL(itemEntered()),this,SLOT(slotEnteredMask()));
|
||||||
connect(maskWidget,SIGNAL(itemExited()),this,SLOT(slotExitedMask()));
|
connect(maskWidget,SIGNAL(itemExited()),this,SLOT(slotExitedMask()));
|
||||||
|
|
||||||
//TODO change to Other ways to do this,it will hide the drag icon
|
|
||||||
parentWidget->hide();
|
|
||||||
parentWidget->show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Panel::hideScreenMask()
|
void Panel::hideScreenMask()
|
||||||
|
@ -22,16 +22,23 @@ void AppIcon::setIcon(const QString &iconPath)
|
|||||||
if (sysIconPath != "")
|
if (sysIconPath != "")
|
||||||
{
|
{
|
||||||
iconPixmap.load(sysIconPath);
|
iconPixmap.load(sysIconPath);
|
||||||
|
m_iconPath = sysIconPath;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
iconPixmap.load(iconPath);
|
iconPixmap.load(iconPath);
|
||||||
|
m_iconPath = iconPath;
|
||||||
}
|
}
|
||||||
this->setPixmap(iconPixmap);
|
this->setPixmap(iconPixmap);
|
||||||
QLabel::setPixmap(this->pixmap()->scaled(m_modeData->getAppIconSize(),m_modeData->getAppIconSize(),
|
QLabel::setPixmap(this->pixmap()->scaled(m_modeData->getAppIconSize(),m_modeData->getAppIconSize(),
|
||||||
Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation));
|
Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString AppIcon::getIconPath() const
|
||||||
|
{
|
||||||
|
return m_iconPath;
|
||||||
|
}
|
||||||
|
|
||||||
QString AppIcon::getSysIcon(const QString &iconName, int size)
|
QString AppIcon::getSysIcon(const QString &iconName, int size)
|
||||||
{
|
{
|
||||||
char *name = iconName.toUtf8().data();
|
char *name = iconName.toUtf8().data();
|
||||||
|
@ -15,6 +15,7 @@ public:
|
|||||||
explicit AppIcon(QWidget *parent = 0,Qt::WindowFlags f = 0);
|
explicit AppIcon(QWidget *parent = 0,Qt::WindowFlags f = 0);
|
||||||
|
|
||||||
void setIcon(const QString &iconPath);
|
void setIcon(const QString &iconPath);
|
||||||
|
QString getIconPath() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
@ -23,6 +24,7 @@ public slots:
|
|||||||
QString getSysIcon(const QString &iconName, int size = 48);
|
QString getSysIcon(const QString &iconName, int size = 48);
|
||||||
private:
|
private:
|
||||||
DockModeData *m_modeData = DockModeData::instance();
|
DockModeData *m_modeData = DockModeData::instance();
|
||||||
|
QString m_iconPath;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // APPICON_H
|
#endif // APPICON_H
|
||||||
|
@ -222,16 +222,17 @@ void AppItem::mousePressEvent(QMouseEvent * event)
|
|||||||
//qWarning() << "mouse press...";
|
//qWarning() << "mouse press...";
|
||||||
emit mousePress(event->globalX(), event->globalY());
|
emit mousePress(event->globalX(), event->globalY());
|
||||||
|
|
||||||
if (event->button() == Qt::LeftButton)
|
|
||||||
m_entryProxyer->Activate(0,0);
|
|
||||||
else if (event->button() == Qt::RightButton)
|
|
||||||
showMenu(event->globalX(),event->globalY());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppItem::mouseReleaseEvent(QMouseEvent * event)
|
void AppItem::mouseReleaseEvent(QMouseEvent * event)
|
||||||
{
|
{
|
||||||
// qWarning() << "mouse release...";
|
// qWarning() << "mouse release...";
|
||||||
emit mouseRelease(event->globalX(), event->globalY());
|
emit mouseRelease(event->globalX(), event->globalY());
|
||||||
|
|
||||||
|
if (event->button() == Qt::LeftButton)
|
||||||
|
m_entryProxyer->Activate(event->globalX(),event->globalY());
|
||||||
|
else if (event->button() == Qt::RightButton)
|
||||||
|
showMenu(event->globalX(),event->globalY());
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppItem::mouseDoubleClickEvent(QMouseEvent * event)
|
void AppItem::mouseDoubleClickEvent(QMouseEvent * event)
|
||||||
@ -249,11 +250,11 @@ void AppItem::mouseMoveEvent(QMouseEvent *event)
|
|||||||
{
|
{
|
||||||
QDrag* drag = new QDrag(this);
|
QDrag* drag = new QDrag(this);
|
||||||
QMimeData* data = new QMimeData();
|
QMimeData* data = new QMimeData();
|
||||||
QImage dataImg(m_itemData.iconPath);
|
QImage dataImg(m_appIcon->getIconPath());
|
||||||
data->setImageData(QVariant(dataImg));
|
data->setImageData(QVariant(dataImg));
|
||||||
drag->setMimeData(data);
|
drag->setMimeData(data);
|
||||||
|
|
||||||
QPixmap pixmap(m_itemData.iconPath);
|
QPixmap pixmap(m_appIcon->getIconPath());
|
||||||
drag->setPixmap(pixmap);
|
drag->setPixmap(pixmap);
|
||||||
|
|
||||||
drag->setHotSpot(QPoint(15,15));
|
drag->setHotSpot(QPoint(15,15));
|
||||||
|
@ -4,7 +4,7 @@ ScreenMask::ScreenMask(QWidget *parent) : QWidget(parent)
|
|||||||
{
|
{
|
||||||
QRect rec = QApplication::desktop()->screenGeometry();
|
QRect rec = QApplication::desktop()->screenGeometry();
|
||||||
this->resize(rec.width(),rec.height());
|
this->resize(rec.width(),rec.height());
|
||||||
this->setWindowFlags(Qt::ToolTip);
|
this->setWindowFlags(Qt::FramelessWindowHint);
|
||||||
this->setWindowOpacity(0);
|
this->setWindowOpacity(0);
|
||||||
|
|
||||||
setAcceptDrops(true);
|
setAcceptDrops(true);
|
||||||
@ -43,5 +43,11 @@ void ScreenMask::dropEvent(QDropEvent *event)
|
|||||||
|
|
||||||
emit itemDropped(event->pos());
|
emit itemDropped(event->pos());
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qWarning() << "Image is NULL!";
|
||||||
|
}
|
||||||
|
|
||||||
|
this->close();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user