예제 #1
0
파일: main.cpp 프로젝트: mpvader/qt
int main(int argc, char **argv)
{
    QApplication app(argc, argv);
    QStringList args = app.arguments();

    if (argc <= 1) {
        qDebug() << "Usage: " << qPrintable(args[0]) << " <ts-file>";
        return 1;
    }

    QTranslator trans;
    trans.load(args[1], ".");
    app.installTranslator(&trans);

    QWidget w;
    QVBoxLayout *layout = new QVBoxLayout(&w);

    QLabel label1(QObject::tr("XXXXXXXXX \33 XXXXXXXXXXX  • and → "), 0);
    QLabel label2(QObject::tr("\32"), 0);
    QLabel label3(QObject::tr("\176"), 0);
    QLabel label4(QObject::tr("\301"), 0);

    layout->addWidget(&label1);
    layout->addWidget(&label2);
    layout->addWidget(&label3);
    layout->addWidget(&label4);

    w.show();

    return app.exec();
}
예제 #2
0
파일: main.cpp 프로젝트: mpvader/qt
int main(int argc, char **argv)
{
        QApplication a(argc, argv);
        QTranslator trans(0);

        trans.load("t1_en", ".");

        a.installTranslator(&trans);
        QWidget w;
/*
        QLabel label1(QObject::tr("\33"), &w);
        QLabel label2(QObject::tr("\32"), &w);
        QLabel label3(QObject::tr("\176"), &w);
*/
        QLabel label4(QObject::tr("\301"), &w);

        w.show();
        return a.exec();
}
예제 #3
0
int main(){

    logger.logNoEndl("Setting up window...");
    window.create(sf::VideoMode(430,430), "GL");
    logger.continueln(" done!");

    logger.logNoEndl("Setting up variables...");

    rect1.setFillColor(sf::Color(200,200,200));
    rect1.setOutlineColor(sf::Color(0,0,0));
    rect1.setOutlineThickness(-2);
    rect1.setPosition(10,10);

    rect2.setFillColor(sf::Color(200,200,200));
    rect2.setOutlineColor(sf::Color(0,0,0));
    rect2.setOutlineThickness(-2);
    rect2.setPosition(220,10);

    rect3.setFillColor(sf::Color(200,200,200));
    rect3.setOutlineColor(sf::Color(0,0,0));
    rect3.setOutlineThickness(-2);
    rect3.setPosition(10,220);

    rect4.setFillColor(sf::Color(200,200,200));
    rect4.setOutlineColor(sf::Color(0,0,0));
    rect4.setOutlineThickness(-2);
    rect4.setPosition(220,220);

    sf::Font font;
    if (!font.loadFromFile("arial.ttf")){
        logger.log(Logger::LogType::Error, "Arial font not found. Cannot continue...");
        return 1;
    }

    sf::Text label1("Solid White", font);
    label1.setColor(sf::Color::Black);
    label1.setPosition(rect1.getPosition().x + rect1.getSize().x / 2 - label1.getLocalBounds().width / 2, rect1.getPosition().y + rect1.getSize().y / 2 - label1.getLocalBounds().height / 2 - 10);

    sf::Text label2("Marquee", font);
    label2.setColor(sf::Color::Black);
    label2.setPosition(rect2.getPosition().x + rect2.getSize().x / 2 - label2.getLocalBounds().width / 2, rect2.getPosition().y + rect2.getSize().y / 2 - label2.getLocalBounds().height / 2 - 10);

    sf::Text label3("Color Cycle", font);
    label3.setColor(sf::Color::Black);
    label3.setPosition(rect3.getPosition().x + rect3.getSize().x / 2 - label3.getLocalBounds().width / 2, rect3.getPosition().y + rect3.getSize().y / 2 - label3.getLocalBounds().height / 2 - 10);

    sf::Text label4("Pew", font);
    label4.setColor(sf::Color::Black);
    label4.setPosition(rect4.getPosition().x + rect4.getSize().x / 2 - label4.getLocalBounds().width / 2, rect4.getPosition().y + rect4.getSize().y / 2 - label4.getLocalBounds().height / 2 - 10);


    unsigned short r = 0,
                   g = 0,
                   b = 0;

    logger.continueln(" done!");

    logger.log("Running until told to stop.");
    bool running = true;
    while(running){
        sf::Event event;
        while (window.pollEvent(event)){
            if (event.type == sf::Event::Closed){
                running = false;
            } else if (event.type == sf::Event::MouseMoved){
                doMouseMove();
            } else if (event.type == sf::Event::MouseButtonPressed || event.type == sf::Event::MouseButtonReleased){
                doMouseButton(event.mouseButton.button);
            }
        }
        window.clear(sf::Color::White);
        window.draw(rect1);
        window.draw(rect2);
        window.draw(rect3);
        window.draw(rect4);
        window.draw(label1);
        window.draw(label2);
        window.draw(label3);
        window.draw(label4);
        window.display();
    }

    logger.log("Closing...");
}