mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 17:33:05 +00:00
bugfix: the position of plugin's preview incorrect
Change-Id: Ie46760d3d19ebe4d9ca78e3ff4e92147680b10b1
This commit is contained in:
parent
99cf01434a
commit
9407ab224f
Notes:
Deepin Code Review
2016-06-14 07:19:47 +00:00
Verified+1: Anonymous Coward #1000004 Code-Review+2: <mr.asianwang@gmail.com> Submitted-by: <mr.asianwang@gmail.com> Submitted-at: Mon, 19 Oct 2015 16:22:13 +0800 Reviewed-on: https://cr.deepin.io/7854 Project: dde/dde-dock Branch: refs/heads/master
@ -2,8 +2,10 @@
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
#include <QProcess>
|
||||
#include <QApplication>
|
||||
|
||||
#include "pluginitemwrapper.h"
|
||||
#include "../dockmodedata.h"
|
||||
|
||||
static const QString MenuItemRun = "id_run";
|
||||
static const QString MenuItemRemove = "id_remove";
|
||||
@ -55,8 +57,10 @@ void PluginItemWrapper::enterEvent(QEvent *)
|
||||
{
|
||||
emit mouseEntered();
|
||||
|
||||
if (hoverable())
|
||||
showPreview();
|
||||
if (hoverable()) {
|
||||
QRect rec = QApplication::desktop()->screenGeometry();
|
||||
showPreview(QPoint(globalX() + width() / 2, rec.height() - DockModeData::instance()->getDockHeight() - 4));
|
||||
}
|
||||
}
|
||||
|
||||
void PluginItemWrapper::leaveEvent(QEvent *)
|
||||
|
@ -133,7 +133,7 @@ QPoint AbstractDockItem::globalPos()
|
||||
return mapToGlobal(QPoint(0,0));
|
||||
}
|
||||
|
||||
void AbstractDockItem::showPreview()
|
||||
void AbstractDockItem::showPreview(const QPoint &previewPos)
|
||||
{
|
||||
if (!m_titlePreview->isHidden())
|
||||
{
|
||||
@ -141,7 +141,7 @@ void AbstractDockItem::showPreview()
|
||||
return;
|
||||
}
|
||||
|
||||
m_previewPos = QPoint(globalX() + width() / 2, globalY() - 5);
|
||||
QPoint pos = previewPos.isNull() ? QPoint(globalX() + width() / 2, globalY() - 5) : previewPos;
|
||||
if (getApplet() == NULL) {
|
||||
QString title = getTitle();
|
||||
if (!title.isEmpty()) {
|
||||
@ -160,7 +160,7 @@ void AbstractDockItem::showPreview()
|
||||
else {
|
||||
m_titleLabel->setParent(NULL);
|
||||
|
||||
emit needPreviewShow(m_previewPos);
|
||||
emit needPreviewShow(pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ public:
|
||||
void resize(const QSize &size);
|
||||
void resize(int width,int height);
|
||||
void showMenu();
|
||||
void showPreview();
|
||||
void showPreview(const QPoint &previewPos = QPoint(0, 0));
|
||||
void hidePreview(bool immediately = false);
|
||||
void setParent(QWidget * parent);
|
||||
|
||||
@ -84,7 +84,6 @@ protected:
|
||||
ItemTitleLabel *m_titleLabel = NULL;
|
||||
|
||||
QPoint m_itemNextPos;
|
||||
QPoint m_previewPos;
|
||||
|
||||
DBusMenu * m_dbusMenu = NULL;
|
||||
DBusMenuManager * m_dbusMenuManager = NULL;
|
||||
|
Loading…
x
Reference in New Issue
Block a user