91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 47.02MB
    文件類型: .zip
    金幣: 1
    下載: 0 次
    發布日期: 2023-07-29
  • 語言: 其他
  • 標簽: QT和C++??QGraphicsVie??

資源簡介

畫圖軟件,基于QGraphicsView實現,可畫直線,矩形,橢圓,圓角矩形,不規則多邊形,曲線等等基本功能,并且可編輯這些圖形,代碼封裝完畢,可簡單移植到項目中使用。

資源截圖

代碼片段和文件信息

#include?“commands.h“
#include?
MoveShapeCommand::MoveShapeCommand(QGraphicsScene?*graphicsScene?const?QPointF?&delta?QUndoCommand?*parent)
????:?QUndoCommand(parent)
{
????myItem?=?0;
????myItems?=?graphicsScene->selectedItems();
????myGraphicsScene?=?graphicsScene;
????myDelta?=?delta;
????bMoved?=?true;
}

MoveShapeCommand::MoveShapeCommand(QGraphicsItem?*?item?const?QPointF?&delta?QUndoCommand?*parent)
????:?QUndoCommand(parent)
{
????myGraphicsScene?=?0;
????myItem?=?item;
????myDelta?=?delta;
????bMoved?=?true;
}

//!?[2]
void?MoveShapeCommand::undo()
{
????if?(?myItem?)
????????myItem->moveBy(-myDelta.x()-myDelta.y());
????else?if(?myItems.count()?>?0?){
????????foreach?(QGraphicsItem?*item?myItems)?{
???????????item->moveBy(-myDelta.x()-myDelta.y());
????????}
????}
????setText(Qobject::tr(“Undo?Move?%1%2“)
????????.arg(-myDelta.x()).arg(-myDelta.y()));
????bMoved?=?false;
}
//!?[2]

//!?[3]
void?MoveShapeCommand::redo()
{
????if?(?!bMoved?){
????????if?(?myItem?){
????????????myItem->moveBy(myDelta.x()myDelta.y());
????????????myItem->scene()->update();
????????}else?if(?myItems.count()?>?0?){
????????????foreach?(QGraphicsItem?*item?myItems)?{
???????????????item->moveBy(myDelta.x()myDelta.y());
????????????}
????????????myGraphicsScene->update();
????????}
????}
????setText(Qobject::tr(“Redo?Move?%1%2“)
????????.arg(myDelta.x()).arg(myDelta.y()));
}
//!?[3]
//!?[4]
RemoveShapeCommand::RemoveShapeCommand(QGraphicsScene?*scene?QUndoCommand?*parent)
????:?QUndoCommand(parent)
{
????myGraphicsScene?=?scene;
????items?=?myGraphicsScene->selectedItems();
}

RemoveShapeCommand::~RemoveShapeCommand()
{

}
//!?[4]

//!?[5]
void?RemoveShapeCommand::undo()
{
????foreach?(QGraphicsItem?*item?items)?{
????????QGraphicsItemGroup?*g?=?dynamic_cast(item->parentItem());
????????if?(?!g?)
????????????myGraphicsScene->addItem(item);
????}
????myGraphicsScene->update();
????setText(Qobject::tr(“Undo?Delete?%1“).arg(items.count()));
}
//!?[5]

//!?[6]
void?RemoveShapeCommand::redo()
{
????foreach?(QGraphicsItem?*item?items)?{
????????QGraphicsItemGroup?*g?=?dynamic_cast(item->parentItem());
????????if?(?!g?)
????????????myGraphicsScene->removeItem(item);
????}
????????setText(Qobject::tr(“Redo?Delete?%1“).arg(items.count()));
}
//!?[6]

//!?[7]
AddShapeCommand::AddShapeCommand(QGraphicsItem?*item
???????????????????????QGraphicsScene?*scene?QUndoCommand?*parent)
????:?QUndoCommand(parent)
{
????static?int?itemCount?=?0;

????myGraphicsScene?=?scene;
????myDiagramItem?=?item;
????initialPosition?=?item->pos();
????++itemCount;
}
//!?[7]

AddShapeCommand::~AddShapeCommand()
{
????if?(!myDiagramItem->scene())
????????delete?myDiagramItem;
}

//!?[8]
void?AddShapeCommand::undo()
{
????myGraphicsScene->removeItem(myDiagramItem);
????myGraphicsScene->update();
????setText(Qobject::tr(“Undo?Add?%1“)
????????.arg(createCommandString(myDiagramItem?initialPosition)));

}
//!?[8]

//!?[9]
void?AddSha

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-09-11?13:27??qdraw-master\
?????文件?????????242??2017-01-28?23:05??qdraw-master\.gitignore
?????目錄???????????0??2018-09-11?13:27??qdraw-master\app\
?????文件?????????813??2017-01-28?23:05??qdraw-master\app\app.pro
?????文件????????1427??2017-01-28?23:05??qdraw-master\app\app.qrc
?????文件???????10349??2017-01-28?23:05??qdraw-master\app\commands.cpp
?????文件????????3645??2017-01-28?23:05??qdraw-master\app\commands.h
?????目錄???????????0??2018-09-11?13:27??qdraw-master\app\debug\
?????文件???????16038??2018-08-30?09:13??qdraw-master\app\debug\moc_drawobj.cpp
?????文件???????10106??2018-08-30?09:13??qdraw-master\app\debug\moc_drawscene.cpp
?????文件????????4330??2018-08-30?09:13??qdraw-master\app\debug\moc_drawview.cpp
?????文件???????12156??2018-08-30?09:13??qdraw-master\app\debug\moc_mainwindow.cpp
?????文件?????????234??2018-09-07?15:43??qdraw-master\app\debug\moc_predefs.h
?????文件????????4645??2018-08-30?09:13??qdraw-master\app\debug\moc_rulebar.cpp
?????文件????13798400??2018-08-30?09:13??qdraw-master\app\debug\qdraw.bsc
?????文件??????548352??2018-08-30?09:13??qdraw-master\app\debug\qdraw.exe
?????文件?????2905548??2018-08-30?09:13??qdraw-master\app\debug\qdraw.ilk
?????文件?????5001216??2018-08-30?09:13??qdraw-master\app\debug\qdraw.pdb
?????文件???????12628??2018-08-29?16:24??qdraw-master\app\debug\qteditorfactory.moc
?????文件????????4408??2018-08-29?16:24??qdraw-master\app\debug\qtpropertymanager.moc
?????文件????????5945??2018-08-29?16:24??qdraw-master\app\debug\qttreepropertybrowser.moc
?????文件??????????50??2017-01-28?23:05??qdraw-master\app\document.cpp
?????文件?????????108??2017-01-28?23:05??qdraw-master\app\document.h
?????文件???????41936??2018-08-29?15:40??qdraw-master\app\drawobj.cpp
?????文件???????12308??2018-08-29?15:10??qdraw-master\app\drawobj.h
?????文件???????11402??2018-08-29?14:58??qdraw-master\app\drawscene.cpp
?????文件????????2315??2018-08-29?14:56??qdraw-master\app\drawscene.h
?????文件???????16877??2018-08-16?14:59??qdraw-master\app\drawtool.cpp
?????文件????????2995??2017-01-28?23:05??qdraw-master\app\drawtool.h
?????文件????????9316??2018-08-29?14:59??qdraw-master\app\drawview.cpp
?????文件????????1342??2018-08-29?14:54??qdraw-master\app\drawview.h
............此處省略104個文件信息

評論

共有 條評論