44 #include "../qmlinspectorconstants.h" 47 #include <QtGui/QGraphicsRectItem> 48 #include <QtGui/QGraphicsObject> 49 #include <QtGui/QGraphicsScene> 51 #include <QtCore/QtDebug> 70 m_layerItem(layerItem)
104 double firstX = std::floor(firstPoint.
x()) + 0.5;
105 double firstY = std::floor(firstPoint.
y()) + 0.5;
106 double secondX = std::floor(secondPoint.
x()) + 0.5;
107 double secondY = std::floor(secondPoint.
y()) + 0.5;
108 QPointF topLeftPoint(firstX < secondX ? firstX : secondX,
109 firstY < secondY ? firstY : secondY);
110 QPointF bottomRightPoint(firstX > secondX ? firstX : secondX,
111 firstY > secondY ? firstY : secondY);
The QColor class provides colors based on RGB, HSV or CMYK values.
The QGraphicsRectItem class provides a rectangle item that you can add to a QGraphicsScene.
void setRect(const QPointF &firstPoint, const QPointF &secondPoint)
int type() const
Reimplemented Function
The QPointF class defines a point in the plane using floating point precision.
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
QRectF rect() const
Returns the item's rectangle.
The QPen class defines how a QPainter should draw lines and outlines of shapes.
QWeakPointer< QGraphicsObject > m_layerItem
qreal x() const
Returns the x-coordinate of this point.
SelectionRectShape(QGraphicsItem *parent=0)
static const QRectF boundingRect(const QPointF *points, int pointCount)
The QRectF class defines a rectangle in the plane using floating point precision. ...
void removeItem(QGraphicsItem *item)
Removes the item item and all its children from the scene.
~LiveSelectionRectangle()
void setPen(const QPen &pen)
Sets the pen for this item to pen.
LiveSelectionRectangle(QGraphicsObject *layerItem)
QPointF mapFromScene(const QPointF &point) const
Maps the point point, which is in this item's scene's coordinate system, to this item's coordinate sy...
void hide()
Hides the item.
QGraphicsRectItem * m_controlShape
void setRect(const QRectF &rect)
Sets the item's rectangle to be the given rectangle.
qreal y() const
Returns the y-coordinate of this point.
QGraphicsScene * scene() const
Returns the current scene for the item, or 0 if the item is not stored in a scene.
The QGraphicsObject class provides a base class for all graphics items that require signals...
void setBrush(const QBrush &brush)
Sets the item's brush to brush.
void show()
Shows the item.