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 );
}
Exemple #2
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();
}
Exemple #3
0
RectView::RectView(QWidget *parent)
    :QGraphicsView(parent)
{
    scene = new RectScene(this);
    setScene(scene);
    setCacheMode(QGraphicsView::CacheNone);
    setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
    setOptimizationFlag(QGraphicsView::DontSavePainterState,true);
    setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
}
Exemple #4
0
View::View(Scene* scene, View *parent) :
	QGraphicsView(scene, parent), hiddenItemCategories_(0)
{
	setOptimizationFlag(DontSavePainterState);
	if ( parent == nullptr )
	{
		setParent(VisualizationManager::instance().getMainWindow());
		VisualizationManager::instance().addTopLevelView(this);
	}
}
Exemple #5
0
void PianoKeybd::initialize()
{
    setAttribute(Qt::WA_AcceptTouchEvents);
    setAttribute(Qt::WA_InputMethodEnabled, false);
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setCacheMode(CacheBackground);
    setViewportUpdateMode(MinimalViewportUpdate);
    setRenderHints(QPainter::Antialiasing|QPainter::TextAntialiasing|QPainter::SmoothPixmapTransform);
    setOptimizationFlag(DontClipPainter, true);
    setOptimizationFlag(DontSavePainterState, true);
    setOptimizationFlag(DontAdjustForAntialiasing, true);
    setBackgroundBrush(QApplication::palette().background());
    initDefaultMap();
#if defined(RAWKBD_SUPPORT)
    RawKeybdApp* rapp = dynamic_cast<RawKeybdApp*>(qApp);
    if (rapp != NULL) {
        rapp->setRawKbdHandler(this);
    }
#endif
}
Exemple #6
0
QGraphVizPIP::QGraphVizPIP(QGraphicsScene *scene, QGraphVizView *parent) :
    QGraphicsView(scene, parent),
    m_GraphVizView(parent),
    m_StartedInViewport(false)
{
    setCacheMode(QGraphicsView::CacheBackground);

    setRenderHint(QPainter::Antialiasing, true);

    setOptimizationFlag(QGraphicsView::DontSavePainterState, true);
    setOptimizationFlag(QGraphicsView::DontAdjustForAntialiasing, true);

    setTransformationAnchor(QGraphicsView::AnchorUnderMouse);

    setViewportUpdateMode(QGraphicsView::MinimalViewportUpdate);

    setMouseTracking(true);
    setFrameStyle(Plain);

    updateViewPortRect();
}
	GlanceShower::GlanceShower (QWidget *parent)
	: QGraphicsView (parent)
	, TabWidget_ (0)
	, Scene_ (new QGraphicsScene)
	, Shown_ (false)
	{
		setWindowFlags (Qt::WindowStaysOnTopHint |
				Qt::FramelessWindowHint);
		setAttribute (Qt::WA_TranslucentBackground);
		setStyleSheet ("background: transparent");
		setOptimizationFlag (DontSavePainterState);
		Scene_->setItemIndexMethod (QGraphicsScene::NoIndex);
		setRenderHints (QPainter::HighQualityAntialiasing);
	}
Exemple #8
0
void
UBBoardView::init ()
{
  connect (UBSettings::settings ()->boardPenPressureSensitive, SIGNAL (changed (QVariant)),
           this, SLOT (settingChanged (QVariant)));

  connect (UBSettings::settings ()->boardMarkerPressureSensitive, SIGNAL (changed (QVariant)),
           this, SLOT (settingChanged (QVariant)));

  connect (UBSettings::settings ()->boardUseHighResTabletEvent, SIGNAL (changed (QVariant)),
           this, SLOT (settingChanged (QVariant)));

  setWindowFlags (Qt::FramelessWindowHint);
  setFrameStyle (QFrame::NoFrame);
  setRenderHints (QPainter::Antialiasing | QPainter::SmoothPixmapTransform | QPainter::TextAntialiasing);
  setVerticalScrollBarPolicy (Qt::ScrollBarAlwaysOff);
  setHorizontalScrollBarPolicy (Qt::ScrollBarAlwaysOff);
  setAcceptDrops (true);

  setOptimizationFlag (QGraphicsView::IndirectPainting); // enable UBBoardView::drawItems filter

  mTabletStylusIsPressed = false;
  mMouseButtonIsPressed = false;
  mPendingStylusReleaseEvent = false;

  setCacheMode (QGraphicsView::CacheBackground);

  mUsingTabletEraser = false;
  mIsCreatingTextZone = false;
  mRubberBand = 0;

  mVirtualKeyboardActive = false;

  settingChanged (QVariant ());

  unsetCursor();
}
Exemple #9
0
FieldWidget::FieldWidget(QWidget *parent) :
    QGraphicsView(parent),
    m_geometryUpdated(true),
    m_rotation(0.0f),
    m_worldStateUpdated(false),
    m_visualizationsUpdated(false),
    m_hasTouchInput(false),
    m_dragType(DragNone),
    m_dragItem(NULL)
{
    m_touchStatusType = QGestureRecognizer::registerRecognizer(new TouchStatusRecognizer);
    grabGesture(m_touchStatusType);
    grabGesture(Qt::PanGesture);
    grabGesture(Qt::PinchGesture);

    geometrySetDefault(&m_geometry);

    // setup context menu
    m_contextMenu = new QMenu(this);
    QAction *actionHorizontal = m_contextMenu->addAction("Horizontal");
    connect(actionHorizontal, SIGNAL(triggered()), SLOT(setHorizontal()));
    QAction *actionVertical = m_contextMenu->addAction("Vertical");
    connect(actionVertical, SIGNAL(triggered()), SLOT(setVertical()));
    QAction *actionFlip = m_contextMenu->addAction("Flip");
    connect(actionFlip, SIGNAL(triggered()), SLOT(flip()));
    m_contextMenu->addSeparator();
    // add actions to allow hiding visualizations of a team
    m_actionShowBlueVis = m_contextMenu->addAction("Show blue visualizations");
    m_actionShowBlueVis->setCheckable(true);
    m_actionShowBlueVis->setChecked(true);
    connect(m_actionShowBlueVis, SIGNAL(triggered()), SLOT(updateVisualizationVisibility()));
    m_actionShowYellowVis = m_contextMenu->addAction("Show yellow visualizations");
    m_actionShowYellowVis->setCheckable(true);
    m_actionShowYellowVis->setChecked(true);
    connect(m_actionShowYellowVis, SIGNAL(triggered()), SLOT(updateVisualizationVisibility()));
    m_actionShowControllerVis = m_contextMenu->addAction("Show controller visualizations");
    m_actionShowControllerVis->setCheckable(true);
    m_actionShowControllerVis->setChecked(true);
    connect(m_actionShowControllerVis, SIGNAL(triggered()), SLOT(updateVisualizationVisibility()));
    updateVisualizationVisibility(); // update the visibility map
    m_contextMenu->addSeparator();
    // other actions
    QAction *actionShowAOI = m_contextMenu->addAction("Enable custom vision area");
    actionShowAOI->setCheckable(true);
    connect(actionShowAOI, SIGNAL(toggled(bool)), SLOT(setAOIVisible(bool)));
    m_actionAntialiasing = m_contextMenu->addAction("Anti-aliasing");
    m_actionAntialiasing->setCheckable(true);
    connect(m_actionAntialiasing, SIGNAL(toggled(bool)), SLOT(setAntialiasing(bool)));
    m_actionGL = m_contextMenu->addAction("OpenGL");
    m_actionGL->setCheckable(true);
    connect(m_actionGL, SIGNAL(toggled(bool)), SLOT(setOpenGL(bool)));
    m_contextMenu->addSeparator();
    QAction *actionScreenshot = m_contextMenu->addAction("Take screenshot");
    connect(actionScreenshot, SIGNAL(triggered()), SLOT(takeScreenshot()));
    QAction *actionSaveSituation = m_contextMenu->addAction("Save Situation");
    connect(actionSaveSituation, SIGNAL(triggered()), SLOT(saveSituation()));

    // create graphics scene
    m_scene = new QGraphicsScene(this);
    setScene(m_scene);

    // ball object
    const float ballRadius = 0.02133f;
    m_ball = new QGraphicsEllipseItem;
    m_ball->setPen(Qt::NoPen);
    m_ball->setBrush(QColor(255, 66, 0));
    m_ball->setZValue(100.0f);
    m_ball->setRect(QRectF(-ballRadius, -ballRadius, ballRadius * 2.0f, ballRadius * 2.0f));
    m_ball->hide();
    m_scene->addItem(m_ball);

    // rectangle for area of interest
    m_aoiItem = new QGraphicsPathItem;
    m_aoiItem->setPen(Qt::NoPen);
    m_aoiItem->setBrush(QColor(0, 0, 0, 128));
    m_aoiItem->setZValue(10000.0f);
    m_aoiItem->hide();
    m_scene->addItem(m_aoiItem);

    m_aoi = QRectF(-1, -1, 2, 2);
    updateAOI();

    m_scene->setBackgroundBrush(Qt::black);
    m_scene->setItemIndexMethod(QGraphicsScene::NoIndex); // should improve the performance

    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    // transforms are centered on the mouse cursor
    setTransformationAnchor(QGraphicsView::NoAnchor);
    setOptimizationFlag(QGraphicsView::DontSavePainterState);
    setCacheMode(QGraphicsView::CacheBackground);

    setHorizontal();

    // view update timer
    QTimer *timer = new QTimer(this);
    connect(timer, SIGNAL(timeout()), SLOT(updateAll()));
    timer->start(30);

    setMouseTracking(true);

    // create label to show field coordinates
    m_lblMousePos = new QLabel(this);
    m_lblMousePos->setAutoFillBackground(true); // solid background
    // draw frame
    m_lblMousePos->setFrameStyle(QFrame::StyledPanel | QFrame::Raised);
    m_lblMousePos->setMargin(2); // some space
    m_lblMousePos->hide(); // ensure that the label is hidden on startup

    // load settings
    QSettings s;
    s.beginGroup("Field");
    m_actionGL->setChecked(s.value("OpenGL").toBool());
    m_actionAntialiasing->setChecked(s.value("AntiAliasing").toBool());
    s.endGroup();
}
YigNetworkChannelView::YigNetworkChannelView(QWidget *parent) :
    QGraphicsView(parent)
{

    QGLFormat glFormat( QGL::SampleBuffers );
    //glFormat.setSwapInterval( 1 ); // set VSync
    QGLWidget* viewportGL = new QGLWidget( glFormat );
    setViewportUpdateMode( QGraphicsView::FullViewportUpdate );
    setViewport(viewportGL);
    setRenderHints(QPainter::Antialiasing);
    setOptimizationFlag(QGraphicsView::DontAdjustForAntialiasing, true);
    YigGraphicsScene* yigScene = new YigGraphicsScene;
    yigScene->setSceneRect(0, 0, 1920, 1200);
    setScene(yigScene);

    scaleFactor = 1.0;
    selectionRect = new QGraphicsRectItem( QRect( 0, 0, 0, 0 ) );
    selectionRect->setPen( QColor( 0, 0, 0, 200 ) );
    selectionRect->setFlag(QGraphicsItem::ItemIgnoresTransformations);
    //selectionRect->setBrush( QColor( 69, 139, 19, 40 ) );
    QColor rectColor = YigColorKit::accent;
    rectColor.setAlpha(130);
    selectionRect->setBrush(rectColor);
    selectionRect->setZValue( 10000 );
    scene()->addItem( selectionRect );
    selectionRect->hide();

    //glWidget->startRendering();

    mActiveBool = false;
    setActiveView(mActiveBool);
    currentCableBool = false;
    mouseDownBool = false;
    cableCounter = 0;
    srand((unsigned) time(0));
    /*
#ifdef __APPLE__
    verticalScrollBar()->setStyle(new QMacStyle);
    horizontalScrollBar()->setStyle(new QMacStyle);
#else
    verticalScrollBar()->setStyle(new QGtkStyle);
    horizontalScrollBar()->setStyle(new QGtkStyle);
#endif
    */

    QPalette scrollPalette = verticalScrollBar()->palette();
    scrollPalette.setColor(QPalette::Button, YigColorKit::focus2);
    verticalScrollBar()->setPalette(scrollPalette);

    scrollPalette = horizontalScrollBar()->palette();
    scrollPalette.setColor(QPalette::Button, YigColorKit::focus2);
    horizontalScrollBar()->setPalette(scrollPalette);
    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);

    /*
    QLinearGradient gradient(0, 0, 0, parent->geometry().height());
    gradient.setColorAt(0, YigColorKit::background2);
    gradient.setColorAt(0.005, QColor(255, 255, 255));
    gradient.setColorAt(1, QColor(190, 190, 190));
    gradient.setInterpolationMode(QGradient::ColorInterpolation);
    QBrush backgroundBrush(gradient);
    backgroundBrush.setStyle(Qt::LinearGradientPattern);*/
    //QBrush backgroundBrush(QPixmap(":/images/gui/YigAttractorBackground.png"));
    //scene()->setBackgroundBrush(YigColorKit::background);
    //backgroundPixmap = scene()->addPixmap(YigAttractor::renderAttractor(width(), height()));
    modCableParent = new QGraphicsLineItem();
    modCableParent->setZValue(-20);
    modCableParent->setFlag(QGraphicsItem::ItemHasNoContents, true);
    //modCableParent->setVisible(false);
    scene()->addItem(modCableParent);
    audioCableParent = new QGraphicsLineItem();
    audioCableParent->setZValue(-5);
    //audioCableParent->setVisible(false);
    audioCableParent->setFlag(QGraphicsItem::ItemHasNoContents, true);
    scene()->addItem(audioCableParent);
    /*
    QObject::connect(this, SIGNAL(synthForGLAdded(int,QPointF)),
                     glWidget->getGLThread(), SLOT(addSynth(int,QPointF)), Qt::QueuedConnection);
    QObject::connect(this, SIGNAL(synthForGLRemoved(int)), glWidget->getGLThread(), SLOT(removeSynth(int)), Qt::QueuedConnection);
    QObject::connect(this, SIGNAL(synthForGLMoved(int,QPointF)),
                     glWidget->getGLThread(), SLOT(setSynthPos(int,QPointF)), Qt::QueuedConnection);

    */

    //glWidget.lower();

    //setupViewport(&glWidget);

    //scene()->setBackgroundBrush(Qt::transparent);
    //setAttribute(Qt::WA_TranslucentBackground);
    //setWindowFlags(Qt::FramelessWindowHint | Qt::WindowSystemMenuHint);
    //QPalette p = viewport()->palette();
    //p.setColor(QPalette::Base, Qt::transparent);
    //viewport()->setPalette(p);
    //viewport()->setAutoFillBackground(false);
    //parent->setAttribute(Qt::WA_TranslucentBackground);
    //parent->setAutoFillBackground(false);
    //setStyleSheet("background-color: transparent;");
    //lower();
    //glWidget.raise();
    //glWidget.lower();
    //glWidget.setStyleSheet("background-color: transparent;");
    //glParent = new QWidget(parent);
    //glWidget.setParent(glParent);
    //glParent->lower();
    //glWidget.show();
    setActiveView(true);
    setMouseTracking(true);
    setFrameStyle(0);
    mouseCounter = 0;
    centerOn(0, 0);
    show();
}