mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 17:33:05 +00:00
fix popup applet resize
Change-Id: I2820ea03f2fc2e9c0e2c5cdf1c961236a95388ef
This commit is contained in:
parent
a239ca0559
commit
af07f1451b
@ -209,6 +209,15 @@ void DockItem::popupWindowAccept()
|
|||||||
emit requestWindowAutoHide(true);
|
emit requestWindowAutoHide(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DockItem::showPopupApplet(QWidget * const applet)
|
||||||
|
{
|
||||||
|
// another model popup window is alread exists
|
||||||
|
if (PopupWindow->isVisible() && PopupWindow->model())
|
||||||
|
return;
|
||||||
|
|
||||||
|
showPopupWindow(applet, true);
|
||||||
|
}
|
||||||
|
|
||||||
void DockItem::invokedMenuItem(const QString &itemId, const bool checked)
|
void DockItem::invokedMenuItem(const QString &itemId, const bool checked)
|
||||||
{
|
{
|
||||||
Q_UNUSED(itemId)
|
Q_UNUSED(itemId)
|
||||||
|
@ -49,12 +49,15 @@ protected:
|
|||||||
|
|
||||||
void showContextMenu();
|
void showContextMenu();
|
||||||
void showHoverTips();
|
void showHoverTips();
|
||||||
void showPopupWindow(QWidget * const content, const bool model = false);
|
|
||||||
void popupWindowAccept();
|
void popupWindowAccept();
|
||||||
|
void showPopupApplet(QWidget * const applet);
|
||||||
virtual void invokedMenuItem(const QString &itemId, const bool checked);
|
virtual void invokedMenuItem(const QString &itemId, const bool checked);
|
||||||
virtual const QString contextMenu() const;
|
virtual const QString contextMenu() const;
|
||||||
virtual QWidget *popupTips();
|
virtual QWidget *popupTips();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void showPopupWindow(QWidget * const content, const bool model = false);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ItemType m_type;
|
ItemType m_type;
|
||||||
bool m_hover;
|
bool m_hover;
|
||||||
|
@ -147,5 +147,5 @@ void PluginsItem::mouseClicked()
|
|||||||
// request popup applet
|
// request popup applet
|
||||||
QWidget *w = m_pluginInter->itemPopupApplet(m_itemKey);
|
QWidget *w = m_pluginInter->itemPopupApplet(m_itemKey);
|
||||||
if (w)
|
if (w)
|
||||||
showPopupWindow(w, true);
|
showPopupApplet(w);
|
||||||
}
|
}
|
||||||
|
@ -26,9 +26,20 @@ bool DockPopupWindow::model() const
|
|||||||
return m_model;
|
return m_model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DockPopupWindow::setContent(QWidget *content)
|
||||||
|
{
|
||||||
|
QWidget *lastWidget = getContent();
|
||||||
|
if (lastWidget)
|
||||||
|
lastWidget->removeEventFilter(this);
|
||||||
|
content->installEventFilter(this);
|
||||||
|
|
||||||
|
DArrowRectangle::setContent(content);
|
||||||
|
}
|
||||||
|
|
||||||
void DockPopupWindow::show(const QPoint &pos, const bool model)
|
void DockPopupWindow::show(const QPoint &pos, const bool model)
|
||||||
{
|
{
|
||||||
m_model = model;
|
m_model = model;
|
||||||
|
m_lastPoint = pos;
|
||||||
|
|
||||||
DArrowRectangle::show(pos.x(), pos.y());
|
DArrowRectangle::show(pos.x(), pos.y());
|
||||||
|
|
||||||
@ -58,7 +69,17 @@ void DockPopupWindow::mousePressEvent(QMouseEvent *e)
|
|||||||
DArrowRectangle::mousePressEvent(e);
|
DArrowRectangle::mousePressEvent(e);
|
||||||
|
|
||||||
// if (e->button() == Qt::LeftButton)
|
// if (e->button() == Qt::LeftButton)
|
||||||
// m_acceptDelayTimer->start();
|
// m_acceptDelayTimer->start();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DockPopupWindow::eventFilter(QObject *o, QEvent *e)
|
||||||
|
{
|
||||||
|
if (o != getContent() || e->type() != QEvent::Resize)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// show(m_lastPoint, m_model);
|
||||||
|
QMetaObject::invokeMethod(this, "show", Qt::QueuedConnection, Q_ARG(QPoint, m_lastPoint), Q_ARG(bool, m_model));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DockPopupWindow::globalMouseRelease(int button, int x, int y, const QString &id)
|
void DockPopupWindow::globalMouseRelease(int button, int x, int y, const QString &id)
|
||||||
|
@ -15,6 +15,8 @@ public:
|
|||||||
|
|
||||||
bool model() const;
|
bool model() const;
|
||||||
|
|
||||||
|
void setContent(QWidget *content);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void show(const QPoint &pos, const bool model = false);
|
void show(const QPoint &pos, const bool model = false);
|
||||||
void hide();
|
void hide();
|
||||||
@ -24,12 +26,14 @@ signals:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
void mousePressEvent(QMouseEvent *e);
|
void mousePressEvent(QMouseEvent *e);
|
||||||
|
bool eventFilter(QObject *o, QEvent *e);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void globalMouseRelease(int button, int x, int y, const QString &id);
|
void globalMouseRelease(int button, int x, int y, const QString &id);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_model;
|
bool m_model;
|
||||||
|
QPoint m_lastPoint;
|
||||||
QString m_mouseAreaKey;
|
QString m_mouseAreaKey;
|
||||||
|
|
||||||
QTimer *m_acceptDelayTimer;
|
QTimer *m_acceptDelayTimer;
|
||||||
|
@ -10,8 +10,8 @@ class AccessPoint : public QObject
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AccessPoint(const QJsonObject &apInfo);
|
explicit AccessPoint(const QJsonObject &apInfo);
|
||||||
|
explicit AccessPoint(const QString &info);
|
||||||
AccessPoint(const AccessPoint &ap);
|
AccessPoint(const AccessPoint &ap);
|
||||||
AccessPoint(const QString &info);
|
|
||||||
bool operator==(const AccessPoint &ap) const;
|
bool operator==(const AccessPoint &ap) const;
|
||||||
bool operator>(const AccessPoint &ap) const;
|
bool operator>(const AccessPoint &ap) const;
|
||||||
AccessPoint &operator=(const AccessPoint &ap);
|
AccessPoint &operator=(const AccessPoint &ap);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user