export textFormat for the tooltip
in some cases richtext in the tooltip is not desired, like in the case of klipper. export a property to set the text format Change-Id: Ib4e8e913e060b868188b4f0b46db2162f33d8bb1
This commit is contained in:
parent
c17ed3a107
commit
8044e15a71
@ -83,6 +83,7 @@ Row {
|
||||
width: Math.min(tooltipSubtext.implicitWidth, preferredTextWidth)
|
||||
wrapMode: Text.WordWrap
|
||||
text: toolTip ? toolTip.subText : ""
|
||||
textFormat: toolTip.textFormat
|
||||
opacity: 0.5
|
||||
}
|
||||
}
|
||||
|
@ -35,9 +35,10 @@ int ToolTip::s_dialogUsers = 0;
|
||||
|
||||
ToolTip::ToolTip(QQuickItem *parent)
|
||||
: QQuickItem(parent),
|
||||
m_textFormat(0),
|
||||
m_tooltipsEnabledGlobally(false),
|
||||
m_containsMouse(false),
|
||||
m_location(Plasma::Types::Floating),
|
||||
m_containsMouse(false),
|
||||
m_active(true),
|
||||
m_interactive(false),
|
||||
m_usingDialog(false)
|
||||
@ -182,6 +183,21 @@ void ToolTip::setSubText(const QString &subText)
|
||||
emit subTextChanged();
|
||||
}
|
||||
|
||||
int ToolTip::textFormat() const
|
||||
{
|
||||
return m_textFormat;
|
||||
}
|
||||
|
||||
void ToolTip::setTextFormat(int format)
|
||||
{
|
||||
if (m_textFormat == format) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_textFormat = format;
|
||||
emit textFormatChanged();
|
||||
}
|
||||
|
||||
Plasma::Types::Location ToolTip::location() const
|
||||
{
|
||||
return m_location;
|
||||
|
@ -82,6 +82,16 @@ class ToolTip : public QQuickItem
|
||||
*/
|
||||
Q_PROPERTY(QString subText READ subText WRITE setSubText NOTIFY subTextChanged)
|
||||
|
||||
/**
|
||||
* how to handle the text format of the tooltip subtext:
|
||||
* * Text.AutoText (default)
|
||||
* * Text.PlainText
|
||||
* * Text.StyledText
|
||||
* * Text.RichText
|
||||
* Note: in the default implementation the main text is always plain text
|
||||
*/
|
||||
Q_PROPERTY(int textFormat READ textFormat WRITE setTextFormat NOTIFY textFormatChanged)
|
||||
|
||||
/**
|
||||
* An icon for this tooltip, accepted values are an icon name, a QIcon, QImage or QPixmap
|
||||
*/
|
||||
@ -131,6 +141,9 @@ public:
|
||||
QString subText() const;
|
||||
void setSubText(const QString &subText);
|
||||
|
||||
int textFormat() const;
|
||||
void setTextFormat(int format);
|
||||
|
||||
QVariant icon() const;
|
||||
void setIcon(const QVariant &icon);
|
||||
|
||||
@ -168,6 +181,7 @@ Q_SIGNALS:
|
||||
void visibleChanged();
|
||||
void mainTextChanged();
|
||||
void subTextChanged();
|
||||
void textFormatChanged();
|
||||
void iconChanged();
|
||||
void imageChanged();
|
||||
void containsMouseChanged();
|
||||
@ -187,6 +201,7 @@ private:
|
||||
QTimer *m_showTimer;
|
||||
QString m_mainText;
|
||||
QString m_subText;
|
||||
int m_textFormat;
|
||||
QVariant m_image;
|
||||
QVariant m_icon;
|
||||
bool m_active;
|
||||
|
@ -55,6 +55,7 @@ Q_DECLARE_METATYPE(AppletInterface *)
|
||||
|
||||
AppletInterface::AppletInterface(DeclarativeAppletScript *script, const QVariantList &args, QQuickItem *parent)
|
||||
: AppletQuickItem(script->applet(), parent),
|
||||
m_toolTipTextFormat(0),
|
||||
m_args(args),
|
||||
m_actionSignals(0),
|
||||
m_appletScriptEngine(script),
|
||||
@ -333,6 +334,21 @@ void AppletInterface::setToolTipSubText(const QString &text)
|
||||
emit toolTipSubTextChanged();
|
||||
}
|
||||
|
||||
int AppletInterface::toolTipTextFormat() const
|
||||
{
|
||||
return m_toolTipTextFormat;
|
||||
}
|
||||
|
||||
void AppletInterface::setToolTipTextFormat(int format)
|
||||
{
|
||||
if (m_toolTipTextFormat == format) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_toolTipTextFormat = format;
|
||||
emit toolTipTextFormatChanged();
|
||||
}
|
||||
|
||||
bool AppletInterface::isBusy() const
|
||||
{
|
||||
return m_busy;
|
||||
|
@ -90,6 +90,16 @@ class AppletInterface : public PlasmaQuick::AppletQuickItem
|
||||
*/
|
||||
Q_PROPERTY(QString toolTipSubText READ toolTipSubText WRITE setToolTipSubText NOTIFY toolTipSubTextChanged)
|
||||
|
||||
/**
|
||||
* how to handle the text format of the tooltip subtext:
|
||||
* * Text.AutoText (default)
|
||||
* * Text.PlainText
|
||||
* * Text.StyledText
|
||||
* * Text.RichText
|
||||
* Note: in the default implementation the main text is always plain text
|
||||
*/
|
||||
Q_PROPERTY(int toolTipTextFormat READ toolTipTextFormat WRITE setToolTipTextFormat NOTIFY toolTipTextFormatChanged)
|
||||
|
||||
/**
|
||||
* Icon to represent the plasmoid
|
||||
*/
|
||||
@ -267,6 +277,9 @@ public:
|
||||
QString toolTipSubText() const;
|
||||
void setToolTipSubText(const QString &text);
|
||||
|
||||
int toolTipTextFormat() const;
|
||||
void setToolTipTextFormat(int format);
|
||||
|
||||
uint id() const;
|
||||
|
||||
Plasma::Types::FormFactor formFactor() const;
|
||||
@ -332,6 +345,7 @@ Q_SIGNALS:
|
||||
void titleChanged();
|
||||
void toolTipMainTextChanged();
|
||||
void toolTipSubTextChanged();
|
||||
void toolTipTextFormatChanged();
|
||||
void formFactorChanged();
|
||||
void locationChanged();
|
||||
void contextChanged();
|
||||
@ -369,6 +383,7 @@ private:
|
||||
|
||||
QString m_toolTipMainText;
|
||||
QString m_toolTipSubText;
|
||||
int m_toolTipTextFormat;
|
||||
QVariantList m_args;
|
||||
Plasma::Types::BackgroundHints m_backgroundHints;
|
||||
bool m_busy : 1;
|
||||
|
Loading…
Reference in New Issue
Block a user