本文整理汇总了C++中setScene函数的典型用法代码示例。如果您正苦于以下问题:C++ setScene函数的具体用法?C++ setScene怎么用?C++ setScene使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setScene函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QGraphicsView
SinglePhotoView::SinglePhotoView(QWidget *parent) :
QGraphicsView(parent)
{
this->setMouseTracking(true);
setScene(&gScene);
//gScene.addRect(0, 0, 90, 90);
scaleFactor = 1;
pixItem = NULL;
dragging = false;
allowAddPoints = true;
//pointPaint.ql = &selectedPoints;
// this->scale(scaleFactor, scaleFactor);
this->setRenderHint(QPainter::Antialiasing);
this->setRenderHint(QPainter::SmoothPixmapTransform);
srcPointPaint.setColorScheme(0);
dstPointPaint.setColorScheme(1);
gScene.addItem(&srcPointPaint);
gScene.addItem(&dstPointPaint);
srcPointPaint.setRatio(this->mapToScene(1, 0).x()-this->mapToScene(0, 0).x());
dstPointPaint.setRatio(this->mapToScene(1, 0).x()-this->mapToScene(0, 0).x());
}
示例2: QGraphicsView
GraphView::GraphView(QWidget *parent)
:
QGraphicsView(parent),
selectedItem(NULL),
edgeSource(NULL),
currentEdge(NULL),
currentNode(NULL),
currentAction(NONE),
status(NULL),
undoStack(NULL),
nodeRadius(15),
weightedGraph(false),
undirectedGraph(false),
numberOfNodes(0),
numberOfEdges(0),
nextNodeID(1),
filePath("")
{
setScene(new QGraphicsScene());
scene()->setSceneRect(rect());
setMouseTracking(true);
viewport()->installEventFilter(this);
}
示例3: QGraphicsView
GraphicsView::GraphicsView(QWidget *parent) :
QGraphicsView(parent),
dt(1/100.0)
{
// use opengl for rendering
QGLWidget *widget = new QGLWidget(QGLFormat(QGL::SampleBuffers));
widget->makeCurrent();
setViewport(widget);
setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
setCacheMode(QGraphicsView::CacheNone);
// create graphics scene
GraphicsScene *graphicsScene = new GraphicsScene(this);
setScene(graphicsScene);
// create world rendering thing
WorldView* worldView = new WorldView(this, &worldModel);
// make world rendering thing render when grahpics scene needs to draw stuff
connect(graphicsScene, SIGNAL(render()), worldView, SLOT(render()));
tick();
}
示例4: QGraphicsView
SvgView::SvgView(QWidget *parent)
: QGraphicsView(parent)
, m_renderer(Native)
, m_svgItem(0)
, m_backgroundItem(0)
, m_outlineItem(0)
{
setScene(new QGraphicsScene(this));
setTransformationAnchor(AnchorUnderMouse);
setDragMode(ScrollHandDrag);
setViewportUpdateMode(FullViewportUpdate);
// Prepare background check-board pattern
QPixmap tilePixmap(64, 64);
tilePixmap.fill(Qt::white);
QPainter tilePainter(&tilePixmap);
QColor color(255, 255, 255);
tilePainter.fillRect(0, 0, 32, 32, color);
tilePainter.fillRect(32, 32, 32, 32, color);
tilePainter.end();
setBackgroundBrush(tilePixmap);
}
示例5: QGraphicsView
ProfileGraphicsView::ProfileGraphicsView(QWidget* parent) : QGraphicsView(parent), toolTip(0) , dive(0), diveDC(0)
{
gc.printer = false;
fill_profile_color();
setScene(new QGraphicsScene());
setBackgroundBrush(profile_color[BACKGROUND].at(0));
scene()->installEventFilter(this);
setRenderHint(QPainter::Antialiasing);
setRenderHint(QPainter::HighQualityAntialiasing);
setRenderHint(QPainter::SmoothPixmapTransform);
defaultPen.setJoinStyle(Qt::RoundJoin);
defaultPen.setCapStyle(Qt::RoundCap);
defaultPen.setWidth(2);
defaultPen.setCosmetic(true);
setHorizontalScrollBarPolicy (Qt::ScrollBarAlwaysOff);
setVerticalScrollBarPolicy (Qt::ScrollBarAlwaysOff);
}
示例6: QGraphicsView
Viewport::Viewport(QGraphicsScene* scene, QWidget* parent)
: QGraphicsView(parent), scene(scene),
scale(100), pitch(0), yaw(0), angle_locked(false),
view_selector(new ViewSelector(this)),
mouse_info(new QGraphicsTextItem("\n")),
scene_info(new QGraphicsTextItem()), hover(false),
gl_initialized(false), ui_hidden(false)
{
setScene(scene);
setStyleSheet("QGraphicsView { border-style: none; }");
setSceneRect(-width()/2, -height()/2, width(), height());
setRenderHints(QPainter::Antialiasing);
auto gl = new QOpenGLWidget(this);
setViewport(gl);
for (auto i : {mouse_info, scene_info})
{
i->setDefaultTextColor(Colors::base04);
scene->addItem(i);
}
}
示例7: QGraphicsView
ProfileGraphicsView::ProfileGraphicsView(QWidget* parent) : QGraphicsView(parent), toolTip(0) , dive(0), diveDC(0), rulerItem(0), toolBarProxy(0)
{
printMode = false;
isGrayscale = false;
rulerEnabled = false;
gc.printer = false;
fill_profile_color();
setScene(new QGraphicsScene());
scene()->installEventFilter(this);
setRenderHint(QPainter::Antialiasing);
setRenderHint(QPainter::HighQualityAntialiasing);
setRenderHint(QPainter::SmoothPixmapTransform);
defaultPen.setJoinStyle(Qt::RoundJoin);
defaultPen.setCapStyle(Qt::RoundCap);
defaultPen.setWidth(2);
defaultPen.setCosmetic(true);
setHorizontalScrollBarPolicy (Qt::ScrollBarAlwaysOff);
setVerticalScrollBarPolicy (Qt::ScrollBarAlwaysOff);
}
示例8: QGraphicsView
ShortcutEditorIcon::ShortcutEditorIcon(QWidget * parent) : QGraphicsView(parent),
validItem_ (new DynamicSVGItem(SHORTCUT_EDITOR_ICON_VALID)),
invalidItem_ (new DynamicSVGItem(SHORTCUT_EDITOR_ICON_INVALID)),
inProgressItem_ (new DynamicSVGItem(SHORTCUT_EDITOR_ICON_PROGRESS)),
nonActivableItem_(new DynamicSVGItem(SHORTCUT_EDITOR_ICON_NON_ACTIVABLE)),
valid_(false)
{
setScene(&scene_);
inProgressItem_->setTransformOriginPoint(
inProgressItem_->boundingRect().center());
QObject::connect(&animateTimer_, &QTimer::timeout, [this]
{
inProgressItem_->setRotation(rotationIndex_ += 3);
});
setStyleSheet("border: 0px"); // removing ugly border
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setFixedSize(32, 32);
}
示例9: QGraphicsView
TsimpleScore::TsimpleScore(int notesNumber, QWidget* parent) :
QGraphicsView(parent),
m_notesNr(notesNumber),
m_bgGlyph(0),
m_prevBGglyph(-1)
{
if (TscoreNote::touchEnabled())
viewport()->setAttribute(Qt::WA_AcceptTouchEvents, true);
else {
viewport()->setAttribute(Qt::WA_AcceptTouchEvents, false);
setMouseTracking(true);
}
m_wheelFree = true;
m_wheelLockTimer = new QTimer(this);
m_wheelLockTimer->setTimerType(Qt::PreciseTimer);
m_wheelLockTimer->setInterval(150);
m_wheelLockTimer->setSingleShot(true);
connect(m_wheelLockTimer, &QTimer::timeout, this, &TsimpleScore::wheelLockSlot);
setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
m_scene = new TscoreScene(this);
connect(m_scene, SIGNAL(statusTip(QString)), this, SLOT(statusTipChanged(QString)));
setScene(m_scene);
m_staff = new TscoreStaff(m_scene, m_notesNr);
m_staff->enableToAddNotes(false);
m_clefType = m_staff->scoreClef()->clef().type();
connect(m_staff, SIGNAL(noteChanged(int)), this, SLOT(noteWasClicked(int)));
connect(m_staff, SIGNAL(clefChanged(Tclef)), this, SLOT(onClefChanged(Tclef)));
setBGcolor(palette().base().color());
setEnabledDblAccid(false);
setAlignment(Qt::AlignLeft);
resizeEvent(0);
}
示例10: QGraphicsView
MapperGLCanvas::MapperGLCanvas(MainWindow* mainWindow, QWidget* parent, const QGLWidget * shareWidget, QGraphicsScene* scene)
: QGraphicsView(parent),
_mainWindow(mainWindow),
_mousePressedOnVertex(false),
_activeVertex(NO_VERTEX),
_shapeGrabbed(false), // comment out?
_shapeFirstGrab(false), // comment out?
_zoomLevel(0)
{
// For now clicking on the window doesn't do anything.
setDragMode(QGraphicsView::NoDrag);
setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing |
QPainter::HighQualityAntialiasing | QPainter::SmoothPixmapTransform);
setResizeAnchor(AnchorViewCenter);
setInteractive(true);
//setFrameStyle(Sunken | StyledPanel);
// TODO: check this
// setOptimizationFlags(QGraphicsView::DontSavePainterState);
//setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
resetTransform();
// setAcceptDrops(true);
// Render with OpenGL.
setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers), this, shareWidget));
setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
// TODO: do we need to delete scene (or call new QGraphicsScene(this)?)
setScene(scene ? scene : new QGraphicsScene);
// Black background.
this->scene()->setBackgroundBrush(Qt::black);
}
示例11: QGLWidget
SoccerView::SoccerView(QMutex* _drawMutex)
{
drawMutex = _drawMutex;
shutdownSoccerView = false;
glWidget = new QGLWidget ( QGLFormat ( QGL::DoubleBuffer ) );
setViewport ( glWidget );
LoadFieldGeometry();
scene = new QGraphicsScene ( this );
setScene ( scene );
this->setViewportUpdateMode ( QGraphicsView::NoViewportUpdate );
scene->setBackgroundBrush ( QBrush ( QColor ( 0,0x91,0x19,255 ),Qt::SolidPattern ) );
scene->setSceneRect ( -3700,-2700,7400,5400 );
ConstructField();
fieldBrush = new QBrush ( Qt::NoBrush );
fieldLinePen = new QPen();
fieldLinePen->setColor ( Qt::white );
fieldLinePen->setWidth ( 10 );
fieldLinePen->setJoinStyle ( Qt::MiterJoin );
fieldItem = scene->addPath ( *field,*fieldLinePen,*fieldBrush );
fieldItem->setZValue(0);
drawScale = 0.15;
//this->setRenderHint ( QPainter::Antialiasing, true );
this->setRenderHint ( QPainter::HighQualityAntialiasing, true );
this->setDragMode ( QGraphicsView::ScrollHandDrag );
this->setGeometry ( 400,100,1336,756 );
scalingRequested = true;
//LogPlayer data
// playLogfile = new QPushButton(this);
// playLogfile->setObjectName(QString::fromUtf8("play_logfile_button"));
// playLogfile->setCheckable(false);
// playLogfile->setText("Play Logfile");
// playLogfile->setGeometry(10, 10, 150, 30);
//Timer for casual redraw
startTimer ( 1000 );
}
示例12: QGraphicsView
PathView::PathView(QWidget *parent)
: QGraphicsView(parent)
{
_scene = new QGraphicsScene(this);
setScene(_scene);
setCacheMode(QGraphicsView::CacheBackground);
setDragMode(QGraphicsView::ScrollHandDrag);
setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setRenderHint(QPainter::Antialiasing, true);
setAcceptDrops(false);
_mapScale = new ScaleItem();
_mapScale->setZValue(2.0);
_zoom = ZOOM_MAX;
_map = 0;
_poi = 0;
_units = Metric;
_showTracks = true;
_showRoutes = true;
_showWaypoints = true;
_showWaypointLabels = true;
_showPOI = true;
_showPOILabels = true;
_overlapPOIs = true;
_showRouteWaypoints = true;
_trackWidth = 3;
_routeWidth = 3;
_trackStyle = Qt::SolidLine;
_routeStyle = Qt::DashLine;
_plot = false;
}
示例13: QGraphicsScene
void SnapshotCanvas::setPixmap(const QPixmap &pixmap)
{
delete m_scene;
m_scene = new QGraphicsScene(this);
m_scene->setBackgroundBrush(QColor(180, 180, 180));
connect(m_scene, SIGNAL(selectionChanged()),
this, SLOT(slotSelectionChanged()));
m_pixmapItem = new QGraphicsPixmapItem(pixmap);
QGraphicsDropShadowEffect *dropShadowFX = new QGraphicsDropShadowEffect();
dropShadowFX->setColor(QColor(63, 63, 63, 220));
dropShadowFX->setOffset(0, 0);
dropShadowFX->setBlurRadius(20);
m_pixmapItem->setGraphicsEffect(dropShadowFX);
m_scene->addItem(m_pixmapItem);
m_scene->setSceneRect(pixmap.rect());
setScene(m_scene);
adjustMaximumSize();
}
示例14: QGraphicsView
/*
* Initialize the widget
*/
MixerCurveWidget::MixerCurveWidget(QWidget *parent) : QGraphicsView(parent)
{
// Create a layout, add a QGraphicsView and put the SVG inside.
// The Mixer Curve widget looks like this:
// |--------------------|
// | |
// | |
// | Graph |
// | |
// | |
// | |
// |--------------------|
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setRenderHint(QPainter::Antialiasing);
curveMin=0.0;
curveMax=1.0;
QGraphicsScene *scene = new QGraphicsScene(this);
QSvgRenderer *renderer = new QSvgRenderer();
plot = new QGraphicsSvgItem();
renderer->load(QString(":/configgadget/images/curve-bg.svg"));
plot->setSharedRenderer(renderer);
//plot->setElementId("map");
scene->addItem(plot);
plot->setZValue(-1);
scene->setSceneRect(plot->boundingRect());
setScene(scene);
}
示例15: QGraphicsView
MainWindow::MainWindow(const QRect &sceneRect) : QGraphicsView()
{
// Check if we have artwork for the sreen size. Otherwise we construct a
// scene of size 1024x768, and scale the view to fit the screen instead:
QString folder = QString::number(sceneRect.width()) + "x" + QString::number(sceneRect.height());
QFile artworkForScreenSize(QStringLiteral(":/") + folder + QDir::separator() + "background");
if (artworkForScreenSize.exists()) {
scene = new GraphicsScene(sceneRect);
} else {
QRect unscaledRect = QRect(0, 0, 1024, 768);
scene = new GraphicsScene(unscaledRect);
scale(qreal(sceneRect.width()) / unscaledRect.width(), qreal(sceneRect.height()) / unscaledRect.height());
}
setScene(scene);
setAlignment(Qt::AlignLeft | Qt::AlignTop);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
scene->setupScene();
#ifndef QT_NO_OPENGL
setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
#endif
}