コード例 #1
0
observateurTexte::observateurTexte(Othello * othellier, QPoint  pos) : QLabel(){

	   setWindowTitle("Observateur Texte");
	   this->move(pos.x() + 300, pos.y());
	   Qt::WindowFlags flags = 0;
	   QFont sansFont("Lucida Console", 12);		//police à utiliser
	   sansFont.setWordSpacing(5);
	   flags |= Qt::CustomizeWindowHint;
	   flags |= Qt::WindowTitleHint;
	   setWindowFlags(flags);
	   this->setMinimumWidth(650);
	   this->setFont(sansFont);						//défini la police


	   QHBoxLayout *horizontalLayout;
	   QScrollArea *scrollArea;
	   QWidget *scrollAreaWidgetContents;
	   QVBoxLayout *verticalLayout;

	   horizontalLayout = new QHBoxLayout(this);
       horizontalLayout->setSpacing(6);
       horizontalLayout->setContentsMargins(11, 11, 11, 11);
       horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout"));
       vuePlateau = new QLabel(this);
       vuePlateau->setObjectName(QString::fromUtf8("vuePlateau"));
       horizontalLayout->addWidget(vuePlateau);
       scrollArea = new QScrollArea(this);
       //scrollArea->setFixedWidth(185);
       scrollArea->setMinimumWidth(185);
       scrollArea->setObjectName(QString::fromUtf8("scrollArea"));
       scrollArea->setWidgetResizable(true);
       scrollAreaWidgetContents = new QWidget();
       scrollAreaWidgetContents->setObjectName(QString::fromUtf8("scrollAreaWidgetContents"));
       scrollAreaWidgetContents->setGeometry(QRect(0, 0, 285, 642));
       verticalLayout = new QVBoxLayout(scrollAreaWidgetContents);
       verticalLayout->setSpacing(6);
       verticalLayout->setContentsMargins(11, 11, 11, 11);
       verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
       listeCoups = new QLabel(scrollAreaWidgetContents);
       listeCoups->setObjectName(QString::fromUtf8("listeCoups"));
       listeCoups->setAlignment(Qt::AlignLeft|Qt::AlignTop);
       verticalLayout->addWidget(listeCoups);
       scrollArea->setWidget(scrollAreaWidgetContents);
       vuePlateau->raise();
       listeCoups->raise();
       horizontalLayout->addWidget(scrollArea);

	   oth = othellier;
}
コード例 #2
0
ファイル: MainWindow.cpp プロジェクト: jgwagg/Spine
void MainWindow::drawSpine()
{
    QPen pen(Qt::NoPen);
    QBrush vertBrush(Vertebrae_Color, Qt::SolidPattern);
    QFont sansFont("Helvetica", 12, QFont::Bold);
    for(QMap<Vertebrae, QPolygonF>::iterator& kv = _vPolys.begin(); kv != _vPolys.end(); ++kv)
    {
        _scene.addPolygon(kv.value(), pen, vertBrush);
        auto gsti = _scene.addSimpleText(vertebraeToString(kv.key()));
        gsti->setPos(kv.value().boundingRect().center() - gsti->boundingRect().center());
        gsti->setFont(sansFont);
    }
    ui->graphicsView->setScene(&_scene);
    ui->graphicsView->show();
}
コード例 #3
0
ファイル: graphicwidget.cpp プロジェクト: Nekitos/Motion
void GraphicWidget::DrawLabels(QPainter &painter)
{
    QFont sansFont("Helvetica [Cronyx]", 9);
    painter.setFont(sansFont);
    painter.setPen(QPen(Qt::black, 1));

    double aMin, aMax, fMin, fMax, coeffX, coeffY;


    for (std::vector<GraphData>::iterator it = GraphicsData.begin(); it != GraphicsData.end(); it++)
    {
        it->setWidthHeight(w, h);
    }
    coeffX = GraphicsData[0].getCoeffX();
    coeffY = GraphicsData[0].getCoeffY();

    aMin = GraphicsData[0].getArgMin();
    aMax = GraphicsData[0].getArgMax();
    fMin = GraphicsData[0].getValMin();
    fMax = GraphicsData[0].getValMax();

    double temp = aMin * coeffX;
    while(temp <= aMax * coeffX)
    {
        painter.drawLine(int( temp ), h, int( temp ), int(h - h*0.01));
        painter.drawText(int( temp ), int(h - h * 0.02), QString().sprintf("%.2f", temp / coeffX));
        temp += static_cast<double>(static_cast<int>((abs(aMax - aMin))  * coeffX / 10.0));
    }

    temp = fMin * coeffY;
    while(temp <= fMax * coeffY)
    {
       painter.drawLine(0, h - int( temp - fMin * coeffY), w * 0.01, h - int( temp - fMin * coeffY ));
       painter.drawText(w * 0.02, h - int( temp - fMin * coeffY), QString().sprintf("%.2f", temp / coeffY));
       temp += static_cast<double>(static_cast<int>((abs(aMax - aMin))  * coeffX / 10.0));
    }

}
コード例 #4
0
int main(int argc, char *argv[])
{
    //It cannot properly fall back to Qt Widgets versions of the dialogs if
    // we use a QGuiApplication, which only supports QML stuff.
    //QGuiApplication app(argc, argv);
    QApplication app(argc, argv);

    //This is for the QSettings defaults from things like the qt file dialog and stuff...
    app.setApplicationName("Filmulator");
    app.setOrganizationName("Filmulator");

    QFont sansFont("Sans Serif",9);
    app.setFont(sansFont);
    QQmlApplicationEngine engine;

    QTranslator translator;
    translator.load("filmulatortr_la");
    app.installTranslator(&translator);

    //Prepare database connection.
    //This should create a new db file if there was none.
    QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
    setupDB(&db);

    //Create the object for communicating between SQL classes.
    SignalSwitchboard *switchboard = new SignalSwitchboard;

    //Create a settings object for persistent settings.
    Settings *settingsObj = new Settings;
    engine.rootContext()->setContextProperty("settings", settingsObj);

    //Prepare an object for managing the processing parameters.
    ParameterManager *paramManager = new ParameterManager;
    engine.rootContext()->setContextProperty("paramManager",paramManager);
    QObject::connect(paramManager, SIGNAL(updateTableOut(QString, int)),
                     switchboard, SLOT(updateTableIn(QString, int)));

    //Prepare an image provider object.
    FilmImageProvider *filmProvider = new FilmImageProvider(paramManager);
    //Connect it as an image provider so that qml can get the photos
    engine.addImageProvider(QLatin1String("filmy"), filmProvider);
    //Connect it as a Q_OBJECT so that qml can run methods
    engine.rootContext()->setContextProperty("filmProvider",filmProvider);

    qRegisterMetaType<QFileInfo>();

    //Prepare a model for importing.
    ImportModel *importModel = new ImportModel;
    engine.rootContext()->setContextProperty("importModel", importModel);

    //Prepare a model for the organize view.
    OrganizeModel *organizeModel = new OrganizeModel;
    engine.rootContext()->setContextProperty("organizeModel", organizeModel);
    engine.rootContext()->setContextProperty("dateHistoModel", organizeModel->dateHistogram);
    QObject::connect(switchboard, SIGNAL(updateTableOut(QString,int)),
                     organizeModel, SLOT(updateTable(QString,int)));
    QObject::connect(organizeModel, SIGNAL(updateTableOut(QString,int)),
                     switchboard, SLOT(updateTableIn(QString,int)));

    //Prepare a model for the queue view.
    QueueModel *queueModel = new QueueModel;
    queueModel->setQueueQuery();
    QObject::connect(switchboard, SIGNAL(updateTableOut(QString, int)),
                     queueModel, SLOT(updateTable(QString, int)));
    QObject::connect(importModel, SIGNAL(enqueueThis(QString)),
                     queueModel, SLOT(enQueue(QString)));
    engine.rootContext()->setContextProperty("queueModel", queueModel);

    if (QFile("qml/filmulator-gui/main.qml").exists())
    {
        cout << "loading UI from copy in directory" << endl;
        engine.load(QUrl::fromLocalFile("qml/filmulator-gui/main.qml"));
    }
    else if (QFile("/usr/lib/filmulator-gui/qml/filmulator-gui/main.qml").exists())
    {
        cout << "loading UI from /usr/lib/" << endl;
        engine.load(QUrl::fromLocalFile("/usr/lib/filmulator-gui/qml/filmulator-gui/main.qml"));
    }
    else
    {
        qWarning("QML UI file missing");
        return -1;
    }

    QObject *topLevel = engine.rootObjects().value(0);
    QQuickWindow *window = qobject_cast<QQuickWindow *>(topLevel);
    if (!window) {
        qWarning("Error: your root item has to be a Window");
        return -1;
    }
    window->setIcon(QIcon(":/icons/filmulator64icon.svg"));
    window->show();

    return app.exec();
}
コード例 #5
0
ファイル: main.cpp プロジェクト: daesolus/ProjetS2
int main(int argc, char *argv[])
{

    
	QApplication a(argc, argv);
    
	try
	{
		MainScene scene(&a);

		QRect rec = QApplication::desktop()->screenGeometry();
		float screenHeight = rec.height();
		float screenWidth = rec.width();

#if TARGET_OS_IPHONE
		if( screenHeight/screenWidth == 0.75 )
			//c'est un iPad
			scene.setSceneRect(100, 0, 1440, 900);
		else
			//c'est un iPhone
			scene.setSceneRect(0, 0, 1440, 900);
#else
		scene.setSceneRect(0, 0, screenWidth, screenHeight);
#endif

		QFont font("Helvetica Neue", 30, -1, false);
		QFont sansFont("Helvetica", 30);

		a.setStyleSheet("background-color: black;");
		scene.setBackgroundBrush(QBrush(QColor(0, 0, 0)));
		
        MainView *view = new MainView(&scene);
        
        view->setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));

        //view->setScene(&scene);
        
        
		//qDebug() << screenHeight / screenWidth;

#if TARGET_OS_IPHONE
		if( screenHeight/screenWidth == 0.75 )
			//c'est un iPad
			view->fitInView(QRect(0, 0, rec.height()/1.9, rec.width()/1.57), Qt::KeepAspectRatio);
		else
			//c'est un iPhone
			view->fitInView(QRect(0, 0, rec.height()*2.1, rec.width()*2.1), Qt::KeepAspectRatio);
#endif


#ifdef __APPLE__
#if TARGET_OS_IPHONE
		view->setWindowFlags(Qt::CustomizeWindowHint | Qt::FramelessWindowHint);
		view->setFrameShape(QFrame::NoFrame);
#else
		//rien. le défaut est parfait sur Mac
#endif
        
#else
		view->setWindowFlags(Qt::CustomizeWindowHint | Qt::FramelessWindowHint);
		view->setFrameShape(QFrame::NoFrame);
#endif

		//view.setTransform(m);
		view->showFullScreen();

        
		//view.show();
		return a.exec();
	}
	catch (std::exception& e){
		QMessageBox::critical(0, "Genius Couleur", e.what());
		return 0;
	}

}
コード例 #6
0
ファイル: mesas.cpp プロジェクト: trifolio6/Bulmages
void Mesa::paintEvent ( QPaintEvent * event ) {

        QPainter painter;
        painter.begin ( this ); // paint in picture
	painter.setPen(QColor(0, 0, 0, 255));
	QFont sansFont("Helvetica [Cronyx]", 8);
	QFont normal("Helvetica [Cronyx]", 10);
	painter.setFont(normal);
	
    BtCompany * emp = ( BtCompany * ) mainCompany();
    
    
    if (g_selectedTables.contains(m_nombreMesa) && (!g_selectMode)) {    
      painter.fillRect(0,0,m_XScale,m_YScale, QColor(255,255,0));
    } // end if
    
    /// Miramos que no haya ningun ticket abierto con el nombre usado
    BtTicket *ticket = NULL;
    for ( int i = 0; i < emp->listaTickets() ->size(); ++i ) {
        ticket = emp->listaTickets() ->at ( i );
        if ( m_nombreMesa == ticket->dbValue ( "nomticket" )) {
	  
	    if (ticket->dbValue("idalbaran") != "") {
	       painter.setBrush(Qt::cyan);
		painter.drawRect(QRectF (0, 0, m_XScale, 30));
		painter.setBrush(Qt::NoBrush);

	    } // end if
	  
	  
	    int min = ticket->elapsed() / 60000;
	    int sec = (ticket->elapsed() % 60000) / 1000;
	    QString tiempo;
	    tiempo.sprintf( "%02i:%02i",  min, sec );

	    
	    painter.setFont(sansFont);
	    painter.drawText(0,20, tiempo);
	    painter.setFont(normal);
            painter.setPen(QColor(255, 0, 0, 127));
        }// end if
    }// end for
    painter.drawText(0, 10, m_nombreMesa);

    if (m_escalando == 0)  {
	    QSvgRenderer arender(QString(m_filename), this);
    //        arender.render(&painter, QRectF (0, 15, g_escala, g_escala));
	    arender.render(&painter, QRectF (0, 15, m_XScale, m_YScale));
    }

    if (g_mesaAct == this) {
        if (!g_bloqueo) {
            painter.setPen(QColor(0, 0, 0, 127));
            painter.setPen(Qt::DashDotLine);
            painter.drawRect(0,0,m_XScale,m_YScale);

            painter.setPen(QColor(0, 0, 0, 127));
            painter.setPen(Qt::DashDotLine);
            painter.setBrush(Qt::green);
            painter.drawRect(0,0,5,5);
            painter.drawRect(0,m_YScale -5, 5, 5);
            painter.drawRect(m_XScale -5,0, 5, 5);
            painter.drawRect(m_XScale -5,m_YScale -5, 5, 5);

            painter.drawRect(m_XScale / 2 -3,m_YScale -5, 5, 5);
            painter.drawRect(m_XScale / 2 -3, 0, 5, 5);
            painter.drawRect(0,m_YScale / 2 -3, 5, 5);
            painter.drawRect(m_XScale - 5,m_YScale / 2 -3, 5, 5);

        
      } else {
            painter.setPen(Qt::DashDotLine);
	    painter.drawRect(0,0,m_XScale,m_YScale);
      }// end if
    } //end if


        painter.end();

}