Commit 036ab272 authored by Marco Bubke's avatar Marco Bubke

QmlDesigner: Change resize handle to rectangle

Change-Id: Iffc08dda9dcb9260f72b07a492e93c40dfe59586
Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@digia.com>
parent 27ffd0a3
......@@ -29,14 +29,14 @@
#include "resizehandleitem.h"
#include <QPainter>
namespace QmlDesigner {
ResizeHandleItem::ResizeHandleItem(QGraphicsItem *parent, const ResizeController &resizeController)
: QGraphicsPixmapItem(QPixmap(":/icon/handle/resize_handle.png"), parent),
: QGraphicsItem(parent),
m_weakResizeController(resizeController.toWeakResizeController())
{
setShapeMode(QGraphicsPixmapItem::BoundingRectShape);
setOffset(-pixmap().rect().center());
setFlag(QGraphicsItem::ItemIsMovable, true);
setFlag(QGraphicsItem::ItemIgnoresTransformations, true);
}
......@@ -53,14 +53,20 @@ void ResizeHandleItem::setHandlePosition(const QPointF & globalPosition, const Q
QRectF ResizeHandleItem::boundingRect() const
{
return QGraphicsPixmapItem::boundingRect().adjusted(-1, -1, 1, 1);
return QRectF(- 3., - 3., 7., 7.);
}
QPainterPath ResizeHandleItem::shape() const
void ResizeHandleItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
return QGraphicsItem::shape();
painter->save();
painter->setRenderHint(QPainter::Antialiasing, false);
painter->setBrush(QColor(255, 255, 255));
painter->drawRect(QRectF(-2., -2., 4., 4.));
painter->restore();
}
ResizeController ResizeHandleItem::resizeController() const
{
return ResizeController(m_weakResizeController.toResizeController());
......
......@@ -30,7 +30,7 @@
#ifndef RESIZEHANDLEITEM_H
#define RESIZEHANDLEITEM_H
#include <QGraphicsPixmapItem>
#include <QGraphicsItem>
#include <qmldesignercorelib_global.h>
......@@ -38,7 +38,7 @@
namespace QmlDesigner {
class QMLDESIGNERCORE_EXPORT ResizeHandleItem : public QGraphicsPixmapItem
class QMLDESIGNERCORE_EXPORT ResizeHandleItem : public QGraphicsItem
{
public:
enum
......@@ -53,7 +53,7 @@ public:
int type() const;
QRectF boundingRect() const;
QPainterPath shape() const;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
ResizeController resizeController() const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment