79 lines
2.9 KiB
C
79 lines
2.9 KiB
C
|
#ifndef BASEGRAPHICITEM_H
|
|||
|
#define BASEGRAPHICITEM_H
|
|||
|
|
|||
|
#include <QGraphicsItem>
|
|||
|
#include <QGraphicsLineItem>
|
|||
|
#include <QFont>
|
|||
|
#include <QPen>
|
|||
|
#include <QFontMetricsF>
|
|||
|
|
|||
|
namespace CCS_Report {
|
|||
|
|
|||
|
|
|||
|
struct SCellText
|
|||
|
{
|
|||
|
QString m_strText = "";
|
|||
|
|
|||
|
Qt::AlignmentFlag m_qAlignmentFlag = Qt::AlignCenter; // <20>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뷽ʽ <20><>Qt::AlignTop,Qt::AlignBottom,Qt::AlignVCenter
|
|||
|
|
|||
|
QFont m_qFont = QFont();
|
|||
|
QPen m_qPen = QPen();
|
|||
|
|
|||
|
int m_iAddFirstSpaceFlag = 0; // =0 <20><><EFBFBD>ӿո<D3BF>
|
|||
|
|
|||
|
int m_iFontSize = 10;
|
|||
|
|
|||
|
int m_iWrapFlag = 0; // -1 - <20><>ȡ
|
|||
|
// 0 - <20><><EFBFBD><EFBFBD>ĸ<EFBFBD><C4B8><EFBFBD><EFBFBD>
|
|||
|
// 1 - <20>Ե<EFBFBD><D4B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
int m_iCellType= 0; // =0 <20>ı<EFBFBD> =1 ͼƬ = 2 SVG<56><47>ʽ
|
|||
|
QSize m_ImageSize = QSize();
|
|||
|
QSize m_ImageRealSize = QSize();
|
|||
|
qreal m_qHeight = 0;
|
|||
|
int m_iLineNumber = 0;
|
|||
|
|
|||
|
int m_iDrawingX = 0;
|
|||
|
int m_iDrawingY = 0;
|
|||
|
|
|||
|
public:
|
|||
|
|
|||
|
void CopyBy( SCellText sourceCellText );
|
|||
|
void CopyBy( SCellText *pSourceCellText );
|
|||
|
|
|||
|
bool isTextType();
|
|||
|
// <20>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>η<EFBFBD>Χ
|
|||
|
|
|||
|
static QRectF GetBaseDrawingRect( QFontMetricsF markFontMetricsF, QString strText );
|
|||
|
|
|||
|
// <20>õ<EFBFBD><C3B5><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD>Χ<EFBFBD>ڻ<EFBFBD><DABB><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>ľ<EFBFBD><C4BE>η<EFBFBD>Χ
|
|||
|
|
|||
|
static int GetDrawingCellTextList( int iCellWidth, int &iStartX, int& iEndX, int &iLineNumber,
|
|||
|
SCellText *pCellText, QList < SCellText * > &pResultSCellTextList );
|
|||
|
|
|||
|
// <20>õ<EFBFBD><C3B5><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD>Χ<EFBFBD>ڻ<EFBFBD><DABB><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Ķ<EFBFBD><C4B6><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>
|
|||
|
|
|||
|
static int GetDrawingCellTextList( int iCellWidth, QList < SCellText* > pSourceCellTextList, QList < SCellText* > &pResultCellTextList ,int& iEndX);
|
|||
|
|
|||
|
// <20>õ<EFBFBD><C3B5><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD>Χ<EFBFBD>ڻ<EFBFBD><DABB><EFBFBD>һ<EFBFBD><D2BB>һ<EFBFBD><D2BB><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>ĸ߶<C4B8>
|
|||
|
|
|||
|
static int GetLineCellTextHeight( int &iTotalHeight, QList < int > &iLineHeightList, QList < SCellText* > &pLineCellTextList);
|
|||
|
|
|||
|
// <20>õ<EFBFBD><C3B5><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD>Χ<EFBFBD>ڻ<EFBFBD><DABB><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>ľ<EFBFBD><C4BE>η<EFBFBD>Χ
|
|||
|
|
|||
|
static int GetDrawingRect( int iCellWidth, int &iEndX, QRectF &drawingRect, QList < SCellText* > pSourceCellTextList,
|
|||
|
QList < int > &iLineHeightList, QList < SCellText* > &pResultCellTextList );
|
|||
|
static QMap<int,QList<SCellText*>> TransToMap(QList < SCellText* > &pResultCellTextList );
|
|||
|
static QMap<int,QList<SCellText*>> TransSourceToMap(int width,QList < int >& iLineHeightList,QList < SCellText* > &pSourceCellTextList );
|
|||
|
static SCellText* MakeupStringByWidth(QString strSource,qreal width);
|
|||
|
static Qt::AlignmentFlag TransAlignment(int flag);
|
|||
|
|
|||
|
static SCellText* CreateCellText(QString strText,QFont font,QPen pen,Qt::AlignmentFlag alignflag,
|
|||
|
int spaceflag,int fontsize,int wrapflag,int celltype=0);
|
|||
|
static SCellText* CreateCellImage(QString strText,QSize imagesize,QSize realiamgesize,qreal height);
|
|||
|
|
|||
|
|
|||
|
};
|
|||
|
}
|
|||
|
#endif // BASEGRAPHICITEM_H
|