コード例 #1
0
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    QDir::setCurrent(QCoreApplication::applicationDirPath());
    QDir dir(QDir::current());

    // set the slide model.
    QFile xmlf(dir.absoluteFilePath("userdata/test.xml"));
    if (!xmlf.exists()) {
        QMessageBox::critical(0, "error", "no xml file...");
        return 0;
    }
    xmlf.open(QFile::ReadWrite);
    QSlideModel model(xmlf.readAll());
    xmlf.close();


    // set the slide scene
    QSlidePlayerScene *scene = new QSlidePlayerScene(0, &model);
    QPixmap pixmap(dir.absoluteFilePath("res/images/default-background.png"));
    scene->setBackgroundBrush(Qt::black);
    scene->setBackgroundPixmap(pixmap);

    //set slide view
    QGraphicsView *view = new QGraphicsView(scene);

    view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    view->setFrameShape(QFrame::NoFrame);
    // editing is not allowed.
    view->setInteractive(false);

    // scale
    double newScale = QApplication::desktop()->height() / scene->sceneRect().height();
    QMatrix oldMatrix = view->matrix();
    view->resetMatrix();
    view->translate(oldMatrix.dx(), oldMatrix.dy());
    view->scale(newScale, newScale);

    view->showFullScreen();

    QHidDevice * test = new QHidDevice(0x55, 0x32, &a);

    return a.exec();
}
コード例 #2
0
ファイル: graphicsView.cpp プロジェクト: rforge/qtinterfaces
SEXP qt_qmatrix_QGraphicsView(SEXP extp, SEXP inverted)
{
  QGraphicsView *view = unwrapQObject(extp, QGraphicsView);
  return asRMatrix(view->matrix(), asLogical(inverted));
}