本文整理汇总了C++中setViewportUpdateMode函数的典型用法代码示例。如果您正苦于以下问题:C++ setViewportUpdateMode函数的具体用法?C++ setViewportUpdateMode怎么用?C++ setViewportUpdateMode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setViewportUpdateMode函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setViewportUpdateMode
void PhotoKitView::setRenderingSystem()
{
QWidget *viewport = 0;
#ifndef QT_NO_OPENGL
if (Config::openGlRendering) {
setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
QGLWidget *glw = new QGLWidget(QGLFormat(QGL::SampleBuffers));
if (Config::noScreenSync)
glw->format().setSwapInterval(0);
glw->setAutoFillBackground(false);
viewport = glw;
setCacheMode(QGraphicsView::CacheNone);
if (Config::verbose)
ezlog_debug("- using OpenGL");
} else // software rendering
#endif
{
// software rendering
setViewportUpdateMode(QGraphicsView::MinimalViewportUpdate);
viewport = new QWidget;
setCacheMode(QGraphicsView::CacheBackground);
if (Config::verbose)
ezlog_debug("- using software rendering");
}
setViewport(viewport);
}
示例2: QGraphicsView
EditorGraphicsView::EditorGraphicsView(QWidget * parent)
: QGraphicsView(parent)
, m_canZoom(true)
, m_scaleFactor(1.)
, m_autoResize(false)
{
setInteractive(true);
setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform );
setCacheMode(QGraphicsView::CacheBackground);
setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
setOptimizationFlags(QGraphicsView::DontSavePainterState);
setViewportUpdateMode(QGraphicsView::SmartViewportUpdate);
setTransformationAnchor(AnchorUnderMouse);
setResizeAnchor(AnchorViewCenter);
//setFrameStyle(QFrame::NoFrame);
//setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
//setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setBackgroundBrush(Qt::gray);
setDragMode(QGraphicsView::RubberBandDrag);
// use own style for drawing the RubberBand (opened on the viewport)
viewport()->setStyle(new RubberBandStyle);
}
示例3: setViewportUpdateMode
void CanvasView::debugOverlayEnabled(bool enabled)
{
if (enabled)
{
setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
}
else
{
setViewportUpdateMode(QGraphicsView::MinimalViewportUpdate);
}
}
示例4: setViewportUpdateMode
void DesktopView::enableOpenGL(bool state)
{
if (state) {
setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
setViewport(new QGLWidget(new QGLContext(QGL::StencilBuffer | QGL::AlphaChannel)));
d->openglOn = true;
} else {
setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
setViewport(new QWidget);
d->openglOn = false;
}
}
示例5: ScaledGraphicsView
ScaledGraphicsView(QWidget *parent=0) : QGraphicsView(parent)
{
setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform );
setCacheMode(QGraphicsView::CacheBackground);
setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
setOptimizationFlags(QGraphicsView::DontSavePainterState);
setViewportUpdateMode(QGraphicsView::SmartViewportUpdate);
setTransformationAnchor(AnchorUnderMouse);
setResizeAnchor(AnchorViewCenter);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
}
示例6: QGraphicsView
/*!
*/
BoardView::BoardView(QWidget *parent)
: QGraphicsView(parent)
{
setCacheMode(CacheBackground);
setMouseTracking(true);
setRenderHint(QPainter::Antialiasing);
setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
setBackgroundBrush(QColor(230, 200, 167));
if (isRunningOnDesktop()) {
// run on PC desktop.
m_scene = new QGraphicsScene(-225, -225, 450, 450);
} else {
// run on a phone/mobile device.
m_scene = new QGraphicsScene(-90, -90, 180, 180);
}
setScene(m_scene);
m_grid = new GridItem(9);
m_scene->addItem(m_grid);
//
PathFinder::instance()->init(m_grid->dim());
// initializes the ball items provider
BallItemsProvider::instance()->init(m_grid);
//
BallItemsProvider::instance()->nextBalls(true);
}
示例7: QGraphicsView
Widget::Widget(const QString& name, Scene::Type type, const Widget* shareWidget)
: QGraphicsView(),
m_name(name),
m_state(0),
m_view()
{
QGLWidget* glShared = 0;
if (shareWidget)
glShared = (QGLWidget*) shareWidget->viewport();
m_glWidget = new GLWidget(0, glShared);
setViewport(m_glWidget);
setViewportUpdateMode(FullViewportUpdate);
m_glWidget->makeCurrent();
m_glWidget->initializeGL();
if (type == Scene::ImageSceneType)
m_state = new widget_states::ImageWidget(*this);
else if (type == Scene::MeshSceneType)
m_state = new widget_states::MeshWidget(*this);
setScene(getScene());
setMinimumSize(250, 250);
setContentsMargins(1, 1, 1, 1);
#ifdef DEBUG
std::cout << "create graphicView: " << name.toStdString() << std::endl;
#endif
}
示例8: QGraphicsView
//! [0]
GraphWidget::GraphWidget(QWidget *parent)
: QGraphicsView(parent), timerId(0)
{
//初始化场景
QGraphicsScene *scene = new QGraphicsScene(this);
scene->setItemIndexMethod(QGraphicsScene::NoIndex);
//设置场景
setScene(scene);
//缓存背景模式,提高绘制效率,防止闪屏
setCacheMode(CacheBackground);
setViewportUpdateMode(BoundingRectViewportUpdate);
//设置抗锯齿,平滑图像或字体边缘
setRenderHints(QPainter::Antialiasing|QPainter::TextAntialiasing|QPainter::SmoothPixmapTransform);
//允许节点位置动态调整
setTransformationAnchor(AnchorUnderMouse);
//允许上下文菜单
setContextMenuPolicy(Qt::ActionsContextMenu);
//允许拖拽滚屏
setDragMode( QGraphicsView::ScrollHandDrag);
setInteractive(true);
setMinimumSize(Default_width, Default_height);
}
示例9: QGraphicsView
MapView::MapView(QWidget *parent)
: QGraphicsView(parent)
{
settings_ = Settings::sharedInstance();
setBackgroundBrush(Qt::lightGray);
setAcceptDrops(true);
setFocusPolicy(Qt::StrongFocus);
setViewportUpdateMode(FullViewportUpdate);
//setAlignment(Qt::AlignLeft | Qt::AlignTop);
setScene(new MapScene(this));
//setSceneRect(0, 0, 0, 0);
updateGridPixmap();
connect(settings_, SIGNAL(showGridChanged(bool)),
this, SLOT(updateGridPixmap()));
connect(settings_, SIGNAL(finalGridSizeChanged(QSizeF)),
this, SLOT(updateGridPixmap()));
connect(settings_, SIGNAL(zoomChanged(double)),
this, SLOT(onZoomChanged(double)));
onZoomChanged(settings_->zoom());
}
示例10: QGraphicsView
MyGraphicsView::MyGraphicsView(QObject * /*parent*/) :
QGraphicsView(), m_rotation(0.0)
{
setDragMode(QGraphicsView::RubberBandDrag);
setAntialiasing(g_settings->antialiasing);
setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
}
示例11: QGraphicsView
SCgView::SCgView(QWidget *parent, SCgWindow *window) :
QGraphicsView(parent),
mActionChangeContent(0),
mActionShowContent(0),
mActionShowAllContent(0),
mActionHideAllContent(0),
mActionDeleteContent(0),
mActionChangeIdtf(0),
mActionDelete(0),
mActionContourDelete(0),
mActionSwapPairOrient(0),
mActionCopy(0),
mActionCut(0),
mActionPaste(0),
mActionSelectAll(0),
mContextMenu(0),
mContextObject(0),
mWindow(window),
isSceneRectControlled(false)
{
setCacheMode(CacheNone);//CacheBackground);
setViewportUpdateMode(BoundingRectViewportUpdate);
setRenderHint(QPainter::Antialiasing);
setTransformationAnchor(AnchorUnderMouse);
setResizeAnchor(AnchorViewCenter);
setOptimizationFlag(DontAdjustForAntialiasing);
setDragMode(QGraphicsView::RubberBandDrag);
setAcceptDrops(true);
connect(mWindow->undoStack(), SIGNAL(indexChanged(int)), this, SLOT(updateActionsState(int)) );
createActions();
}
示例12: QGraphicsView
FormEditorGraphicsView::FormEditorGraphicsView(QWidget *parent) :
QGraphicsView(parent)
{
setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
setResizeAnchor(QGraphicsView::AnchorViewCenter);
setCacheMode(QGraphicsView::CacheNone);
// setCacheMode(QGraphicsView::CacheBackground);
setViewportUpdateMode(QGraphicsView::SmartViewportUpdate);
setOptimizationFlags(QGraphicsView::DontSavePainterState);
// setViewportUpdateMode(QGraphicsView::NoViewportUpdate);
setRenderHint(QPainter::Antialiasing, false);
setFrameShape(QFrame::NoFrame);
setAutoFillBackground(true);
setBackgroundRole(QPalette::Window);
const int checkerbordSize= 20;
QPixmap tilePixmap(checkerbordSize * 2, checkerbordSize * 2);
tilePixmap.fill(Qt::white);
QPainter tilePainter(&tilePixmap);
QColor color(220, 220, 220);
tilePainter.fillRect(0, 0, checkerbordSize, checkerbordSize, color);
tilePainter.fillRect(checkerbordSize, checkerbordSize, checkerbordSize, checkerbordSize, color);
tilePainter.end();
setBackgroundBrush(tilePixmap);
viewport()->setMouseTracking(true);
}
示例13: QGLWidget
void View::setOpenGL( const bool enabled )
{
if ( enabled == hasOpenGL_ )
return;
hasOpenGL_ = enabled;
if (hasOpenGL_)
{
viewport_ = new QGLWidget( QGLFormat(QGL::SampleBuffers), this );
setViewport(viewport_);
viewport_->makeCurrent();
glClearColor( 0, 0, 0, 1.0 );
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
// glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
glPolygonMode( GL_FRONT, GL_FILL );
glPolygonMode( GL_BACK, GL_LINE );
glEnable(GL_POLYGON_OFFSET_FILL);
glPolygonOffset( 1.0, 2.0 );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
}
else
{
defaultVP_ = new QWidget(this);
setViewport(defaultVP_);
}
setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
setCacheMode(QGraphicsView::CacheNone);
setRenderHints(QPainter::Antialiasing|QPainter::SmoothPixmapTransform);
setForegroundBrush(Qt::NoBrush);
setBackgroundBrush(Qt::NoBrush);
}
示例14: QGraphicsView
SchemaEditor::SchemaEditor(QWidget *parent, SchemaGui *schemaGui, Engine * engine, PanelScrollView *panelScrollView) :
QGraphicsView(schemaGui, parent),
_contextMenuPos(0,0),
_contextGear(NULL),
_engine(engine),
_schemaGui(schemaGui),
_scale(1),
_panelScrollView(panelScrollView),
_maxZValue(1),
_selectionChangeBypass(false)
{
_schemaGui->setSchemaEditor(this);
setDragMode(QGraphicsView::RubberBandDrag);
setRenderHint(QPainter::Antialiasing, true);
setFrameStyle(Sunken | StyledPanel);
setOptimizationFlags(QGraphicsView::DontSavePainterState | QGraphicsView::IndirectPainting);
setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
// render with OpenGL
if(0)
setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
resetTransform();
setAcceptDrops(TRUE);
}
示例15: QGraphicsView
View::View(QGraphicsScene *parent) : QGraphicsView(parent) {
setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
_topBar = new TopBar;
_topBar->setPos(0, 0);
scene()->addItem(_topBar);
_cptArticles = 0;
}