Fix screenmask show error and drag item error

This commit is contained in:
杨万青 2015-07-07 11:38:43 +08:00
parent d566addbce
commit eaf5c6a305
6 changed files with 24 additions and 12 deletions

View File

@ -13,7 +13,7 @@ void AppManager::updateEntries()
for (int i = 0; i < entryList.count(); i ++)
{
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();
item->setEntryProxyer(dep);

View File

@ -61,10 +61,6 @@ void Panel::showScreenMask()
connect(maskWidget,SIGNAL(itemDropped(QPoint)),this,SLOT(slotItemDropped()));
connect(maskWidget,SIGNAL(itemEntered()),this,SLOT(slotEnteredMask()));
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()

View File

@ -22,16 +22,23 @@ void AppIcon::setIcon(const QString &iconPath)
if (sysIconPath != "")
{
iconPixmap.load(sysIconPath);
m_iconPath = sysIconPath;
}
else
{
iconPixmap.load(iconPath);
m_iconPath = iconPath;
}
this->setPixmap(iconPixmap);
QLabel::setPixmap(this->pixmap()->scaled(m_modeData->getAppIconSize(),m_modeData->getAppIconSize(),
Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation));
}
QString AppIcon::getIconPath() const
{
return m_iconPath;
}
QString AppIcon::getSysIcon(const QString &iconName, int size)
{
char *name = iconName.toUtf8().data();

View File

@ -15,6 +15,7 @@ public:
explicit AppIcon(QWidget *parent = 0,Qt::WindowFlags f = 0);
void setIcon(const QString &iconPath);
QString getIconPath() const;
signals:
@ -23,6 +24,7 @@ public slots:
QString getSysIcon(const QString &iconName, int size = 48);
private:
DockModeData *m_modeData = DockModeData::instance();
QString m_iconPath;
};
#endif // APPICON_H

View File

@ -222,16 +222,17 @@ void AppItem::mousePressEvent(QMouseEvent * event)
//qWarning() << "mouse press...";
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)
{
// qWarning() << "mouse release...";
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)
@ -249,11 +250,11 @@ void AppItem::mouseMoveEvent(QMouseEvent *event)
{
QDrag* drag = new QDrag(this);
QMimeData* data = new QMimeData();
QImage dataImg(m_itemData.iconPath);
QImage dataImg(m_appIcon->getIconPath());
data->setImageData(QVariant(dataImg));
drag->setMimeData(data);
QPixmap pixmap(m_itemData.iconPath);
QPixmap pixmap(m_appIcon->getIconPath());
drag->setPixmap(pixmap);
drag->setHotSpot(QPoint(15,15));

View File

@ -4,7 +4,7 @@ ScreenMask::ScreenMask(QWidget *parent) : QWidget(parent)
{
QRect rec = QApplication::desktop()->screenGeometry();
this->resize(rec.width(),rec.height());
this->setWindowFlags(Qt::ToolTip);
this->setWindowFlags(Qt::FramelessWindowHint);
this->setWindowOpacity(0);
setAcceptDrops(true);
@ -43,5 +43,11 @@ void ScreenMask::dropEvent(QDropEvent *event)
emit itemDropped(event->pos());
}
else
{
qWarning() << "Image is NULL!";
}
this->close();
}