Don't misuse the boundingRect for positioning the item

svn path=/trunk/KDE/kdebase/workspace/plasma/lib/; revision=638558
This commit is contained in:
Alexander Wiedenbruch 2007-03-02 13:33:12 +00:00
parent 7e79ae5347
commit b321a91d3d
4 changed files with 9 additions and 10 deletions

View File

@ -60,8 +60,8 @@ class LineEdit::Private
QTimer m_cursorTimer;
};
LineEdit::LineEdit(Plasma::Applet* a, QRectF size)
: Widget(a, size),
LineEdit::LineEdit(Plasma::Applet* a, QPointF pos, QSizeF size)
: Widget(a, pos, size),
d(new Private)
{
d->m_bgColor = QColor(200, 200, 200);
@ -133,7 +133,7 @@ void LineEdit::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
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_cursorVisible = true;

View File

@ -37,7 +37,7 @@ class KDE_EXPORT LineEdit : public QObject, public Widget
Q_OBJECT
public:
LineEdit(Plasma::Applet *a, QRectF size);
LineEdit(Plasma::Applet *a, QPointF pos, QSizeF size);
~LineEdit();
void paint(QPainter *painter,
@ -46,8 +46,6 @@ class KDE_EXPORT LineEdit : public QObject, public Widget
void setValue(QString text);
QString getStringValue() const;
void setInputFocus();
void clearInputFocus();
void keyPressEvent(QKeyEvent *event);
void mousePressEvent(QGraphicsSceneMouseEvent *event);

View File

@ -21,10 +21,11 @@
namespace Plasma
{
Widget::Widget(QGraphicsItem *parent, QRectF size)
: QGraphicsItem(parent),
m_boundingBox(size)
Widget::Widget(QGraphicsItem *parent, QPointF pos, QSizeF size)
: QGraphicsItem(parent)
{
m_boundingBox = QRectF(0, 0, size.width(), size.height());
setPos(pos);
}
Widget::~Widget()

View File

@ -29,7 +29,7 @@ namespace Plasma
class KDE_EXPORT Widget : public QGraphicsItem
{
public:
Widget(QGraphicsItem *parent, QRectF size);
Widget(QGraphicsItem *parent, QPointF pos, QSizeF size);
virtual ~Widget();
QRectF boundingRect() const;