Пример #1
0
//! [9]
QPushButton *Screenshot::createButton(const QString &text, QWidget *receiver,
                                      const char *member)
{
    QPushButton *button = new QPushButton(text);
    button->connect(button, SIGNAL(clicked()), receiver, member);
    return button;
}
Пример #2
0
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    QDialog w;
    w.setWindowTitle("Reboot into:");
    QVBoxLayout layout;
    efi_init();
    reboot_init();
    uint16_t *data;
    int l = boot_entry_list(&data);
    for (int i = 0; i < l; i++) {
        QPushButton *button = new QPushButton(QString(boot_entry_name(data[i])));
        layout.addWidget(button);
        button->connect(button, &QPushButton::clicked, [=]() {
            set_boot_next(data[i]);
            do_reboot();
        });
    }
    w.setLayout(&layout);
    w.show();
    return a.exec();
}
Пример #3
0
void DevConsole::logToConsole(const QString &logText, const QString &channel, bool raise)
{
    QString target_channel = channel;

    if(channel == "System") //Prevent creation another "system" tab if switched another UI language
        target_channel = ui->tabWidget->tabText(0);

    for(int i = 0; i < ui->tabWidget->count(); ++i)
    {
        if(ui->tabWidget->tabText(i) == target_channel)
        {
            QPlainTextEdit *tarEdit = getEditByIndex(i);
            if(!tarEdit)
                return;
            tarEdit->appendPlainText(logText);
            tarEdit->verticalScrollBar()->setValue(tarEdit->verticalScrollBar()->maximum());
            if(raise) ui->tabWidget->setCurrentIndex(i);
            return;
        }
    }
    //create new channel
    QWidget *w = new QWidget();
    QGridLayout *l = new QGridLayout(w);
    l->setContentsMargins(0, 0, 0, 0);
    l->setSpacing(0);
    QPlainTextEdit *e = new QPlainTextEdit(w);
    l->addWidget(e, 0, 0, 1, 1);
    QPushButton *p = new QPushButton(w);
    l->addWidget(p, 1, 0, 1, 1);
    p->setFlat(true);
    p->connect(p, SIGNAL(clicked()), this, SLOT(clearCurrentLog()));
    p->setText(tr("Clear %1 Log").arg(target_channel));
    e->setReadOnly(true);
    e->setStyleSheet(ui->plainTextEdit->styleSheet());
    e->setFont(ui->plainTextEdit->font());
    e->appendPlainText(logText);
    e->verticalScrollBar()->setValue(e->verticalScrollBar()->maximum());
    ui->tabWidget->addTab(w, target_channel);
}
Пример #4
0
int main(int argc, char **argv)
{
    QString fileName{ "C:/develop/$sync/GFZ/data/VTK XML data/Volcano 2 topo.vtp" };

    auto data = Loader::readFile(fileName);

    QApplication app(argc, argv);
    QMainWindow window;
    window.show();

    DataSetHandler dataSetHandler;
    DataMapping dataMapping(dataSetHandler);

    RenderView renderView(dataMapping, -1);
    window.addDockWidget(Qt::TopDockWidgetArea, renderView.dockWidgetParent());
    app.setActiveWindow(&renderView);

    RenderConfigWidget renderConfig;
    renderConfig.setCurrentRenderView(&renderView);
    renderConfig.show();

    RendererConfigWidget rendererConfig;
    rendererConfig.setCurrentRenderView(&renderView);
    rendererConfig.show();

    ColorMappingChooser colorMapping;
    colorMapping.setCurrentRenderView(&renderView);
    colorMapping.show();

    GlyphMappingChooser glyphs;
    glyphs.setCurrentRenderView(&renderView);
    glyphs.show();


    QPushButton button;
    button.connect(&button, &QPushButton::clicked, [&renderView, &data] (){
        QList<DataObject *> incomp;
        renderView.showDataObjects({ data.get() }, incomp);
    });
    button.show();

    QPushButton exitButton("quit");
    exitButton.connect(&exitButton, &QPushButton::clicked, &app, &QApplication::quit);
    exitButton.show();

    return app.exec();

    /*auto renderer = vtkSmartPointer<vtkRenderer>::New();
    renderer->SetBackground(0.7, 0.7, 0.7);

    QScopedPointer<RenderedData> rendered{ data->createRendered() };

    rendered->viewProps()->InitTraversal();
    while (auto && it = rendered->viewProps()->GetNextProp())
    {
        renderer->AddViewProp(it);
    }

    auto renderWindow = vtkSmartPointer<vtkRenderWindow>::New();
    renderWindow->AddRenderer(renderer);

    auto rwInteractor = vtkSmartPointer<vtkRenderWindowInteractor>::New();
    rwInteractor->SetRenderWindow(renderWindow);

    rwInteractor->Start();


    return 0;*/
}