• 大小: 1.67MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-10-14
  • 语言: 其他
  • 标签: ROI  

资源简介

QT实现的ROI,相信你看了很多图像库ROI的界面的功能,但总要用它的控件或类等,本程序完全脱离其他函数库。

资源截图

代码片段和文件信息

#include “Graphics.h“
#include “ui_Graphics.h“

#include “GraphicsItem.h“
#include “History.h“

#include 
#include 
#include 
#include 
Graphics::Graphics(QWidget *parent Qt::WFlags flags)
: QMainWindow(parent flags) ui(new Ui::GraphicsClass)
{
ui->setupUi(this);
ui->actionselectable->setChecked(true);

scene = new QGraphicsScene();
scene->setSceneRect(QRect(0 0 500 500));
scene->setItemIndexMethod(QGraphicsScene::NoIndex);

history = History::GetInstance();
GraphicsItem* graphicsItem = new GraphicsItem();
graphicsItem->resize(150 150);
graphicsItem->setPos(100 100);
graphicsItem->setActive(true);
graphicsItem->setFlags(QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemIsFocusable);
graphicsItem->setSelected(true);
scene->addItem(graphicsItem);

history->PushState(graphicsItem History::COMMAND_NEW);
QGraphicsView *view = new QGraphicsView(scene);
view->setCacheMode(0);
setCentralWidget(view);

QTimer* timerUpdateUi = new QTimer(this);
connect(timerUpdateUi SIGNAL(timeout()) SLOT(slotTimeOut()));
timerUpdateUi->start(300);
}

Graphics::~Graphics()
{
delete ui;
}
void Graphics::setOrientation(ScreenOrientation orientation)
{
#if defined(Q_OS_SYMBIAN)
// If the version of Qt on the device is < 4.7.2 that attribute won‘t work
if(orientation != ScreenOrientationAuto) {
const QStringList v = QString::fromAscii(qVersion()).split(QLatin1Char(‘.‘));
if(v.count() == 3 && (v.at(0).toInt() << 16 | v.at(1).toInt() << 8 | v.at(2).toInt()) < 0x040702) {
qWarning(“Screen orientation locking only supported with Qt 4.7.2 and above“);
return;
}
}
#endif // Q_OS_SYMBIAN

Qt::WidgetAttribute attribute;
switch (orientation) {
#if QT_VERSION < 0x040702
// Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes
case ScreenOrientationLockPortrait:
attribute = static_cast(128);
break;
case ScreenOrientationLockLandscape:
attribute = static_cast(129);
break;
default:
case ScreenOrientationAuto:
attribute = static_cast(130);
break;
#else // QT_VERSION < 0x040702
case ScreenOrientationLockPortrait:
attribute = Qt::WA_LockPortraitOrientation;
break;
case ScreenOrientationLockLandscape:
attribute = Qt::WA_LockLandscapeOrientation;
break;
default:
case ScreenOrientationAuto:
attribute = Qt::WA_AutoOrientation;
break;
#endif // QT_VERSION < 0x040702
};
setAttribute(attribute true);
}

void Graphics::showExpanded()
{
#ifdef Q_OS_SYMBIAN
showFullScreen();
#elif defined(Q_WS_MAEMO_5)
showMaximized();
#else
show();
#endif
}

void Graphics::on_actionRectangle_triggered(bool)
{
GraphicsItem* graphicsItem = new GraphicsItem();
graphicsItem->resize(150 150);
graphicsItem->setPos(100 100);
graphicsItem->setActive(true);
graphicsItem->setFlags(QGraphicsItem::ItemIsSelect

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      12198  2011-09-22 17:43  QT實現ROI\Graphics\Graphics\debug\BuildLog.htm

     文件     287232  2011-09-22 17:43  QT實現ROI\Graphics\Graphics\debug\graphics.exe

     文件        878  2011-09-22 17:43  QT實現ROI\Graphics\Graphics\debug\graphics.exe.intermediate.manifest

     文件    1444832  2011-09-22 17:43  QT實現ROI\Graphics\Graphics\debug\graphics.ilk

     文件     232098  2011-09-22 17:43  QT實現ROI\Graphics\Graphics\debug\Graphics.obj

     文件    1887232  2011-09-22 17:43  QT實現ROI\Graphics\Graphics\debug\graphics.pdb

     文件     204039  2011-09-22 17:43  QT實現ROI\Graphics\Graphics\debug\GraphicsItem.obj

     文件     110556  2011-09-22 17:43  QT實現ROI\Graphics\Graphics\debug\History.obj

     文件      42768  2011-09-22 17:43  QT實現ROI\Graphics\Graphics\debug\main.obj

     文件      48972  2011-09-22 17:43  QT實現ROI\Graphics\Graphics\debug\moc_Graphics.obj

     文件         69  2011-09-22 17:43  QT實現ROI\Graphics\Graphics\debug\mt.dep

     文件     115567  2011-09-22 17:43  QT實現ROI\Graphics\Graphics\debug\qrc_Graphics.obj

     文件        600  2011-09-19 15:27  QT實現ROI\Graphics\Graphics\define.h

     文件       4438  2011-09-21 00:01  QT實現ROI\Graphics\Graphics\deployment.pri

     文件       6059  2011-09-22 17:43  QT實現ROI\Graphics\Graphics\GeneratedFiles\Debug\moc_Graphics.cpp

     文件     551975  2011-09-22 17:43  QT實現ROI\Graphics\Graphics\GeneratedFiles\qrc_Graphics.cpp

     文件       7213  2011-09-21 19:54  QT實現ROI\Graphics\Graphics\Graphics.cpp

     文件        219  2011-09-21 00:01  QT實現ROI\Graphics\Graphics\graphics.desktop

     文件       1382  2011-09-21 19:43  QT實現ROI\Graphics\Graphics\Graphics.h

     文件      93184  2011-09-22 18:02  QT實現ROI\Graphics\Graphics\graphics.ncb

     文件       7414  2011-09-21 00:01  QT實現ROI\Graphics\Graphics\graphics.png

     文件       1403  2011-08-25 20:22  QT實現ROI\Graphics\Graphics\graphics.pro

     文件      30431  2011-09-06 19:19  QT實現ROI\Graphics\Graphics\graphics.pro.user

     文件        259  2011-09-20 21:48  QT實現ROI\Graphics\Graphics\graphics.qrc

     文件        881  2011-09-06 19:24  QT實現ROI\Graphics\Graphics\graphics.sln

    ..A..H.      9728  2011-09-22 18:02  QT實現ROI\Graphics\Graphics\graphics.suo

     文件       5446  2011-09-21 19:42  QT實現ROI\Graphics\Graphics\Graphics.ui

     文件      16119  2011-09-21 22:42  QT實現ROI\Graphics\Graphics\graphics.vcproj

     文件       1479  2011-09-22 18:02  QT實現ROI\Graphics\Graphics\graphics.vcproj.PCN.Shuyi.xiao.user

     文件      24950  2011-09-21 19:38  QT實現ROI\Graphics\Graphics\GraphicsItem.cpp

............此处省略26个文件信息

评论

共有 条评论