Don't misuse the boundingRect for positioning the item
svn path=/trunk/KDE/kdebase/workspace/plasma/lib/; revision=638558
This commit is contained in:
parent
7e79ae5347
commit
b321a91d3d
@ -60,8 +60,8 @@ class LineEdit::Private
|
|||||||
QTimer m_cursorTimer;
|
QTimer m_cursorTimer;
|
||||||
};
|
};
|
||||||
|
|
||||||
LineEdit::LineEdit(Plasma::Applet* a, QRectF size)
|
LineEdit::LineEdit(Plasma::Applet* a, QPointF pos, QSizeF size)
|
||||||
: Widget(a, size),
|
: Widget(a, pos, size),
|
||||||
d(new Private)
|
d(new Private)
|
||||||
{
|
{
|
||||||
d->m_bgColor = QColor(200, 200, 200);
|
d->m_bgColor = QColor(200, 200, 200);
|
||||||
@ -133,7 +133,7 @@ void LineEdit::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
|||||||
{
|
{
|
||||||
QTextLine line = d->m_textLayout.lineAt(0);
|
QTextLine line = d->m_textLayout.lineAt(0);
|
||||||
|
|
||||||
QPoint pos = mapFromParent(event->pos()).toPoint() - boundingRect().topLeft().toPoint();
|
QPoint pos = event->pos().toPoint();
|
||||||
d->m_cursorPos = line.xToCursor(pos.x() - 5 + d->m_hscroll);
|
d->m_cursorPos = line.xToCursor(pos.x() - 5 + d->m_hscroll);
|
||||||
d->m_cursorVisible = true;
|
d->m_cursorVisible = true;
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ class KDE_EXPORT LineEdit : public QObject, public Widget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LineEdit(Plasma::Applet *a, QRectF size);
|
LineEdit(Plasma::Applet *a, QPointF pos, QSizeF size);
|
||||||
~LineEdit();
|
~LineEdit();
|
||||||
|
|
||||||
void paint(QPainter *painter,
|
void paint(QPainter *painter,
|
||||||
@ -46,8 +46,6 @@ class KDE_EXPORT LineEdit : public QObject, public Widget
|
|||||||
void setValue(QString text);
|
void setValue(QString text);
|
||||||
QString getStringValue() const;
|
QString getStringValue() const;
|
||||||
|
|
||||||
void setInputFocus();
|
|
||||||
void clearInputFocus();
|
|
||||||
void keyPressEvent(QKeyEvent *event);
|
void keyPressEvent(QKeyEvent *event);
|
||||||
void mousePressEvent(QGraphicsSceneMouseEvent *event);
|
void mousePressEvent(QGraphicsSceneMouseEvent *event);
|
||||||
|
|
||||||
|
@ -21,10 +21,11 @@
|
|||||||
namespace Plasma
|
namespace Plasma
|
||||||
{
|
{
|
||||||
|
|
||||||
Widget::Widget(QGraphicsItem *parent, QRectF size)
|
Widget::Widget(QGraphicsItem *parent, QPointF pos, QSizeF size)
|
||||||
: QGraphicsItem(parent),
|
: QGraphicsItem(parent)
|
||||||
m_boundingBox(size)
|
|
||||||
{
|
{
|
||||||
|
m_boundingBox = QRectF(0, 0, size.width(), size.height());
|
||||||
|
setPos(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget::~Widget()
|
Widget::~Widget()
|
||||||
|
@ -29,7 +29,7 @@ namespace Plasma
|
|||||||
class KDE_EXPORT Widget : public QGraphicsItem
|
class KDE_EXPORT Widget : public QGraphicsItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Widget(QGraphicsItem *parent, QRectF size);
|
Widget(QGraphicsItem *parent, QPointF pos, QSizeF size);
|
||||||
virtual ~Widget();
|
virtual ~Widget();
|
||||||
|
|
||||||
QRectF boundingRect() const;
|
QRectF boundingRect() const;
|
||||||
|
Loading…
Reference in New Issue
Block a user