
本文共 6164 字,大约阅读时间需要 20 分钟。
������ ofd������������������������������������������������pdf���������pdf������������������������������������������������������������������pdf������������������������������ofd���������������������������������������������������������������������windows���������������������������������������������QT������������������������������������QT���������������������������MFC���������������������ofd������������������������������������������������������������������������QT���������������������������������������������������������������������������������������������������ofd���������������������������������������������������������������
������������������������������������ ���������: cxpv���
���������������
���������������������������������������������������������������������������������
������������������
ofd���������������������������������������������������������������������������������������������������������������������������������������qt������������������������������������������������������������������������������������������1���������������������2���������������������������������������������������Graphics View Framework ���������������������������������������������������������
ofd���������
������ofd������������������������������zip���������������������������������������������������QuaZip������������������������������������������������������������������������������
OfdFileReader::OfdFileReader(){ _pZipInfo = nullptr; _file = nullptr;}OfdFileReader::~OfdFileReader(){ MemManage::instance()->Delete(_pZipInfo); MemManage::instance()->Delete(_file);}bool OfdFileReader::Open(QString fileName){ MemManage::instance()->Delete( _file); _file =MemManage::instance()->New(fileName); if (!_file->open(QIODevice::ReadOnly)) return false; _ofdFileName = fileName; return Open(_file);}bool OfdFileReader::Open(QIODevice *ioDevice){ MemManage::instance()->Delete(_pZipInfo); _pZipInfo =MemManage::instance()->New (ioDevice); bool isOpen = _pZipInfo->open(QuaZip::mdUnzip); if(!isOpen) return false; _listFilePath.clear(); GetAllZipInfo(); return true;}QString OfdFileReader::GetFileFullName(){ return _ofdFileName;}QString OfdFileReader::GetFileShortName(){ QFileInfo fileInfo(_ofdFileName); return fileInfo.baseName();}void OfdFileReader::GetAllZipInfo(){ for (bool f = _pZipInfo->goToFirstFile(); f;f=_pZipInfo->goToNextFile()) { QString relativePath = _pZipInfo->getCurrentFileName(); _listFilePath.append(relativePath); //qDebug() << relativePath; }}int OfdFileReader::GetFileCount(){ return _listFilePath.count();}QString OfdFileReader::GetFilePath(int index){ return _listFilePath[index];}QStringList OfdFileReader::GetFilePathList(){ return _listFilePath;}QByteArray OfdFileReader::GetFileContent(const QString& relativePath){ if(relativePath.size()==0) { QByteArray empty; return empty; } _pZipInfo->setCurrentFile(relativePath); QuaZipFile zFile(_pZipInfo,0); if(!zFile.open(QIODevice::ReadOnly)) { QByteArray empty; return empty; } QByteArray ba = zFile.readAll(); zFile.close(); return ba;}
xml������
������ofd������������xml������������������������������qt������xml���������������DOM���������QDomDocument���������������������QXmlStreamReader������DOM���������������������������������������������������������������������������������������������������������������������������������
Qt Graphics View Framework ������������������
������������������������������������������������qt������������Graphics View Framework���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������scene������������������view���������scene���������������view������������������������ofd������������������������������������������������������scene��������������������������������������� class OfdVisualItemText : public QGraphicsObject���������������������������������
QRectF boundingRect() const override; void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr) override;
paint������������scene������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
void OfdVisualItemText::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget){ Q_UNUSED(option); Q_UNUSED(widget); painter->setRenderHint(QPainter::TextAntialiasing); painter->setBrush(Qt::black); painter->setPen(Qt::black); SetPen(painter); SetFont(painter); //SetCTMTransfer(painter); if(_isFirstPaint) { SetCTMTransfer(); } if(_isSelect) { QListselectData = _boundingRectManage.GetSelectData(_selectPolygon); foreach(QRectData *item,selectData) { painter->fillRect(item->rect,*OfdViewParam::TextSelectBrush); } } OfdPageItemText *itemText = (OfdPageItemText*)_ofdPageItem; int charCount = itemText->TextCode.GetCharCount(); QChar charItem; float x; float y; QRectF textboundingRect; QRectF textClipRect; float baseline = GetBaseline(); for(int i=0;i TextCode.GetChar(i,charItem,x,y); double xPixel = OfdConvert::OfdMMToPixel(x); double yPixel = OfdConvert::OfdMMToPixel(y); QString textChar(charItem); textClipRect.setRect(xPixel,yPixel-baseline,10000,10000); painter->drawText(textClipRect,0,textChar,&textboundingRect); AdjustTextRect(textboundingRect); } _isFirstPaint = false;}
���������������������
������������������������������������������������������������qt������������������������������������������������������������������������������������������������������ofd���������������������qt������Graphics View Framework������������������ofd���������������������������������������������������������������������������������������������������������������������
发表评论
最新留言
关于作者
