예제 #1
0
void Plot::loadSVG()
{
    QString dir;
    const QString fileName = QFileDialog::getOpenFileName( NULL,
        "Load a Scaleable Vector Graphic (SVG) Map",
        dir, "SVG Files (*.svg)");

    if ( !fileName.isEmpty() )
        loadSVG(fileName);
}
예제 #2
0
void MainWindow::loadSVG()
{
    QString dir = "/home1/uwe/qwt/qwt/tests/svg";
    const QString fileName = QFileDialog::getOpenFileName( NULL,
        "Load a Scaleable Vector Graphic (SVG) Document",
        dir, "SVG Files (*.svg)" );

    if ( !fileName.isEmpty() )
        loadSVG( fileName );

    statusBar()->showMessage( fileName );
}
예제 #3
0
MainWindow::MainWindow()
{
    QWidget *w = new QWidget( this );

    d_canvas[0] = new Canvas( Canvas::Svg, this );
    d_canvas[0]->setAutoFillBackground( true );
    d_canvas[0]->setPalette( Qt::gray );

    d_canvas[1] = new Canvas( Canvas::VectorGraphic, this );
    d_canvas[1]->setAutoFillBackground( true );
    d_canvas[1]->setPalette( Qt::gray );

    QVBoxLayout *vBox1 = new QVBoxLayout();
    vBox1->setContentsMargins( 0, 0, 0, 0 );
    vBox1->setSpacing( 5 );
    vBox1->addWidget( new QLabel( "SVG" ), 0, Qt::AlignCenter );
    vBox1->addWidget( d_canvas[0], 10 );

    QVBoxLayout *vBox2 = new QVBoxLayout();
    vBox2->setContentsMargins( 0, 0, 0, 0 );
    vBox2->setSpacing( 5 );
    vBox2->addWidget( new QLabel( "Vector Graphic" ), 0, Qt::AlignCenter );
    vBox2->addWidget( d_canvas[1], 10 );

    QHBoxLayout *layout = new QHBoxLayout( w );
    layout->addLayout( vBox1 );
    layout->addLayout( vBox2 );

    setCentralWidget( w );

    QToolBar *toolBar = new QToolBar( this );

    QToolButton *btnLoad = new QToolButton( toolBar );

    btnLoad->setText( "Load SVG" );
    btnLoad->setToolButtonStyle( Qt::ToolButtonTextUnderIcon );
    toolBar->addWidget( btnLoad );

    addToolBar( toolBar );

    connect( btnLoad, SIGNAL( clicked() ), this, SLOT( loadSVG() ) );

#if 0
    QPainterPath path;
    path.addRect( QRectF( 1.0, 1.0, 2.0, 2.0 ) );
    loadPath( path );
#endif
};
예제 #4
0
bool Layout::loadLayoutFiles(string dataPath, string infoPath) {
    printf("loadLayoutFiles\n");
    this->dataPath = dataPath;
    this->infoPath = infoPath;

    if (loadInfo(dataPath + infoPath)) {
        if (loadSVG(dataPath + svgPath)) {
            printf("loaded layout %s\n", layoutName.c_str());
            return true;
        } else {
            printf("ERR: failed to load svg from %s\n", svgPath.c_str());
        }
    } else {
        printf("ERR: failed to load info from %s\n", infoPath.c_str());
    }


    return false;
}
예제 #5
0
    MainWindow(const QString &fileName)
    {   
        Plot *plot = new Plot(this);
        if ( !fileName.isEmpty() )
            plot->loadSVG(fileName);
            
        setCentralWidget(plot);

#ifndef QT_NO_FILEDIALOG

        QToolBar *toolBar = new QToolBar(this);

        QToolButton *btnLoad = new QToolButton(toolBar);
        
        btnLoad->setText("Load SVG");
        btnLoad->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        toolBar->addWidget(btnLoad);

        addToolBar(toolBar);

        connect(btnLoad, SIGNAL(clicked()), plot, SLOT(loadSVG())); 
#endif
    }