Merge branch 'master' into sebas/theme
This commit is contained in:
commit
cf049f28cb
@ -445,7 +445,7 @@ void DialogProxy::syncBorders()
|
|||||||
int borders = Plasma::FrameSvg::AllBorders;
|
int borders = Plasma::FrameSvg::AllBorders;
|
||||||
|
|
||||||
//Tooltips always have all the borders
|
//Tooltips always have all the borders
|
||||||
if (flags() & Qt::ToolTip) {
|
if (!(flags() & Qt::ToolTip)) {
|
||||||
if (x() <= avail.x() || m_location == Plasma::Types::LeftEdge) {
|
if (x() <= avail.x() || m_location == Plasma::Types::LeftEdge) {
|
||||||
borders = borders & ~Plasma::FrameSvg::LeftBorder;
|
borders = borders & ~Plasma::FrameSvg::LeftBorder;
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,9 @@
|
|||||||
#include <kwindoweffects.h>
|
#include <kwindoweffects.h>
|
||||||
|
|
||||||
ToolTip::ToolTip(QQuickItem *parent)
|
ToolTip::ToolTip(QQuickItem *parent)
|
||||||
: QQuickItem(parent)
|
: QQuickItem(parent),
|
||||||
|
m_containsMouse(false),
|
||||||
|
m_location(Plasma::Types::Floating)
|
||||||
{
|
{
|
||||||
m_showTimer = new QTimer(this);
|
m_showTimer = new QTimer(this);
|
||||||
m_showTimer->setSingleShot(true);
|
m_showTimer->setSingleShot(true);
|
||||||
@ -78,7 +80,9 @@ void ToolTip::showToolTip()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//heuristics for knowing the diration
|
//heuristics for knowing the diration
|
||||||
Plasma::Types::Direction dir = Plasma::Types::Up;
|
Plasma::Types::Direction dir;
|
||||||
|
if (m_location == Plasma::Types::Floating) {
|
||||||
|
dir = Plasma::Types::Up;
|
||||||
QPoint pos = mapToScene(QPoint(0, 0)).toPoint();
|
QPoint pos = mapToScene(QPoint(0, 0)).toPoint();
|
||||||
|
|
||||||
if (window() && window()->screen()) {
|
if (window() && window()->screen()) {
|
||||||
@ -95,8 +99,12 @@ void ToolTip::showToolTip()
|
|||||||
} else if (pos.x() >= popupPos.x() + dlg->width()) {
|
} else if (pos.x() >= popupPos.x() + dlg->width()) {
|
||||||
dir = Plasma::Types::Left;
|
dir = Plasma::Types::Left;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
dir = Plasma::locationToDirection(m_location);
|
||||||
|
}
|
||||||
|
|
||||||
dlg->setDirection(dir);
|
dlg->setDirection(dir);
|
||||||
|
dlg->setLocation(m_location);
|
||||||
dlg->setMainItem(mainItem());
|
dlg->setMainItem(mainItem());
|
||||||
dlg->setVisualParent(this);
|
dlg->setVisualParent(this);
|
||||||
dlg->setVisible(true);
|
dlg->setVisible(true);
|
||||||
@ -132,6 +140,20 @@ void ToolTip::setSubText(const QString &subText)
|
|||||||
emit subTextChanged();
|
emit subTextChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Plasma::Types::Location ToolTip::location() const
|
||||||
|
{
|
||||||
|
return m_location;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ToolTip::setLocation(Plasma::Types::Location location)
|
||||||
|
{
|
||||||
|
if (m_location == location) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
m_location = location;
|
||||||
|
emit locationChanged();
|
||||||
|
}
|
||||||
|
|
||||||
QVariant ToolTip::icon() const
|
QVariant ToolTip::icon() const
|
||||||
{
|
{
|
||||||
if (m_icon.isValid()) {
|
if (m_icon.isValid()) {
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include <QQuickItem>
|
#include <QQuickItem>
|
||||||
#include <QWeakPointer>
|
#include <QWeakPointer>
|
||||||
#include <QtCore/QVariant>
|
#include <QtCore/QVariant>
|
||||||
|
#include <Plasma/Plasma>
|
||||||
|
|
||||||
class QQuickItem;
|
class QQuickItem;
|
||||||
class QGraphicsWidget;
|
class QGraphicsWidget;
|
||||||
@ -89,6 +90,11 @@ class ToolTip : public QQuickItem
|
|||||||
*/
|
*/
|
||||||
Q_PROPERTY(bool m_containsMouse READ containsMouse NOTIFY containsMouseChanged)
|
Q_PROPERTY(bool m_containsMouse READ containsMouse NOTIFY containsMouseChanged)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Plasma Location of the dialog window. Useful if this dialog is a popup for a panel
|
||||||
|
*/
|
||||||
|
Q_PROPERTY(Plasma::Types::Location location READ location WRITE setLocation NOTIFY locationChanged)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO: single property for images?
|
* TODO: single property for images?
|
||||||
* An image for this tooltip, accepted values are an icon name, a QIcon, QImage or QPixmap
|
* An image for this tooltip, accepted values are an icon name, a QIcon, QImage or QPixmap
|
||||||
@ -116,6 +122,9 @@ public:
|
|||||||
QVariant image() const;
|
QVariant image() const;
|
||||||
void setImage(const QVariant &image);
|
void setImage(const QVariant &image);
|
||||||
|
|
||||||
|
Plasma::Types::Location location() const;
|
||||||
|
void setLocation(Plasma::Types::Location location);
|
||||||
|
|
||||||
bool containsMouse() const;
|
bool containsMouse() const;
|
||||||
void setContainsMouse(bool contains);
|
void setContainsMouse(bool contains);
|
||||||
|
|
||||||
@ -132,9 +141,11 @@ Q_SIGNALS:
|
|||||||
void iconChanged();
|
void iconChanged();
|
||||||
void imageChanged();
|
void imageChanged();
|
||||||
void containsMouseChanged();
|
void containsMouseChanged();
|
||||||
|
void locationChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_containsMouse;
|
bool m_containsMouse;
|
||||||
|
Plasma::Types::Location m_location;
|
||||||
QWeakPointer<QQuickItem> m_mainItem;
|
QWeakPointer<QQuickItem> m_mainItem;
|
||||||
QTimer *m_showTimer;
|
QTimer *m_showTimer;
|
||||||
QString m_mainText;
|
QString m_mainText;
|
||||||
|
@ -94,6 +94,7 @@ void ToolTipDialog::showEvent(QShowEvent *event)
|
|||||||
m_showTimer->start(m_hideTimeout);
|
m_showTimer->start(m_hideTimeout);
|
||||||
m_animation->stop();
|
m_animation->stop();
|
||||||
DialogProxy::showEvent(event);
|
DialogProxy::showEvent(event);
|
||||||
|
setFlags(Qt::ToolTip);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToolTipDialog::hideEvent(QHideEvent *event)
|
void ToolTipDialog::hideEvent(QHideEvent *event)
|
||||||
|
Loading…
Reference in New Issue
Block a user