mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-09-13 20:23:04 +02:00
Improve code style, Wrap code for better readability
This commit is contained in:
parent
4ed33109f4
commit
e9fcd385d5
@ -57,14 +57,20 @@ void QetGraphicsHandlerItem::setColor(QColor color)
|
||||
@param option
|
||||
@param widget
|
||||
*/
|
||||
void QetGraphicsHandlerItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||
void QetGraphicsHandlerItem::paint(QPainter *painter,
|
||||
const QStyleOptionGraphicsItem *option,
|
||||
QWidget *widget)
|
||||
{
|
||||
Q_UNUSED(option)
|
||||
Q_UNUSED(widget)
|
||||
|
||||
painter->save();
|
||||
painter->setBrush(QBrush(m_color));
|
||||
QPen pen(QBrush(m_color), 2, Qt::SolidLine, Qt::SquareCap, Qt::MiterJoin);
|
||||
QPen pen(QBrush(m_color),
|
||||
2,
|
||||
Qt::SolidLine,
|
||||
Qt::SquareCap,
|
||||
Qt::MiterJoin);
|
||||
pen.setCosmetic(true);
|
||||
painter->setPen(pen);
|
||||
painter->setRenderHint(QPainter::Antialiasing, true);
|
||||
@ -77,7 +83,9 @@ void QetGraphicsHandlerItem::paint(QPainter *painter, const QStyleOptionGraphics
|
||||
@param points
|
||||
@return A list of handler with pos at point
|
||||
*/
|
||||
QVector<QetGraphicsHandlerItem *> QetGraphicsHandlerItem::handlerForPoint(const QVector<QPointF> &points, int size)
|
||||
QVector<QetGraphicsHandlerItem *> QetGraphicsHandlerItem::handlerForPoint(
|
||||
const QVector<QPointF> &points,
|
||||
int size)
|
||||
{
|
||||
QVector <QetGraphicsHandlerItem *> list_;
|
||||
for (QPointF point : points)
|
||||
|
@ -23,10 +23,15 @@
|
||||
|
||||
/**
|
||||
@brief The QetGraphicsHandlerItem class
|
||||
This graphics item represents a point, destined to be used as an handler,
|
||||
This graphics item represents a point,
|
||||
destined to be used as an handler,
|
||||
for modifie the geometrie of a another graphics item (like shapes).
|
||||
The graphics item to be modified, must call "installSceneEventFilter" of this item with itself for argument,.
|
||||
The ghraphics item to be modified, need to reimplement "sceneEventFilter" for create the modification behavior.
|
||||
The graphics item to be modified,
|
||||
must call "installSceneEventFilter"
|
||||
of this item with itself for argument,.
|
||||
The ghraphics item to be modified,
|
||||
need to reimplement "sceneEventFilter"
|
||||
for create the modification behavior.
|
||||
*/
|
||||
class QetGraphicsHandlerItem : public QGraphicsItem
|
||||
{
|
||||
@ -40,7 +45,9 @@ class QetGraphicsHandlerItem : public QGraphicsItem
|
||||
void setColor(QColor color);
|
||||
|
||||
protected:
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
||||
void paint(QPainter *painter,
|
||||
const QStyleOptionGraphicsItem *option,
|
||||
QWidget *widget) override;
|
||||
|
||||
private:
|
||||
QRectF m_handler_rect,
|
||||
@ -50,7 +57,8 @@ class QetGraphicsHandlerItem : public QGraphicsItem
|
||||
QPen m_pen;
|
||||
|
||||
public:
|
||||
static QVector<QetGraphicsHandlerItem *> handlerForPoint(const QVector<QPointF> &points, int size = 10);
|
||||
static QVector<QetGraphicsHandlerItem *> handlerForPoint(
|
||||
const QVector<QPointF> &points, int size = 10);
|
||||
};
|
||||
|
||||
#endif // QETGRAPHICSHANDLERITEM_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user