Пример #1
0
SEXP
view_setAntialias(SEXP v, SEXP mode)
{
    QGraphicsView *view = unwrapQObject(v, QGraphicsView);
    if (LOGICAL(mode)[0]) {
	view->setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing);
    }
    else {
	view->setRenderHints(QPainter::TextAntialiasing);
    }
    return R_NilValue;
}
Пример #2
0
  NodeStatInspector::NodeStatInspector(QWidget* parent)
    : QWidget(parent) {
    setWindowFlags(Qt::Tool);
    QGraphicsScene* scene = new QGraphicsScene();
    
    scene->addEllipse(70,10,16,16,QPen(),QBrush(DrawingCursor::white));
    scene->addEllipse(70,60,16,16,QPen(),QBrush(DrawingCursor::blue));
    scene->addRect(32,100,12,12,QPen(),QBrush(DrawingCursor::red));

    QPolygonF poly;
    poly << QPointF(78,100) << QPointF(78+8,100+8)
         << QPointF(78,100+16) << QPointF(78-8,100+8);
    scene->addPolygon(poly,QPen(),QBrush(DrawingCursor::green));

    scene->addEllipse(110,100,16,16,QPen(),QBrush(DrawingCursor::white));
    
    QPen pen;
    pen.setStyle(Qt::DotLine);
    pen.setWidth(0);
    scene->addLine(78,26,78,60,pen);
    scene->addLine(78,76,38,100,pen);
    scene->addLine(78,76,78,100,pen);
    scene->addLine(78,76,118,100,pen);
    
    scene->addLine(135,10,145,10);
    scene->addLine(145,10,145,110);
    scene->addLine(145,60,135,60);
    scene->addLine(145,110,135,110);
    
    nodeDepthLabel = scene->addText("0");
    nodeDepthLabel->setPos(150,20);
    subtreeDepthLabel = scene->addText("0");
    subtreeDepthLabel->setPos(150,75);

    choicesLabel = scene->addText("0");
    choicesLabel->setPos(45,57);

    solvedLabel = scene->addText("0");
    solvedLabel->setPos(78-solvedLabel->document()->size().width()/2,120);
    failedLabel = scene->addText("0");
    failedLabel->setPos(30,120);
    openLabel = scene->addText("0");
    openLabel->setPos(110,120);

    QGraphicsView* view = new QGraphicsView(scene);
    view->setRenderHints(view->renderHints() | QPainter::Antialiasing);
    view->show();

    scene->setBackgroundBrush(Qt::white);

    boxLayout = new QVBoxLayout();
    boxLayout->setContentsMargins(0,0,0,0);
    boxLayout->addWidget(view);
    setLayout(boxLayout);

    setWindowTitle("Gist node statistics");
    setAttribute(Qt::WA_QuitOnClose, false);
    setAttribute(Qt::WA_DeleteOnClose, false);
  }
Пример #3
0
SEXP
qt_qsceneView(SEXP scene)
{
    QGraphicsView *v = new QGraphicsView(unwrapSmoke(scene, QGraphicsScene), 0);
    v->setRenderHints(QPainter::TextAntialiasing);
    v->setInteractive(true);
    // v->setDragMode(QGraphicsView::RubberBandDrag);
    v->setDragMode(QGraphicsView::ScrollHandDrag);
    return wrapSmoke(v, QGraphicsView, true);
}
Пример #4
0
/*------------------------------------------------------------------------------
|    main
+-----------------------------------------------------------------------------*/
int main(int argc, char** argv) {
	qputenv("QT_QPA_EGLFS_FORCE888", "1");

	QApplication::setAttribute(Qt::AA_ShareOpenGLContexts, true);
	QApplication a(argc, argv);

	const QStringList args = a.arguments();
	if (args.size() < 2) {
		log_err("Video ID is missing.");
		return 1;
	}

	const QString videoId = args.at(1);
	log_info("Starting playback of video ID %s...", qPrintable(videoId));

	POC_Bridge bridge(videoId);

	QGraphicsWebView* webItem = new QGraphicsWebView;
	webItem->page()->mainFrame()->addToJavaScriptWindowObject("bridge", &bridge);

	QOpenGLWidget* glViewport = new QOpenGLWidget;

	QGraphicsView* view = new QGraphicsView;
	view->setFrameShape(QFrame::NoFrame);

	view->setRenderHints(QPainter::Antialiasing);
	view->setScene(new QGraphicsScene);
	view->setViewport(glViewport);
	view->showFullScreen();

	view->scene()->setBackgroundBrush(QBrush(Qt::red));
	view->scene()->setSceneRect(QRectF(0, 0, 1920, 1080));
	view->scene()->addItem(webItem);

	webItem->setUrl(QUrl("qrc:/player.html"));
	webItem->setMinimumSize(1920, 1080);

	return a.exec();
}
Пример #5
0
Debugger::Debugger(Shift::Database *db, QWidget *parent) : QWidget(parent)
  {
  _db = db;

  move(10, 10);

  QVBoxLayout *layout = new QVBoxLayout(this);
  layout->setContentsMargins(0, 0, 0, 0);
  setLayout(layout);

  QToolBar *toolbar = new QToolBar("mainTool", this);
  layout->addWidget(toolbar);

  toolbar->addAction("Snapshot", this, SLOT(snapshot()));

  _scene = new QGraphicsScene(this);

  _scene->setBackgroundBrush(QColor(64, 64, 64));

  QGraphicsView *view = new QGraphicsView(_scene, this);
  layout->addWidget(view);
  view->setRenderHints(QPainter::Antialiasing);
  view->setDragMode(QGraphicsView::ScrollHandDrag);
  }
Пример #6
0
int test_1_shape_ ( Main_Form *b )
{

    QTextStream std_out ( stdout );
    QTextStream std_in ( stdin );

    QTransform transform
    ( 1, 0, 0,
      0, -1, 0,
      0, 0, 1
    );
    transform.scale ( 0.5, 0.5 );


    QGraphicsView* grView = b->graphicsView;
    grView->setAlignment ( 0 ); //Qt::AlignLeft | Qt::AlignTop

    grView->setTransform ( transform );


    QGraphicsScene *grScene = new QGraphicsScene;
    grView->setScene ( grScene );
    grView->setTransform ( transform );

    grView->setRenderHints ( QPainter::Antialiasing | QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform  | QPainter::HighQualityAntialiasing );


    int i = 1000;

    forma_l * a = new forma_l;
    forma *form = a->get_m_forma();
    QList<shapes*>* sh_list = form->get_m_shapes();

    sh_list->clear();

    shape_e* she_0 =  new shape_e();
    sh_list->append ( she_0 );

    shape_7* sh7_0 =  new shape_7 ( 450 );
    sh_list->append ( sh7_0 );

    shape_56* sh56_0 =  new shape_56 ( true );
    sh_list->append ( sh56_0 );

    shape_b* shb_0 =  new shape_b ( 220, -30, -120, -1 );
    sh_list->append ( shb_0 );

    shape_* sh_0 =  new shape_;
    sh_0->set_length ( 14 );
    sh_0->set_sixtant ( 0 );
    sh_list->append ( sh_0 );

    shape_34* sh34_0 =  new shape_34;
    sh34_0->set_scale_up  ( true );
    sh34_0->set_scale_factor ( 4 );
    sh_list->append ( sh34_0 );

    shape_12* sh12_0 =  new shape_12 ( false );
    sh_list->append ( sh12_0 );

    shape_* sh_1 =  new shape_;
    sh_1->set_length ( 14 );
    sh_1->set_sixtant ( 4 );
    sh_list->append ( sh_1 );

    shape_12* sh12_1 =  new shape_12 ( true );
    sh_list->append ( sh12_1 );

    shape_89* sh89_0 =  new shape_89;
    sh89_0->set_xy ( 0, 20, 20 );
    sh89_0->append ( -20, 20 );
    sh89_0->append ( -20, -20 );
    sh89_0->append ( 20, -20 );
    sh_list->append ( sh89_0 );

    shape_56* sh56_1 =  new shape_56 ( false );
    sh_list->append ( sh56_1 );

    shape_a* sha_0 =  new shape_a;
    sha_0->set_radius ( 120 );
    sha_0->set_start ( 0 );
    sha_0->set_number ( -1 );
    sh_list->append ( sha_0 );

    shape_cd* shcd_0 =  new shape_cd;
    shcd_0->set_xy_c ( 0, 20, 20, 127 );
    shcd_0->append ( -20, 20, 127 );
    shcd_0->append ( -20, -20, 127 );
    shcd_0->append ( 20, -20, 127 );
    sh_list->append ( shcd_0 );

    draw_vars dr;
    stack st;
    a->draw ( dr, st, *grScene );

    {
        draw_point p_center ( 0.0, 0.0 );
        draw_point p_radius ( 3.5, 3.5 );
        grScene->addEllipse ( p_center.x - p_radius.x / 2., p_center.y - p_radius.y / 2., p_radius.x, p_radius.y, QPen ( Qt::red ) );
    }

    std_out << a->out() << endl;
    forma_l *bb = new forma_l;
    *bb = *a;

    std_out << endl;
    std_out << endl;
    std_out << bb->out() << endl;
    delete bb;

}
Пример #7
0
CardEditor::CardEditor(QWidget *parent) :
	QMainWindow(parent)
{
	setWindowTitle(tr("Card editor"));

	QHBoxLayout *layout = new QHBoxLayout;
	QGraphicsView *view = new QGraphicsView;

	view->setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform | QPainter::HighQualityAntialiasing);

	card_scene = new CardScene;
	connect(card_scene, SIGNAL(avatar_snapped(QRectF)), this, SLOT(saveAvatar(QRectF)));

	view->setScene(card_scene);
	view->setFixedSize(card_scene->sceneRect().width() + 2,
					   card_scene->sceneRect().height() + 2);

	layout->addWidget(createLeft());
	layout->addWidget(view);

	QWidget *central_widget = new QWidget;
	central_widget->setLayout(layout);
	setCentralWidget(central_widget);

	QMenuBar *menu_bar = new QMenuBar;
	setMenuBar(menu_bar);

	QMenu *file_menu = new QMenu(tr("File"));
	QAction *import = new QAction(tr("Import ..."), file_menu);
	import->setShortcut(Qt::CTRL + Qt::Key_O);
	QAction *save = new QAction(tr("Save ..."), file_menu);
	save->setShortcut(Qt::CTRL + Qt::Key_S);
	QAction *exit = new QAction(tr("Exit"), file_menu);
	exit->setShortcut(Qt::CTRL + Qt::Key_Q);

	file_menu->addAction(import);
	file_menu->addAction(save);
	file_menu->addSeparator();
	file_menu->addAction(exit);

	menu_bar->addMenu(file_menu);

	connect(import, SIGNAL(triggered()), this, SLOT(import()));
	connect(save, SIGNAL(triggered()), this, SLOT(saveImage()));
	connect(exit, SIGNAL(triggered()), this, SLOT(close()));

	QMenu *tool_menu = new QMenu(tr("Tool"));

	QAction *making_big = new QAction(tr("Make big avatar"), tool_menu);
	making_big->setShortcut(Qt::ALT + Qt::Key_B);
	connect(making_big, SIGNAL(triggered()), card_scene, SLOT(makeBigAvatar()));
	tool_menu->addAction(making_big);

	QAction *making_small = new QAction(tr("Make small avatar"), tool_menu);
	making_small->setShortcut(Qt::ALT + Qt::Key_M);
	connect(making_small, SIGNAL(triggered()), card_scene, SLOT(makeSmallAvatar()));
	tool_menu->addAction(making_small);

	QAction *making_tiny = new QAction(tr("Make tiny avatar"), tool_menu);
	making_tiny->setShortcut(Qt::ALT + Qt::Key_T);
	connect(making_tiny, SIGNAL(triggered()), card_scene, SLOT(makeTinyAvatar()));
	tool_menu->addAction(making_tiny);

	QAction *hiding_rect = new QAction(tr("Hide avatar rect"), tool_menu);
	hiding_rect->setShortcut(Qt::ALT + Qt::Key_H);
	connect(hiding_rect, SIGNAL(triggered()), card_scene, SLOT(hideAvatarRects()));
	tool_menu->addAction(hiding_rect);

	tool_menu->addSeparator();

	QAction *reset_photo = new QAction(tr("Reset photo"), tool_menu);
	reset_photo->setShortcut(Qt::ALT + Qt::Key_R);
	connect(reset_photo, SIGNAL(triggered()), card_scene, SLOT(resetPhoto()));
	tool_menu->addAction(reset_photo);

	QAction *copy_photo = new QAction(tr("Copy photo to clipboard"), tool_menu);
	copy_photo->setShortcut(Qt::CTRL + Qt::Key_C);
	connect(copy_photo, SIGNAL(triggered()), this, SLOT(copyPhoto()));
	tool_menu->addAction(copy_photo);

	menu_bar->addMenu(tool_menu);

	card_scene->setMenu(tool_menu);
}
Пример #8
0
FenPrincipale::FenPrincipale()
{				
       // setFixedSize(1200,800); // Dimensions fixées à 850x480px
		
		QGridLayout *layout0 = new QGridLayout; // c le layout de base de la page1
		QGraphicsScene *scene =  new QGraphicsScene; 
		QGraphicsView *vue = new QGraphicsView(scene,this);
	
		scene->setSceneRect(0,0,mapLargeur+50,mapHauteur+50); // taille de la scene
		vue->setRenderHints(QPainter::Antialiasing|QPainter::TextAntialiasing);    
		vue->setFixedSize(mapLargeur+100,mapHauteur+100); //taille de la vue
    
		//Mise en place de la map 
		QPixmap map_im ; 
		map_im.load("map.png");
		map=scene->addPixmap(map_im);
		map->setPos(0,0);
		map->setZValue(-1);
		
		//Rectangle test_debug
		QRect rectangle1(15,15,618,418);
		scene->addRect(rectangle1);
		//rectangle1.moveCenter(QPoint(0,0)); // met le centre au centre
		
		//Création de l'origine
		QRect rectangle(0,0,10,10);
		rectangle.moveCenter(QPoint(0,0)); // met le centre au centre
		origine=scene->addRect(rectangle);
		origine->setPos(map_im.width()/2,map_im.height()/2);// au centre de l'image
		
        //Mise en place de du robot
		QPixmap robot_im ; 
		robot_im.load("petit_robot.png");
		robot=scene->addPixmap(robot_im);
		robot->setZValue(2);// au dessus de l'image carte 2>-1
		robot->setOffset(-robot_im.width()/2,-robot_im.height()/2); // origine du robot au centre
		robot->setPos(origine->x(),origine->y());//placer au centre du palteau
		
        //Mise en place de l'obstacle
        
        QPen pen(Qt::black, 1, Qt::SolidLine);
		QBrush brush(Qt::black);
		//scene.addRect(rectangle, pen, brush);
        
        obstacle = scene->addEllipse(0,0,15,15,pen,brush);
        obstacle->setZValue(1);
        obstacle->setPos(origine->x(),origine->y());
        
        obstacle2 = scene->addEllipse(0,0,15,15,pen,brush);
        obstacle2->setZValue(1);
        obstacle2->setPos(origine->x(),origine->y());
        
        //Ajout au layout principale puis à la fenetre
        layout0->addWidget(vue, 0,0);
        setLayout(layout0);	
         
         //Configuration du Timer pas utiliser (debug)
        timer = new QTimer(this);
        // timer->start(1000);   		
         
         //Connection des Signaux/Solts
         connect( timer, SIGNAL(timeout()), this, SLOT(timerOut()) );
         
         //Pacement par defaut
         
         //modifPosition(robot,-750,-1250,90);
         modifPosition(robot,-750,0,0);
         testPosObs(obstacle,100,90);
         
}