void WbWidget::setMode(Mode mode) { mode_ = mode; if(mode_ < DrawPath) { if(newWbItem_) { delete newWbItem_; newWbItem_ = 0; } } if(mode_ >= Erase) { setDragMode(QGraphicsView::NoDrag); setInteractive(false); setCursor(Qt::CrossCursor); } else { setInteractive(true); } if(mode_ == Select) { setDragMode(QGraphicsView::RubberBandDrag); setCursor(Qt::ArrowCursor); } else if(mode_ == Translate) { setDragMode(QGraphicsView::RubberBandDrag); setCursor(Qt::SizeAllCursor); } else if(mode_ == Rotate) { setDragMode(QGraphicsView::RubberBandDrag); unsetCursor(); // TODO: load cursor from image } else if(mode_ == Scale) { setDragMode(QGraphicsView::RubberBandDrag); setCursor(Qt::SizeBDiagCursor); } else if(mode_ == Scroll) { setDragMode(QGraphicsView::ScrollHandDrag); } }
void MyView::setDrawStatus(MazeWidget::DrawStatus status) { this->status = status; if (status == MazeWidget::ARROW) { setDragMode(QGraphicsView::ScrollHandDrag); setInteractive(false); } else { setDragMode(QGraphicsView::NoDrag); setInteractive(true); } }
FMSampleTextView::FMSampleTextView ( QWidget* parent ) : QGraphicsView ( parent ), hasPendingUpdate ( false ) { #if 0 QGLFormat glfmt; glfmt.setSampleBuffers ( true ); QGLWidget *glwgt = new QGLWidget ( glfmt ); // qDebug()<<"GL:: A DR S"<<glwgt->format().alpha()<<glwgt->format().directRendering()<<glwgt->format().sampleBuffers(); // setViewport(glwgt); if ( glwgt->format().sampleBuffers() ) { setViewport ( glwgt ); qDebug() <<"opengl enabled - DirectRendering("<< glwgt->format().directRendering() <<") - SampleBuffers("<< glwgt->format().sampleBuffers() <<")"; } else { qDebug() <<"opengl disabled - DirectRendering("<< glwgt->format().directRendering() <<") - SampleBuffers("<< glwgt->format().sampleBuffers() <<")"; delete glwgt; } #endif setInteractive ( false ); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); theRect = 0; fPage = 0; isSelecting = false; isPanning = false; setAlignment ( Qt::AlignTop | Qt::AlignHCenter ); setTransformationAnchor ( QGraphicsView::NoAnchor ); setRenderHint ( QPainter::Antialiasing, true ); setBackgroundBrush(Qt::white); }
CamViewPort::CamViewPort(QWidget *parent) : QGraphicsView(parent) { setInteractive(false); scene = new QGraphicsScene; setScene(scene); }
//! [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); }
TextField2::TextField2() : Layer(), mRawText(""), mMeasuredWidth(0), mMeasuredHeight(0), mRenderedHeight(0), mDirty(true), mTextDirty(true), mNewLineDirty(true), mAlignment(ALIGN_LEFT), mRootNode(new Node("body")), mLineScroll(0), mDisplayNumLines(0) { mFont = GfxEngine::getEngine()->getFontLua("basic"); setInteractive(true); mTextHitboxes = new Layer(); mTextHitboxes->setInteractive(true); addChild(mTextHitboxes); mScrollbar = new Scrollbar("scrollBarUp", "scrollBarDown", "scrollBarBar", "scrollBarBack"); mScrollbar->setHeight(100.0f); mScrollbar->setVisible(false); addChild(mScrollbar); mScrollbar->addEventListener(Scrollbar::SCROLL_VALUE_CHANGE, this); }
PopupDropperView::PopupDropperView( PopupDropper *pd, QGraphicsScene *scene, QWidget *parent ) : QGraphicsView( scene, parent ) , d( new PopupDropperViewPrivate( this, pd ) ) { setInteractive( true ); setAcceptDrops( true ); }
bool DemoApplet::init() { m_rectItem->setPen(QPen(Qt::NoPen)); m_rectItem->setBrush(QBrush(m_color)); setInteractive(true); return true; }
MapView::MapView(QWidget *parent) : QGraphicsView(parent) { QGraphicsScene* scene = new QGraphicsScene(this); setScene(scene); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setInteractive(true); QGeoServiceProvider *serviceProvider = new QGeoServiceProvider("nokia"); QGeoMappingManager *manager = serviceProvider->mappingManager(); geo_map = new Map(manager); connect(geo_map, SIGNAL(markerClicked(QStringList)), SIGNAL(markerClicked(QStringList))); geo_map->setMapType(QGraphicsGeoMap::StreetMap); geo_map->setCenter(QGeoCoordinate(0.0, 0.0)); geo_map->setZoomLevel(5); scene->addItem(geo_map); track = new QGeoMapPolylineObject; QPen pen(Qt::red); pen.setWidth(3); track->setPen(pen); track->setZValue(1); setMouseTracking(true); }
// /////////////////////////////////////////////////////////////////////////////////////////// // PGraphicsView::PGraphicsView(QWidget *parent) : QGraphicsView(parent) { setBackgroundBrush(QBrush(QColor(77,120,58))); setAcceptDrops(true); setInteractive(true); setDragMode(QGraphicsView::ScrollHandDrag); //defini le comportement de la Vue qd on drag la souris dans une zone vide }
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); }
GraphicsView::GraphicsView(QWidget *parent) : QGraphicsView(parent), m_xPrev(0), m_yPrev(0), m_dragging(false) { setCursor(Qt::CrossCursor); setInteractive(true); setRenderHint(QPainter::Antialiasing); }
bool KeyboardApplet::init() { setInteractive(true); setCurrentLayout(m_current_layout); return true; }
MyView::MyView(QGraphicsScene *scene) : QGraphicsView(scene), space(false), mousePress(false), status(MazeWidget::ARROW) { setMouseTracking(true); setRenderHint(QPainter::SmoothPixmapTransform); setDragMode(QGraphicsView::ScrollHandDrag); setInteractive(false); }
NodeHitbox::NodeHitbox() : Renderable(), mNodeTarget(NULL) { setInteractive(true); addListeners(this); setName("NODE HITBOX"); }
/*! Reimplemets the QGraphicsView::mouseMoveEvent() */ void SchematicSceneViewer::mouseMoveEvent(QMouseEvent *me) { QPoint currWinPos = me->pos(); QPointF currScenePos = mapToScene(currWinPos); if (m_buttonState == Qt::MidButton) { //Panning setInteractive(false); // I need to disable QGraphicsView event handling to avoid the generation of 'virtual' mouseMoveEvent QPointF delta = currScenePos - m_oldScenePos; translate(delta.x(), delta.y()); currScenePos = mapToScene(currWinPos); // translate has changed the matrix affecting the mapToScene() method. I have to recompute currScenePos setInteractive(true); } m_oldWinPos = currWinPos; m_oldScenePos = currScenePos; QGraphicsView::mouseMoveEvent(me); }
MapView::MapView(AIDebugger& debugger) : IGraphicsView(true, true), _debugger(debugger) { _scene.setItemIndexMethod(QGraphicsScene::NoIndex); setViewportUpdateMode(QGraphicsView::FullViewportUpdate); setCacheMode(QGraphicsView::CacheBackground); setRenderHint(QPainter::Antialiasing, false); setInteractive(true); setScene(&_scene); }
Slideshow::Slideshow(Gallery *gallery, ThumbnailModel *model, QVector<int> selection, QWidget *parent) : QGraphicsView(parent), m_gallery(gallery), m_model(model), m_selection(selection), m_picture(0) { setWindowTitle(tr("Slideshow")); setAttribute(Qt::WA_DeleteOnClose, true); setWindowFlags(windowFlags() | Qt::Window); setFrameShape(QFrame::NoFrame); setFocusPolicy(Qt::StrongFocus); m_scene = new QGraphicsScene(); m_scene->setBackgroundBrush(Qt::black); setScene(m_scene); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setInteractive(false); setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); m_slidetimer = new QTimer(this); connect(m_slidetimer, SIGNAL(timeout()), this, SLOT(nextSlide())); // Construct the pause glyph QGraphicsLineItem *p1 = new QGraphicsLineItem(QLineF(20, 20, 20, 70)); QGraphicsLineItem *p2 = new QGraphicsLineItem(QLineF(60, 20, 60, 70)); QPen pen; pen.setWidth(15); pen.setCapStyle(Qt::RoundCap); pen.setColor(Qt::white); p1->setPen(pen); p2->setPen(pen); QGraphicsItemGroup *pauseglyph = new QGraphicsItemGroup(); pauseglyph->setZValue(100); pauseglyph->addToGroup(p1); pauseglyph->addToGroup(p2); addShadowEffect(pauseglyph); pauseglyph->hide(); m_pauseglyph = pauseglyph; m_scene->addItem(m_pauseglyph); // Construct timer text item m_timertext = new QGraphicsTextItem(); m_timertext->setZValue(100); QFont font; font.setPixelSize(20); m_timertext->setFont(font); m_timertext->setDefaultTextColor(Qt::white); setTimerText(); addShadowEffect(m_timertext); m_timertext->hide(); m_scene->addItem(m_timertext); m_scalefill = gallery->database()->getSetting("slideshow.scale").toString() == "fill"; m_upscale = gallery->database()->getSetting("slideshow.upscale").toBool(); }
void MyView::mousePressEvent(QMouseEvent *event) { mousePress = true; if (space) { setDragMode(QGraphicsView::ScrollHandDrag); setInteractive(false); } QGraphicsView::mousePressEvent(event); }
void MiniMap::init(qReal::MainWindow *window) { mWindow = window; setRenderHint(QPainter::Antialiasing, true); setInteractive(false); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); }
void MyView::mouseReleaseEvent(QMouseEvent *event) { mousePress = false; if (space && status != MazeWidget::ARROW) { setDragMode(QGraphicsView::NoDrag); setInteractive(true); } QGraphicsView::mouseReleaseEvent(event); }
/** * Override standard method. */ void UMLView::mouseReleaseEvent(QMouseEvent* event) { if (event->button() == Qt::MidButton) { QMouseEvent fake(event->type(), event->pos(), Qt::LeftButton, Qt::LeftButton, event->modifiers()); QGraphicsView::mouseReleaseEvent(&fake); setInteractive(true); setDragMode(QGraphicsView::NoDrag); } else QGraphicsView::mouseReleaseEvent(event); }
/** * Override standard method. */ void UMLView::mousePressEvent(QMouseEvent* event) { if (event->button() == Qt::MidButton) { setDragMode(QGraphicsView::ScrollHandDrag); setInteractive(false); QMouseEvent fake(event->type(), event->pos(), Qt::LeftButton, Qt::LeftButton, event->modifiers()); QGraphicsView::mousePressEvent(&fake); } else QGraphicsView::mousePressEvent(event); }
NodeHitbox::NodeHitbox(Node *node) : mNodeTarget(node) { if (mNodeTarget) { mNodeTarget->retain(); } setInteractive(true); addListeners(this); setName("NODE HITBOX"); }
//----------------------------------------------------------------------------- // Function: ComponentPreviewBox() //----------------------------------------------------------------------------- ComponentPreviewBox::ComponentPreviewBox(LibraryInterface* lh) : lh_(lh), component_(), scene_(0) { // Create the scene. scene_ = new GridScene(this); setScene(scene_); centerOn(0, 0); setMinimumHeight(MIN_BOX_HEIGHT); // Disable interactivity by default. setInteractive(false); }
MiniMap::MiniMap(Scene *scene, View *parent_) : View(scene, parent_), parent(parent_), margin(DEFAULT_MARGIN) { setInteractive(false); updatePosition(); updateMap(); visibleRectChanged(); setRenderHint(QPainter::Antialiasing); setHiddenItemCategories(Scene::MenuItemCategory | Scene::CursorItemCategory); connect(scene, SIGNAL(sceneRectChanged(const QRectF &)), this, SLOT(sceneRectChanged(const QRectF &))); }
void View::init() { _viewMode = Data; _mouseMode = Default; _layoutBoxItem = 0; _gridSpacing = QSizeF(20,20); _showGrid = false; _snapToGridHorizontal = false; _snapToGridVertical = false; _plotBordersDirty = false; _printing = false; _dataMode = false; _fontRescale = 1.0; _childMaximized = false; _undoStack = new QUndoStack(this); _referenceFontSizeToView = true; setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setScene(new Scene(this)); scene()->setSceneRect(rect()); scene()->installEventFilter(this); setInteractive(true); setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform); setFrameStyle(QFrame::NoFrame); setContextMenuPolicy(Qt::DefaultContextMenu); setViewportUpdateMode(QGraphicsView::MinimalViewportUpdate); setViewport(0); connect(ApplicationSettings::self(), SIGNAL(modified()), this, SLOT(updateSettings())); loadSettings(); _editAction = new QAction(tr("Edit"), this); _editAction->setShortcut(Qt::Key_E); // registerShortcut(_editAction); connect(_editAction, SIGNAL(triggered()), this, SLOT(edit())); _autoLayoutAction = new QAction(tr("Automatic"), this); connect(_autoLayoutAction, SIGNAL(triggered()), this, SLOT(createUnprotectedLayout())); _protectedLayoutAction = new QAction(tr("Protect Layout"), this); connect(_protectedLayoutAction, SIGNAL(triggered()), this, SLOT(createLayout())); _customLayoutAction = new QAction(tr("Custom"), this); connect(_customLayoutAction, SIGNAL(triggered()), this, SLOT(createCustomLayout())); connect(this, SIGNAL(viewModeChanged(View::ViewMode)), PlotItemManager::self(), SLOT(clearFocusedPlots())); applyDialogDefaultsFill(); }
GView::GView(QWidget *parent) : QGraphicsView(parent) { setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); podlaha = new QPixmap(podlaha_base); stena = new QPixmap(stena_base); kluc = new QPixmap(kluc_base); hrac = new QPixmap(playerSpawn); guard = new QPixmap(guardSpawn); brana = new QPixmap(door); finish = new QPixmap(treasure); //setDragMode(QGraphicsView::ScrollHandDrag); setInteractive(false); }
CwmTcl:: CwmTcl(int argc, char **argv) : CTclApp(argc, argv), server_xwin_(0), client_xwin_(0), canvas_(NULL), change_count_(0) { bool interactive = true; for (int i = 1; i < argc; ++i) if (strcmp(argv[i], "-x") == 0) interactive = false; setInteractive(interactive); init(); }
DisplayGroupGraphicsView::DisplayGroupGraphicsView() { // create and set scene for the view setScene(new DisplayGroupGraphicsScene()); // force scene to be anchored at top left setAlignment(Qt::AlignLeft | Qt::AlignTop); // set attributes of the view setInteractive(true); setDragMode(QGraphicsView::RubberBandDrag); setAcceptDrops(true); grabGestures(); }