delay collapse of the applet in popup
is expensive, so event-compress also, since the creation of qml objects is async (and the event loop will continue to go) it may cause race conditions instead
This commit is contained in:
parent
100c940a63
commit
d49956e458
@ -80,6 +80,10 @@ AppletInterface::AppletInterface(DeclarativeAppletScript *script, QQuickItem *pa
|
||||
m_creationTimer = new QTimer(this);
|
||||
m_creationTimer->setSingleShot(true);
|
||||
connect(m_creationTimer, &QTimer::timeout, this, &AppletInterface::init);
|
||||
|
||||
m_collapseTimer = new QTimer(this);
|
||||
m_collapseTimer->setSingleShot(true);
|
||||
connect(m_collapseTimer, &QTimer::timeout, this, &AppletInterface::compactRepresentationCheck);
|
||||
}
|
||||
|
||||
AppletInterface::~AppletInterface()
|
||||
@ -569,7 +573,11 @@ void AppletInterface::geometryChanged(const QRectF &newGeometry, const QRectF &o
|
||||
Q_UNUSED(oldGeometry)
|
||||
|
||||
QQuickItem::geometryChanged(newGeometry, oldGeometry);
|
||||
m_collapseTimer->start(100);
|
||||
}
|
||||
|
||||
void AppletInterface::compactRepresentationCheck()
|
||||
{
|
||||
if (!m_qmlObject->rootObject() || qobject_cast<ContainmentInterface *>(this)) {
|
||||
return;
|
||||
}
|
||||
@ -584,7 +592,7 @@ void AppletInterface::geometryChanged(const QRectF &newGeometry, const QRectF &o
|
||||
}
|
||||
|
||||
//TODO: completely arbitrary for now
|
||||
if (newGeometry.width() < minHint.width() || newGeometry.height() < minHint.height()) {
|
||||
if (width() < minHint.width() || height() < minHint.height()) {
|
||||
m_expanded = false;
|
||||
|
||||
//we are already an icon: nothing to do
|
||||
|
@ -180,12 +180,17 @@ Q_SIGNALS:
|
||||
void implicitHeightChanged();
|
||||
|
||||
protected:
|
||||
virtual void init();
|
||||
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry);
|
||||
void itemChange(ItemChange change, const ItemChangeData &value);
|
||||
|
||||
DeclarativeAppletScript *m_appletScriptEngine;
|
||||
|
||||
protected Q_SLOTS:
|
||||
virtual void init();
|
||||
|
||||
private Q_SLOTS:
|
||||
void compactRepresentationCheck();
|
||||
|
||||
private:
|
||||
//Helper for minimumWidth etc.
|
||||
qreal readGraphicsObjectSizeHint(const char *hint) const;
|
||||
@ -203,6 +208,7 @@ private:
|
||||
QWeakPointer<QObject> m_compactUiObject;
|
||||
|
||||
QTimer *m_creationTimer;
|
||||
QTimer *m_collapseTimer;
|
||||
|
||||
Plasma::Types::BackgroundHints m_backgroundHints;
|
||||
bool m_busy : 1;
|
||||
|
Loading…
Reference in New Issue
Block a user