You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.1 KiB
40 lines
1.1 KiB
12 years ago
|
#ifndef UBSELECTIONFRAME_H
|
||
|
#define UBSELECTIONFRAME_H
|
||
|
|
||
|
#include <QGraphicsRectItem>
|
||
|
#include <QtGui>
|
||
|
|
||
|
class UBGraphicsItemDelegate;
|
||
|
|
||
|
class UBSelectionFrame : public QObject, public QGraphicsRectItem
|
||
|
{
|
||
|
Q_OBJECT
|
||
|
|
||
|
public:
|
||
|
UBSelectionFrame();
|
||
|
|
||
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||
|
QRectF boundingRect() const;
|
||
|
QPainterPath shape() const;
|
||
|
|
||
|
void setLocalBrush(const QBrush &pBrush) {mLocalBrush = pBrush;}
|
||
|
QBrush localBrush() const {return mLocalBrush;}
|
||
|
void setEnclosedItems(const QList<UBGraphicsItemDelegate*> pEncItems) {mEnclosedtems = pEncItems; updateRect();}
|
||
|
void setEnclosedItems(const QList<QGraphicsItem*> pGraphicsItems);
|
||
|
void updateRect();
|
||
|
void updateScale();
|
||
|
bool isEmpty() const {return this->rect().isEmpty();}
|
||
|
|
||
|
private slots:
|
||
|
void setAntiScaleRatio(qreal pAntiscaleRatio) {mAntiscaleRatio = pAntiscaleRatio;}
|
||
|
void onZoomChanged(qreal pZoom);
|
||
|
|
||
|
private:
|
||
|
int mThickness;
|
||
|
qreal mAntiscaleRatio;
|
||
|
QList<UBGraphicsItemDelegate*> mEnclosedtems;
|
||
|
QBrush mLocalBrush;
|
||
|
};
|
||
|
|
||
|
#endif // UBSELECTIONFRAME_H
|