Qt 4.8
Public Functions | Properties | List of all members
QmlJSDebugger::LiveSelectionRectangle Class Reference

#include <liveselectionrectangle.h>

Public Functions

void clear ()
 
void hide ()
 
 LiveSelectionRectangle (QGraphicsObject *layerItem)
 
QRectF rect () const
 
void setRect (const QPointF &firstPoint, const QPointF &secondPoint)
 
void show ()
 
 ~LiveSelectionRectangle ()
 

Properties

QGraphicsRectItemm_controlShape
 
QWeakPointer< QGraphicsObjectm_layerItem
 

Detailed Description

Definition at line 54 of file liveselectionrectangle.h.

Constructors and Destructors

◆ LiveSelectionRectangle()

QmlJSDebugger::LiveSelectionRectangle::LiveSelectionRectangle ( QGraphicsObject layerItem)

Definition at line 68 of file liveselectionrectangle.cpp.

69  : m_controlShape(new SelectionRectShape(layerItem)),
70  m_layerItem(layerItem)
71 {
73  m_controlShape->setBrush(QColor(128, 128, 128, 50));
74 }
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
The QPen class defines how a QPainter should draw lines and outlines of shapes.
Definition: qpen.h:64
QWeakPointer< QGraphicsObject > m_layerItem
void setPen(const QPen &pen)
Sets the pen for this item to pen.
void setBrush(const QBrush &brush)
Sets the item&#39;s brush to brush.

◆ ~LiveSelectionRectangle()

QmlJSDebugger::LiveSelectionRectangle::~LiveSelectionRectangle ( )

Definition at line 76 of file liveselectionrectangle.cpp.

77 {
78  if (m_layerItem)
80 }
T * data() const
QWeakPointer< QGraphicsObject > m_layerItem
void removeItem(QGraphicsItem *item)
Removes the item item and all its children from the scene.
QGraphicsScene * scene() const
Returns the current scene for the item, or 0 if the item is not stored in a scene.

Functions

◆ clear()

void QmlJSDebugger::LiveSelectionRectangle::clear ( void  )

◆ hide()

void QmlJSDebugger::LiveSelectionRectangle::hide ( )

◆ rect()

QRectF QmlJSDebugger::LiveSelectionRectangle::rect ( ) const

Definition at line 96 of file liveselectionrectangle.cpp.

Referenced by QmlJSDebugger::LiveRubberBandSelectionManipulator::select(), and setRect().

97 {
99 }
QRectF rect() const
Returns the item&#39;s rectangle.
static const QRectF boundingRect(const QPointF *points, int pointCount)
QPointF mapFromScene(const QPointF &point) const
Maps the point point, which is in this item&#39;s scene&#39;s coordinate system, to this item&#39;s coordinate sy...

◆ setRect()

void QmlJSDebugger::LiveSelectionRectangle::setRect ( const QPointF firstPoint,
const QPointF secondPoint 
)

Definition at line 101 of file liveselectionrectangle.cpp.

Referenced by QmlJSDebugger::LiveRubberBandSelectionManipulator::begin(), and QmlJSDebugger::LiveRubberBandSelectionManipulator::update().

103 {
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);
112 
113  QRectF rect(topLeftPoint, bottomRightPoint);
115 }
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:214
qreal x() const
Returns the x-coordinate of this point.
Definition: qpoint.h:282
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
T floor(const T &a)
void setRect(const QRectF &rect)
Sets the item&#39;s rectangle to be the given rectangle.
qreal y() const
Returns the y-coordinate of this point.
Definition: qpoint.h:287

◆ show()

void QmlJSDebugger::LiveSelectionRectangle::show ( )

Definition at line 86 of file liveselectionrectangle.cpp.

Referenced by QmlJSDebugger::LiveRubberBandSelectionManipulator::begin().

87 {
89 }
void show()
Shows the item.

Properties

◆ m_controlShape

QGraphicsRectItem* QmlJSDebugger::LiveSelectionRectangle::m_controlShape
private

◆ m_layerItem

QWeakPointer<QGraphicsObject> QmlJSDebugger::LiveSelectionRectangle::m_layerItem
private

Definition at line 72 of file liveselectionrectangle.h.

Referenced by ~LiveSelectionRectangle().


The documentation for this class was generated from the following files: