Example #1
0
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);
}
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);
	
}
Example #3
0
void CanvasView::debugOverlayEnabled(bool enabled)
{
    if (enabled)
    {
        setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
    }
    else
    {
        setViewportUpdateMode(QGraphicsView::MinimalViewportUpdate);
    }
}
Example #4
0
 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;
     }
 }
Example #5
0
	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);
	} 
Example #6
0
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);
  setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  setScene(new Scene(this));
  scene()->installEventFilter(this);
  setInteractive(true);
  setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform);
  setFrameStyle(QFrame::NoFrame);

  setContextMenuPolicy(Qt::DefaultContextMenu);

  _useOpenGL = ApplicationSettings::self()->useOpenGL();
  if (_useOpenGL) {
    setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
    setViewport(new QGLWidget);
  } else {
    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(createLayout()));

  _customLayoutAction = new QAction(tr("Custom"), this);
  connect(_customLayoutAction, SIGNAL(triggered()), this, SLOT(createCustomLayout()));

  connect(this, SIGNAL(viewModeChanged(View::ViewMode)), PlotItemManager::self(), SLOT(clearFocusedPlots()));
}
Example #7
0
void View::setUseOpenGL(bool useOpenGL) {
  //This is an expensive operation...
  if (_useOpenGL == useOpenGL)
    return;

  _useOpenGL = useOpenGL;
  if (useOpenGL) {
    setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
    setViewport(new QGLWidget);
  } else {
    setViewportUpdateMode(QGraphicsView::MinimalViewportUpdate);
    setViewport(0);
  }
}
Example #8
0
/*!
  */
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);
}
Example #9
0
      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
      }
Example #10
0
//! [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);

}
Example #11
0
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());
}
Example #12
0
View::View(QWidget *parent):
    QGraphicsView(parent)
{
    setGeometry(300,300,GS_WIDTH,GS_HEIGHT);
    menu_scene = new GraphicMenu(-width()/2,-height()/2,width(),height(),this);
    board_scene = new GraphicBoard(-width()/2,-height()/2,width(),height(),this);

    QIcon icon(QPixmap(":/Graphic_source/icon.png"));
    setWindowIcon(icon);

    setWindowTitle("Pentago");
    setFixedSize(this->size());//TODO:equally resize
    setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
    setCacheMode(QGraphicsView::CacheBackground);
    setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);

    connect(menu_scene, SIGNAL(New_game_selected(int)), this, SIGNAL(New_game(int)));
    connect(menu_scene, SIGNAL(Join_game_selected(std::string)), this, SIGNAL(Join_game(std::string)));
    connect(menu_scene, SIGNAL(Host_game_selected(std::string)), this, SIGNAL(Host_game(std::string)));
    connect(menu_scene, SIGNAL(Exit_game_pressed()), this, SLOT(close()));
    connect(menu_scene, SIGNAL(Load_game_selected(std::string)),this,SIGNAL(Load_game(std::string)));

    connect(board_scene, SIGNAL(quadrant_rotated(IView::quadrant,IView::turn)), this, SIGNAL(Rotate(IView::quadrant,IView::turn)));
    connect(board_scene, SIGNAL(Stone_clicked(int, int)), this, SIGNAL(Put_stone(int,int)));
    connect(board_scene, SIGNAL(leave_game()),this,SLOT(on_leave_game()));
    connect(board_scene, SIGNAL(save_game(QString)),this,SLOT(on_save_game(QString)));

    connect(board_scene, SIGNAL(message_sended(QString)), this, SLOT(on_msg_sended(QString)));

    connect(menu_scene, SIGNAL(game_go_to_start()),board_scene, SLOT(clean_board()));
    connect(menu_scene, SIGNAL(game_go_to_start()),board_scene, SLOT(clean_log()));
    Set_control_settings(View::MENU);//it must be called in presenter after view constructing
}
Example #13
0
MyGraphicsView::MyGraphicsView(QObject * /*parent*/) :
    QGraphicsView(), m_rotation(0.0)
{
    setDragMode(QGraphicsView::RubberBandDrag);
    setAntialiasing(g_settings->antialiasing);
    setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
}
Example #14
0
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();
}
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);
}
Example #16
0
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);
}
Example #17
0
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);
}
Example #18
0
View::View(QGraphicsScene *parent) : QGraphicsView(parent) {
    setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
    _topBar = new TopBar;
    _topBar->setPos(0, 0);
    scene()->addItem(_topBar);
    _cptArticles = 0;
}
Example #19
0
void GameView::setUpUI()
{
    powerUi = new PowerInterface(am);
    powerUi->setX(0);
    powerUi->setY(0);
    powerUi->setMana(P_INITIAL_MANA);

    ressUi = new RessourcesInterface(am);
    ressUi->setX(0);
    ressUi->setY(280);
    ressUi->bt50Pressed();

    const PowerCountDown &pcd = powerUi->getCountDownManager();
    connect(&pcd,SIGNAL(powerFinishing(ACTIONS,Node*,Node*)),this,SLOT(onPowerFinishing(ACTIONS,Node*,Node*)));
    connect(&pcd,SIGNAL(powerStarting(ACTIONS,Node*,Node*)),this,SLOT(onPowerStarting(ACTIONS,Node*,Node*)));
    connect(&am,SIGNAL(doAction(ACTIONS,Node*)),this,SLOT(onDoAction(ACTIONS,Node*)));
    connect(&am,SIGNAL(doAction(ACTIONS,Node*,Node*)),this,SLOT(onDoAction(ACTIONS,Node*,Node*)));

    // Désactivation des scrollbars
    setVerticalScrollBarPolicy ( Qt::ScrollBarAlwaysOff );
    setHorizontalScrollBarPolicy ( Qt::ScrollBarAlwaysOff );
    setViewportUpdateMode( QGraphicsView::BoundingRectViewportUpdate);
    setRenderHint( QPainter::Antialiasing, true);

    setScene(scene);

    scene->addItem(powerUi);
    scene->addItem(ressBar);
    scene->addItem(ressUi);
}
WeatherWidgetGraphicsView::WeatherWidgetGraphicsView()
{
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	setWindowFlags(Qt::FramelessWindowHint);
	setAttribute(Qt::WA_TranslucentBackground,true);
	setAttribute(Qt::WA_ContentsPropagated,true);
    setCacheMode(CacheBackground);
    setViewportUpdateMode(FullViewportUpdate);
    setRenderHints(QPainter::Antialiasing | 
    			   QPainter::SmoothPixmapTransform | 
    		       QPainter::TextAntialiasing);

    // transparent background	
    QPalette palette = this->palette();
    palette.setBrush(QPalette::Base, Qt::transparent);
    setPalette(palette);
    setAttribute(Qt::WA_OpaquePaintEvent, false); // trasmit color 
	setFrameStyle(QFrame::NoFrame);
	
    iScene = new QGraphicsScene(this);
	setScene(iScene);
	resize(KWindowWidth+KExtraStrech,KWindowHeight+KExtraStrech);
	
	// Create main window which holds weather data
	iMainWindow = new WeatherGraphicsWindow(this);
	iScene->addItem(iMainWindow);
	iMainWindow->setZValue(0);
	iMainWindow->setObjectName("mainwindow");
	connect(iMainWindow,SIGNAL(minimize()),
			this,SLOT(on_mainwindow_minimize()));
	connect(iMainWindow,SIGNAL(temperatureUpdated(const QString&)),
			this,SLOT(setWindowTitle(const QString&)));
	
}
void ChangeTableLens::SetData(TransMapData* data) {
	this->dataset_ = data;

	if (sorting_item_ == NULL) {
		sorting_item_ = new ChangeSortingItem;
	}
	sorting_item_->SetData(dataset_);

	if (scene_ == NULL) {
		scene_ = new QGraphicsScene(this);
		scene_->setItemIndexMethod(QGraphicsScene::NoIndex);
		setScene(scene_);

		setCacheMode(CacheBackground);
		setViewportUpdateMode(BoundingRectViewportUpdate);
		setRenderHint(QPainter::Antialiasing);
		setTransformationAnchor(AnchorUnderMouse);

		this->setBackgroundBrush(Qt::color0);
		this->autoFillBackground();

		scene_->addItem(sorting_item_);
	}

	this->update();
}
Example #22
0
GraphView::GraphView(QWidget *parent) :
    QGraphicsView(parent)
{
    setMinimumHeight(200);
    setMinimumWidth(250);

// TODO: mouse icon
//    setDragMode(QGraphicsView::ScrollHandDrag);

   _menu = new QMenu(this);

    QAction *addIsolatedVertex = _menu->addAction("Додати ізольовану вершину");
//    QAction *addSelectAdj      = _menu->addAction("Додати суміжну з виділеними вершинами");
    QAction *removeSelected    = _menu->addAction("Видалити обрані вершини");

    connect(addIsolatedVertex, &QAction::triggered,
             this,             &GraphView::action_addIsolatedVertex);

//    connect(addSelectAdj,       &QAction::triggered,
//            this,               &GraphView::action_addToSelect);

    connect(removeSelected, &QAction::triggered,
            this,           &GraphView::removeSelectedVertex);

    setViewportUpdateMode(SmartViewportUpdate);
    setRenderHint(QPainter::Antialiasing);
}
CItemBoxView::CItemBoxView( QWidget *parent /*= 0*/ )
:QGraphicsView(parent)
{
	setCacheMode(QGraphicsView::CacheBackground);//ÉèÖûº´æ±³¾°£¬ÕâÑù¿ÉÒÔ¼Ó¿ìäÖȾËÙ¶È/
	//setDragMode(QGraphicsView::ScrollHandDrag);
	setRenderHint(QPainter::Antialiasing);// ʹÓÿ¹¾â³ÝäÖȾ
	setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
	//setBackgroundBrush(QColor(0, 200, 0));
	setWindowTitle(QObject::tr(DEFVALUE_String_CItemBoxView_Title.c_str()));

	m_pItemBoxScene = NULL;
	m_pItemBoxScene = new CItemBoxScene(NULL);
	m_pItemBoxScene->setSceneRect(0, 0, DEFVALUE_Int_Wide_CItemBoxView - 1, DEFVALUE_Int_Hight_CItemBoxView - 1);

	QRectF rectItem = QRectF(DEF_VALUE_InfomationRectItem_X, DEF_VALUE_InfomationRectItem_Y, DEF_VALUE_InfomationRectItem_Width, DEF_VALUE_InfomationRectItem_Height);
	CRectItemInBox* pRectItemInBox = NULL;
	CTextItemInBox* pTextItemInBox = NULL;

	pTextItemInBox = new CTextItemInBox(NULL, m_pItemBoxScene);
	pTextItemInBox->setPos(20, 20);
	m_pItemBoxScene->addItem(pTextItemInBox);
	pTextItemInBox = NULL;

	pRectItemInBox = new CRectItemInBox(rectItem, NULL, m_pItemBoxScene);
	pRectItemInBox->setItemPos(QPointF(20, 100));
	m_pItemBoxScene->addItem(pRectItemInBox);
	pRectItemInBox = NULL;

	this->setScene(m_pItemBoxScene);
	this->resize(DEFVALUE_Int_Wide_CItemBoxView, DEFVALUE_Int_Hight_CItemBoxView);
}
CodeMiniMap::CodeMiniMap(QWidget  *parent)
{
	mParent = parent;
	mCodeView = 0;
	codepixmap = 0;

	mScene = new QGraphicsScene(this);
    mScene->setItemIndexMethod(QGraphicsScene::BspTreeIndex);
	mScene->setSceneRect(-this->geometry().width()/2,-this->geometry().height()/2,this->geometry().width(),this->geometry().height());
	setScene(mScene);

	setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
	setRenderHint(QPainter::Antialiasing,true);

	m_intrect = new CodeViewInteractiveRect(this);
	mScene->addItem(m_intrect);
	m_intrect->setPos(QPointF(0.0,0.0));

	m_intrect->rect_height = scene()->sceneRect().height();
	m_intrect->rect_width = scene()->sceneRect().width();
	zoomlevel = 1.0f;

	//this->horizontalScrollBar()->hide();
	//this->verticalScrollBar()->hide();
	this->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	this->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
}
Example #25
0
SinglePlayerView::SinglePlayerView( QPixmap prevBg, QWidget *parent ) :
		QGraphicsView( parent )
{
	scene = new QGraphicsScene;
	scene->setItemIndexMethod( QGraphicsScene::NoIndex );

	data = olddata = NULL;
	model = oldmodel = NULL;
	msganimation = NULL;
	msgtline = NULL;
	loading = NULL;
	board = NULL;
	msg = NULL;

	isloading = false;
	currentScore = 0;
	timeLeft = 0;
	lives = 5;

	setScene( scene );
	setCacheMode( CacheBackground );
	setRenderHint( QPainter::Antialiasing );
	setTransformationAnchor( QGraphicsView::AnchorUnderMouse );
	setResizeAnchor( QGraphicsView::AnchorViewCenter );
	setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
	setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
	setViewportUpdateMode( QGraphicsView::SmartViewportUpdate );
	setOptimizationFlag( QGraphicsView::DontClipPainter );
	setMouseTracking( true );

	prevbg = new QGraphicsPixmapItem( prevBg );
	prevbg->setZValue( 0 );
	scene->addItem( prevbg );
}
Example #26
0
//! [0]
Graph_GraphicsView::Graph_GraphicsView(QWidget *parent)
    : QGraphicsView(parent)
{

    Scene = new MScene(this);
    Scene->setItemIndexMethod(QGraphicsScene::NoIndex);
    Scene->setSceneRect(-300, -200, 600, 400);
    setScene(Scene);
    setCacheMode(CacheBackground);
    setViewportUpdateMode(BoundingRectViewportUpdate);
    setRenderHint(QPainter::Antialiasing);
    setTransformationAnchor(AnchorUnderMouse);
    scale(qreal(0.8), qreal(0.8));
    setMinimumSize(400, 400);
    setWindowTitle(tr("Elastic Nodes"));
//! [0]

    connect(Scene,&MScene::scene_mousePressEvent,this,&Graph_GraphicsView::scene_mousePressEvent);
    //addNode(100,0); addNode(200,-20);
    //emit sgAddNode(); emit sgAddNode();

    connect(&mtim,&QTimer::timeout,this,&timerEvent);
    mtim.setInterval(1000/25);
    //mtim.start();

}
Example #27
0
GrDapView::GrDapView(QWidget *parent)
	: QGraphicsView(parent)
{
	scene_space  = 4;
	zoomSlider   = 250;
	rotateSlider = 0;
	visor_height = 76;
	visor_mode   = QPainter::CompositionMode_Darken;
	visor_color  = QColor(255, 0, 0, 255);
	visor_img.load(":/img16/sinimg.png");

	scene = new QGraphicsScene(this);
	setAlignment(Qt::AlignCenter);
//	setAcceptDrops(true);
	setAutoFillBackground(true);
	setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
	setBackgroundBrush(Qt::darkGray);
	setBackgroundRole(QPalette::Dark);
	setCacheMode(QGraphicsView::CacheBackground);
	setDragMode(QGraphicsView::ScrollHandDrag);
	setOptimizationFlags(QGraphicsView::DontSavePainterState);
	setViewportUpdateMode(QGraphicsView::FullViewportUpdate);//SmartViewportUpdate FullViewportUpdate
	setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
	setFrameShape(QFrame::NoFrame);
	setNewScene(400, 400, true);
}
Example #28
0
// --------------------------------------------------------------------------------------------------------------------------------------
CGraphicsView::CGraphicsView(QWidget * parent) : QGraphicsView(parent)
{
    setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
    m_menu = new QMenu(this);
    QMenu *addMenu = m_menu->addMenu(tr("Add..."));
    addMenu->addAction(tr("Text item"), this, SLOT(addTextItemShowDialog()));
}
Example #29
0
MapView::MapView(QWidget *parent) : QGraphicsView(parent)
{
    outlinePen.setBrush(Qt::white);
    setInteractable(true);

    //NYI: limit maximum number of current downloads to 2 as specified in the CycleMap tileserver terms,
    // this would severely degrade download performance, though. Maybe keep limit at ~5?
    requestLimit = 5;
    maxReqStackSize = 30;
    networkManager = new QNetworkAccessManager(this);

    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

    setScene(new QGraphicsScene(this)); //no delete necessary, parent set
    setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);

    lastTileUpdate = QTime(0,0);
    currentTime = new QTime(QTime::currentTime());

    //tile size: 256px x 256px, in coordinates: 2*PI x 2*PI
    scale(128/PI,128/PI); //default zoom == 0
    setSceneRect(-PI, -PI, 2*PI, 2*PI);

    mapSources.insert(OCM,{OCM,"OpenCycleMap", "http://tile.opencyclemap.org/cycle/", 0, 17});
    mapSources.insert(Mapnik,{Mapnik,"OpenStreetMap Mapnik", "http://tile.openstreetmap.org/", 0,18});
    mapSources.insert(None,{None,"None","",0,20});

    MapSource = {None, "None", "", 0 , 20};
    currentZoom = 0; zoomTo(MapSource.minzoom);

    connectSignalsAndSlots();
}
Example #30
0
GraphWidget::GraphWidget(QWidget *parent)
    : timerId(0)
{

	
	
	myMainwindow = dynamic_cast<QoccMainWindow*>(parent);
    QGraphicsScene *scene = new QGraphicsScene(this);
    scene->setItemIndexMethod(QGraphicsScene::NoIndex);
    scene->setSceneRect(0, 0, 8000, 8000);
    setScene(scene);
	//setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
	//setViewport(new QGLWidget());
	setRenderHint(QPainter::Antialiasing, false);
    //setDragMode(QGraphicsView::RubberBandDrag);
    setOptimizationFlags(QGraphicsView::DontSavePainterState);
    setViewportUpdateMode(QGraphicsView::SmartViewportUpdate);
	setCacheMode(CacheBackground);
	
	
    //setRenderHint(QPainter::Antialiasing);
    setTransformationAnchor(AnchorUnderMouse);
    setResizeAnchor(AnchorViewCenter);

    scale(qreal(0.8), qreal(0.8));
    setMinimumSize(400, 400);
    setWindowTitle(tr("Elastic Nodes"));
}