Exemplo n.º 1
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{

    ui->setupUi(this);

    // menubar incantation
    QMenu *fileMenu = new QMenu(tr("&File"), this);
    menuBar()->addMenu(fileMenu);
    QAction *quitAction = fileMenu->addAction(tr("E&xit"));
    quitAction->setShortcuts(QKeySequence::Quit);
    connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));




    //probably a better way to place the widget, but i'm using a layout for now
    QGridLayout *layout = new QGridLayout;
    QTimer *timer = new QTimer(this);
    //build the animated eclipse object
    Animated_Points eclipse(0,(new Generated_Ellipse(0,100,0,100,500))->get_points(), 500, 5);

    layout->addWidget(&eclipse, 0,0);
    connect(timer,SIGNAL(timeout()),&eclipse,SLOT(nextAnimationFrame()));

    QAction *updateAction = fileMenu->addAction(tr("&Update"));
    connect(updateAction, SIGNAL(triggered()), &eclipse, SLOT(nextAnimationFrame()));

    timer->start(100);
    setLayout(layout);
    setWindowTitle(tr("AnimatedEllipses"));
}
Exemplo n.º 2
0
//! [0]
Window::Window()
{
    aliasedLabel = createLabel(tr("Aliased"));
    antialiasedLabel = createLabel(tr("Antialiased"));
    intLabel = createLabel(tr("Int"));
    floatLabel = createLabel(tr("Float"));

    QGridLayout *layout = new QGridLayout;
    layout->addWidget(aliasedLabel, 0, 1);
    layout->addWidget(antialiasedLabel, 0, 2);
    layout->addWidget(intLabel, 1, 0);
    layout->addWidget(floatLabel, 2, 0);
//! [0]

//! [1]
    QTimer *timer = new QTimer(this);

    for (int i = 0; i < 2; ++i) {
        for (int j = 0; j < 2; ++j) {
            circleWidgets[i][j] = new CircleWidget;
            circleWidgets[i][j]->setAntialiased(j != 0);
            circleWidgets[i][j]->setFloatBased(i != 0);

            connect(timer, SIGNAL(timeout()),
                    circleWidgets[i][j], SLOT(nextAnimationFrame()));

            layout->addWidget(circleWidgets[i][j], i + 1, j + 1);
        }
    }
//! [1] //! [2]
    timer->start(100);
    setLayout(layout);

    setWindowTitle(tr("Concentric Circles"));
}
Exemplo n.º 3
0
ShapesDialog::ShapesDialog()
    :   timer(this), dp_(DDS::DOMAIN_ID_DEFAULT)
{
    mainWidget.setupUi(this);
    shapesWidget = new ShapesWidget(mainWidget.renderFrame);
    shapesWidget->resize(mainWidget.renderFrame->size());
    filterDialog_ = new FilterDialog(shapesWidget);
    connect(&timer, SIGNAL(timeout()),
            shapesWidget, SLOT(nextAnimationFrame()));

    color_[BLUE] = QColor(0x33, 0x66, 0x99);
    color_[RED] = QColor(0xCC, 0x33, 0x33);
    color_[GREEN] = QColor(0x99, 0xCC, 0x66);
    color_[ORANGE] = QColor(0xFF, 0x99, 0x33);
    color_[YELLOW] = QColor(0xFF, 0xFF, 0x66);
    color_[MAGENTA] = QColor(0xCC, 0x99, 0xCC);
    color_[CYAN] = QColor(0x99, 0xCC, 0xFF);
    color_[GRAY] = QColor(0x99, 0x99, 0x99);
    color_[BLACK] = QColor(0x33, 0x33, 0x33);
    timer.start(40);
}