[scriptengine/qml] Allow applets to set full ToolTip item
Adds new property available as Plasmoid.toolTipItem that allows to set a full custom item as the tooltip REVIEW: 126463
This commit is contained in:
parent
532fce558d
commit
3992593f31
@ -53,6 +53,7 @@ AppletInterface::AppletInterface(DeclarativeAppletScript *script, const QVariant
|
|||||||
m_configuration(0),
|
m_configuration(0),
|
||||||
m_appletScriptEngine(script),
|
m_appletScriptEngine(script),
|
||||||
m_toolTipTextFormat(0),
|
m_toolTipTextFormat(0),
|
||||||
|
m_toolTipItem(0),
|
||||||
m_args(args),
|
m_args(args),
|
||||||
m_backgroundHints(Plasma::Types::StandardBackground),
|
m_backgroundHints(Plasma::Types::StandardBackground),
|
||||||
m_busy(false),
|
m_busy(false),
|
||||||
@ -350,6 +351,24 @@ void AppletInterface::setToolTipTextFormat(int format)
|
|||||||
emit toolTipTextFormatChanged();
|
emit toolTipTextFormatChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QQuickItem *AppletInterface::toolTipItem() const
|
||||||
|
{
|
||||||
|
return m_toolTipItem.data();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AppletInterface::setToolTipItem(QQuickItem *toolTipItem)
|
||||||
|
{
|
||||||
|
if (m_toolTipItem.data() == toolTipItem) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
connect(m_toolTipItem.data(), &QObject::destroyed,
|
||||||
|
this, &AppletInterface::toolTipItemChanged);
|
||||||
|
|
||||||
|
m_toolTipItem = toolTipItem;
|
||||||
|
emit toolTipItemChanged();
|
||||||
|
}
|
||||||
|
|
||||||
bool AppletInterface::isBusy() const
|
bool AppletInterface::isBusy() const
|
||||||
{
|
{
|
||||||
return m_busy;
|
return m_busy;
|
||||||
|
@ -100,6 +100,15 @@ class AppletInterface : public PlasmaQuick::AppletQuickItem
|
|||||||
*/
|
*/
|
||||||
Q_PROPERTY(int toolTipTextFormat READ toolTipTextFormat WRITE setToolTipTextFormat NOTIFY toolTipTextFormatChanged)
|
Q_PROPERTY(int toolTipTextFormat READ toolTipTextFormat WRITE setToolTipTextFormat NOTIFY toolTipTextFormatChanged)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This allows to set custom full QML items as the tooltip.
|
||||||
|
* It will ignore all texts set by setToolTipMainText or setToolTipSubText
|
||||||
|
*
|
||||||
|
* @since: 5.19
|
||||||
|
*/
|
||||||
|
Q_PROPERTY(QQuickItem *toolTipItem READ toolTipItem WRITE setToolTipItem NOTIFY toolTipItemChanged)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Icon to represent the plasmoid
|
* Icon to represent the plasmoid
|
||||||
*/
|
*/
|
||||||
@ -285,6 +294,9 @@ public:
|
|||||||
int toolTipTextFormat() const;
|
int toolTipTextFormat() const;
|
||||||
void setToolTipTextFormat(int format);
|
void setToolTipTextFormat(int format);
|
||||||
|
|
||||||
|
QQuickItem *toolTipItem() const;
|
||||||
|
void setToolTipItem(QQuickItem *toolTipItem);
|
||||||
|
|
||||||
uint id() const;
|
uint id() const;
|
||||||
|
|
||||||
Plasma::Types::FormFactor formFactor() const;
|
Plasma::Types::FormFactor formFactor() const;
|
||||||
@ -353,6 +365,7 @@ Q_SIGNALS:
|
|||||||
void toolTipMainTextChanged();
|
void toolTipMainTextChanged();
|
||||||
void toolTipSubTextChanged();
|
void toolTipSubTextChanged();
|
||||||
void toolTipTextFormatChanged();
|
void toolTipTextFormatChanged();
|
||||||
|
void toolTipItemChanged();
|
||||||
void formFactorChanged();
|
void formFactorChanged();
|
||||||
void locationChanged();
|
void locationChanged();
|
||||||
void contextChanged();
|
void contextChanged();
|
||||||
@ -391,6 +404,7 @@ private:
|
|||||||
QString m_toolTipMainText;
|
QString m_toolTipMainText;
|
||||||
QString m_toolTipSubText;
|
QString m_toolTipSubText;
|
||||||
int m_toolTipTextFormat;
|
int m_toolTipTextFormat;
|
||||||
|
QPointer<QQuickItem> m_toolTipItem;
|
||||||
QVariantList m_args;
|
QVariantList m_args;
|
||||||
Plasma::Types::BackgroundHints m_backgroundHints;
|
Plasma::Types::BackgroundHints m_backgroundHints;
|
||||||
bool m_busy : 1;
|
bool m_busy : 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user