コード例 #1
0
void MainWindow::onShowContentSmartButtonClicked()
{
    Opc::PackagePart *part = m_package->part(ui->partNameEdit->text());
    if (!part)
        return;

    if (ui->partContentSmartButton->property("smart") == "xml") {
        //Show formatted xml file contents
        MceXmlWidget *edit = new MceXmlWidget(part->getDevice()->readAll());
        part->releaseDevice();

        edit->setAttribute(Qt::WA_DeleteOnClose);
        edit->setWindowTitle(part->partName());
        edit->resize(800, 600);
        edit->show();
    } else if (ui->partContentSmartButton->property("smart") == "image") {
        //Show image
        ImageWidget *edit = new ImageWidget;
        edit->setAttribute(Qt::WA_DeleteOnClose);
        edit->setWindowTitle(part->partName());
        QImage image = QImage::fromData(part->getDevice()->readAll());
        part->releaseDevice();

        edit->setPixmap(QPixmap::fromImage(image));
        edit->resize(800, 600);
        edit->show();
    }
}
コード例 #2
0
ファイル: main.cpp プロジェクト: raaymax/Vis
int main(int argc, char** argv)
{
    QApplication app(argc, argv);
    MainWindow mw;
    mw.show();
#if 0
    try {
        ImageSource * src;

        src = new ImageSource("test.jpg");


        Image img = src->getImage();
        FilterManager<CpuGrayFilter> filterCPU;
        filterCPU.process(img);
        std::cout<< "filter CPU time:" << filterCPU.getTime().total_microseconds() <<"us"<< std::endl;
        ImageWidget foo;
        foo.setImage(img);
        foo.setWindowTitle("Vis - CPU");
        foo.show();

#ifdef USE_CUDA
        Image img2 = src->getImage();
        FilterManager<GpuGrayFilter> filterGPU;
        filterGPU.process(img2);
        std::cout<< "filter GPU time:" << filterGPU.getTime().total_microseconds()<<"us" << std::endl;
        ImageWidget foo2;
        foo2.setImage(img2);
        foo2.setWindowTitle("Vis - GPU");
        foo2.show();
#endif

    } catch(IException & ex) {
        std::cout <<ex.getMessage().toStdString() << std::endl;
        return 1;
    }
#endif
    return app.exec();
}