資源簡介
drawcli.zip

代碼片段和文件信息
#include?“drawobj.h“
#include?
#include?
#include?
#include?
#include?
#include?
static?QPainterPath?qt_graphicsItem_shapeFromPath(const?QPainterPath?&path?const?QPen?&pen)
{
????//?We?unfortunately?need?this?hack?as?QPainterPathStroker?will?set?a?width?of?1.0
????//?if?we?pass?a?value?of?0.0?to?QPainterPathStroker::setWidth()
????const?qreal?penWidthZero?=?qreal(0.00000001);
????if?(path?==?QPainterPath()?||?pen?==?Qt::NoPen)
????????return?path;
????QPainterPathStroker?ps;
????ps.setCapstyle(pen.capstyle());
????if?(pen.widthF()?<=?0.0)
????????ps.setWidth(penWidthZero);
????else
????????ps.setWidth(pen.widthF());
????ps.setJoinstyle(pen.joinstyle());
????ps.setMiterLimit(pen.miterLimit());
????QPainterPath?p?=?ps.createStroke(path);
????p.addPath(path);
????return?p;
}
GraphicsItem::GraphicsItem(QGraphicsItem?*parent)
????:QAbstractGraphicsShapeItem(parent)
{
???//?QGraphicsDropShadowEffect?*effect?=?new?QGraphicsDropShadowEffect;
???//?effect->setBlurRadius(8);
???//?setGraphicsEffect(effect);
}
void?GraphicsItem::updateGeometry()
{
????const?QRectF?&geom?=?this->boundingRect();
????const?int?w?=?SELECTION_HANDLE_SIZE;
????const?int?h?=?SELECTION_HANDLE_SIZE;
????const?Handles::iterator?hend?=??m_handles.end();
????for?(Handles::iterator?it?=?m_handles.begin();?it?!=?hend;?++it)?{
????????SizeHandleRect?*hndl?=?*it;;
????????switch?(hndl->dir())?{
????????case?SizeHandleRect::LeftTop:
????????????hndl->move(geom.x()?-?w?/?2?geom.y()?-?h?/?2);
????????????break;
????????case?SizeHandleRect::Top:
????????????hndl->move(geom.x()?+?geom.width()?/?2?-?w?/?2?geom.y()?-?h?/?2);
????????????break;
????????case?SizeHandleRect::RightTop:
????????????hndl->move(geom.x()?+?geom.width()?-?w?/?2?geom.y()?-?h?/?2);
????????????break;
????????case?SizeHandleRect::Right:
????????????hndl->move(geom.x()?+?geom.width()?-?w?/?2?geom.y()?+?geom.height()?/?2?-?h?/?2);
????????????break;
????????case?SizeHandleRect::RightBottom:
????????????hndl->move(geom.x()?+?geom.width()?-?w?/?2?geom.y()?+?geom.height()?-?h?/?2);
????????????break;
????????case?SizeHandleRect::Bottom:
????????????hndl->move(geom.x()?+?geom.width()?/?2?-?w?/?2?geom.y()?+?geom.height()?-?h?/?2);
????????????break;
????????case?SizeHandleRect::LeftBottom:
????????????hndl->move(geom.x()?-?w?/?2?geom.y()?+?geom.height()?-?h?/?2);
????????????break;
????????case?SizeHandleRect::Left:
????????????hndl->move(geom.x()?-?w?/?2?geom.y()?+?geom.height()?/?2?-?h?/?2);
????????????break;
????????case?SizeHandleRect::Center:
????????????hndl->move(geom.center().x()??-?w?/?2??geom.center().y()?-?h?/?2);
????????????break;
????????default:
????????????break;
????????}
????}
}
void?GraphicsItem::setState(SelectionHandleState?st)
{
????const?Handles::iterator?hend?=??m_handles.end();
????for?(Handles::iterator?it?=?m_handles.begin();?it?!=?hend;?++it)
????????(*it)->setState(st);
}
SizeHandleRect::Direction?Graphic
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2015-06-07?19:45??drawcli\
?????文件????????8196??2015-06-07?09:20??drawcli\.DS_Store
?????目錄???????????0??2015-06-07?20:19??__MACOSX\
?????目錄???????????0??2015-06-07?20:19??__MACOSX\drawcli\
?????文件?????????212??2015-06-07?09:20??__MACOSX\drawcli\._.DS_Store
?????文件?????????539??2015-06-07?09:10??drawcli\drawcli.pro
?????文件???????18746??2015-06-07?19:45??drawcli\drawcli.pro.user
?????文件???????18794??2015-06-04?18:00??drawcli\drawcli.pro.user.466b8dd
?????文件?????????212??2015-06-04?18:00??__MACOSX\drawcli\._drawcli.pro.user.466b8dd
?????文件???????18556??2015-06-01?08:56??drawcli\drawcli.pro.user.d90e171
?????文件?????????212??2015-06-01?08:56??__MACOSX\drawcli\._drawcli.pro.user.d90e171
?????文件???????12084??2015-06-07?19:43??drawcli\drawobj.cpp
?????文件????????2541??2015-06-07?16:17??drawcli\drawobj.h
?????文件????????1260??2015-06-02?13:45??drawcli\drawscene.cpp
?????文件?????????212??2015-06-02?13:45??__MACOSX\drawcli\._drawscene.cpp
?????文件?????????714??2015-06-02?09:41??drawcli\drawscene.h
?????文件?????????212??2015-06-02?09:41??__MACOSX\drawcli\._drawscene.h
?????文件???????12250??2015-06-07?19:36??drawcli\drawtool.cpp
?????文件????????2342??2015-06-06?23:06??drawcli\drawtool.h
?????目錄???????????0??2015-06-07?09:14??drawcli\image\
?????文件????????8196??2015-06-07?09:20??drawcli\image\.DS_Store
?????目錄???????????0??2015-06-07?20:19??__MACOSX\drawcli\image\
?????文件?????????212??2015-06-07?09:20??__MACOSX\drawcli\image\._.DS_Store
?????文件????????2774??2015-06-03?10:10??drawcli\image\background1.png
?????文件?????????212??2015-06-03?10:10??__MACOSX\drawcli\image\._background1.png
?????文件?????????114??2013-08-26?04:04??drawcli\image\background2.png
?????文件?????????212??2013-08-26?04:04??__MACOSX\drawcli\image\._background2.png
?????文件????????2064??2015-06-06?14:21??drawcli\image\background3.png
?????文件?????????177??2015-06-06?14:21??__MACOSX\drawcli\image\._background3.png
?????文件??????????96??2013-08-26?04:04??drawcli\image\background4.png
?????文件?????????212??2013-08-26?04:04??__MACOSX\drawcli\image\._background4.png
............此處省略42個文件信息
評論
共有 條評論