0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-29 19:08:10 +03:00
LimeReport/limereport/items/lrshapeitem.h

85 lines
4.2 KiB
C
Raw Normal View History

2016-02-17 10:11:00 +03:00
/***************************************************************************
* This file is part of the Lime Report project *
* Copyright (C) 2015 by Alexander Arin *
* arin_a@bk.ru *
* *
** GNU General Public License Usage **
* *
* This library is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
** GNU Lesser General Public License **
* *
* This library is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library. *
* If not, see <http://www.gnu.org/licenses/>. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
****************************************************************************/
#ifndef LRSHAPEITEM_H
#define LRSHAPEITEM_H
#include "lritemdesignintf.h"
namespace LimeReport{
class ShapeItem: public LimeReport::ItemDesignIntf
{
Q_OBJECT
Q_ENUMS(ShapeType)
Q_PROPERTY(ShapeType shape READ shapeType WRITE setShapeType)
Q_PROPERTY(QColor shapeColor READ shapeColor WRITE setShapeColor)
Q_PROPERTY(QColor shapeBrushColor READ shapeBrushColor WRITE setShapeBrushColor)
Q_PROPERTY(Qt::BrushStyle shapeBrush READ shapeBrushType WRITE setShapeBrushType)
Q_PROPERTY(qreal lineWidth READ lineWidth WRITE setLineWidth)
Q_PROPERTY(Qt::PenStyle penStyle READ penStyle WRITE setPenStyle)
Q_PROPERTY(int opacity READ opacity WRITE setOpacity)
2016-02-17 10:39:17 +03:00
Q_PROPERTY(int cornerRadius READ cornerRadius WRITE setCornerRadius)
2016-02-17 10:11:00 +03:00
public:
enum ShapeType{HorizontalLine,VerticalLine,Ellipse,Rectangle};
ShapeItem(QObject *owner, QGraphicsItem *parent);
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
void setShapeColor(QColor value);
QColor shapeColor() const {return m_shapeColor;}
void setShapeBrushColor(QColor value);
QColor shapeBrushColor() const {return m_shapeBrushColor;}
void setShapeBrushType(Qt::BrushStyle value);
Qt::BrushStyle shapeBrushType() const {return m_shapeBrushType;}
void setShapeType(ShapeType value);
ShapeType shapeType() const {return m_shape;}
void setLineWidth(qreal value);
qreal lineWidth() const {return m_lineWidth;}
Qt::PenStyle penStyle() const;
void setPenStyle(const Qt::PenStyle &value);
int opacity() const;
void setOpacity(int opacity);
2016-02-17 10:39:17 +03:00
int cornerRadius() const;
void setCornerRadius(int cornerRadius);
2016-02-17 10:11:00 +03:00
protected:
2016-02-17 10:19:50 +03:00
BaseDesignIntf* createSameTypeItem(QObject *owner, QGraphicsItem *parent);
bool drawDesignBorders() const {return false;}
2016-02-17 10:11:00 +03:00
private:
ShapeType m_shape;
QColor m_shapeColor;
QColor m_shapeBrushColor;
Qt::BrushStyle m_shapeBrushType;
qreal m_lineWidth;
Qt::PenStyle m_penStyle;
int m_opacity;
2016-02-17 10:39:17 +03:00
int m_cornerRadius;
2016-02-17 10:11:00 +03:00
};
}
#endif // LRSHAPEITEM_H