本文整理汇总了C++中QDeclarativeView::resize方法的典型用法代码示例。如果您正苦于以下问题:C++ QDeclarativeView::resize方法的具体用法?C++ QDeclarativeView::resize怎么用?C++ QDeclarativeView::resize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDeclarativeView
的用法示例。
在下文中一共展示了QDeclarativeView::resize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char **argv)
{
QApplication app(argc, argv);
gst_init(&argc, &argv);
ges_init();
registerTypes();
QDeclarativeView view;
QGLWidget *g = new QGLWidget;
view.setViewport(g);
createGLSurface("timelineSurface", &view);
createGLSurface("editorSurface", &view);
view.setSource(QUrl::fromLocalFile("Timeline.qml"));
view.setResizeMode(QDeclarativeView::SizeRootObjectToView);
view.resize(640, 480);
view.show();
if (!QDir::current().exists("media")) {
qDebug () << "Media files missing. Download them by running './download.sh'";
return -1;
}
QObject::connect((QObject*)view.engine(), SIGNAL(quit()), &app, SLOT(quit()));
return app.exec();
}
示例2: QMainWindow
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, plot_(0)
, zoomer_( 0 )
, picker_( 0 )
, panner_( 0 )
, pMethod_( 0 )
, pModel_( 0 )
{
plot_ = new Plot(this);
setCentralWidget(plot_);
zoomer_ = new QwtPlotZoomer( QwtPlot::xBottom, QwtPlot::yLeft, plot_->canvas() );
zoomer_->setMousePattern( QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlModifier );
zoomer_->setMousePattern( QwtEventPattern::MouseSelect3, Qt::RightButton );
zoomer_->setRubberBand( QwtPicker::RectRubberBand );
pMethod_ = new adcontrols::CentroidMethod;
pModel_ = new CentroidMethodModel;
int res = qmlRegisterType< CentroidMethodModel >( "com.scienceliaison.qml", 1, 0, "CentroidModel" );
QDeclarativeView * view = new QDeclarativeView;
view->setResizeMode(QDeclarativeView::SizeRootObjectToView);
QDeclarativeContext * ctxt = view->rootContext();
ctxt->setContextProperty( "centroidModel", pModel_ );
//view->setSource( QUrl::fromLocalFile( "qml/ProcessMethodEditor.qml" ) );
view->setSource( QUrl( "qrc:/files/qml/ProcessMethodEditor.qml") );
QList< QDeclarativeError> errors = view->errors();
for ( QList<QDeclarativeError>::const_iterator it = errors.begin(); it != errors.end(); ++it )
QMessageBox::warning( parent, "QDeclarativeError", it->description() );
view->setMinimumSize( 200, 250 );
view->resize( QSize( 200, 350 ) );
QDockWidget * dock = new QDockWidget;
dock->setWidget( view );
addDockWidget ( Qt::BottomDockWidgetArea, dock );
draw_spectrum();
}
示例3: main
//.........这里部分代码省略.........
} else {
qDebug("Messageserver is already running.");
}
SettingsAdapter().setFastScrollAnchor("right");
#endif
#ifdef BB10_BUILD
QProcess messageServerProcess;
qDebug("Starting messageserver...");
messageServerProcess.start("app/native/lib/qmf/bin/messageserver");
#endif
qmlRegisterType<Entry>("meepasswords", 1, 0, "Entry");
qmlRegisterType<EntryListModel>("meepasswords", 1, 0, "EntryListModel");
qmlRegisterType<EntrySortFilterProxyModel>("meepasswords", 1, 0, "EntrySortFilterProxyModel");
qmlRegisterType<EntryStorage>("meepasswords", 1, 0, "EntryStorage");
#ifdef SYNC_TO_IMAP_SUPPORT
qmlRegisterType<FileHelper>("SyncToImap", 1, 0, "FileHelper");
qmlRegisterType<ImapAccountHelper>("SyncToImap", 1, 0, "ImapAccountHelper");
qmlRegisterType<ImapAccountListModel>("SyncToImap", 1, 0, "ImapAccountListModel");
qmlRegisterType<ImapStorage>("SyncToImap", 1, 0, "ImapStorage");
#endif
#ifdef NFC_ENABLED
qmlRegisterType<NfcTagWriter>("meepasswords", 1, 0, "NfcTagWriter");
#endif
qmlRegisterType<QmlClipboardAdapter>("meepasswords", 1, 0, "QClipboard");
qmlRegisterType<SettingsAdapter>("meepasswords", 1, 0, "SettingsAdapter");
/*
* Well, according to
* http://doc.qt.nokia.com/4.7-snapshot/qdeclarativeperformance.html
* the following shall help increasing the performance.
* However, painting on a QGLWidget resulted in a major performance loss,
* at least on an N900 using the experimental Qt version.
*/
#if ! defined(BB10_BUILD) && ! defined(QT5_BUILD)
view->setAttribute(Qt::WA_OpaquePaintEvent);
view->setAttribute(Qt::WA_NoSystemBackground);
view->viewport()->setAttribute(Qt::WA_OpaquePaintEvent);
view->viewport()->setAttribute(Qt::WA_NoSystemBackground);
#endif
#ifdef QT5_BUILD
//TODO
app->setApplicationName("MeePasswords");
app->setApplicationDisplayName("MeePasswords");
#else
view->setWindowTitle("MeePasswords");
#endif
#if defined(MEEGO_EDITION_HARMATTAN)
// Hack to automatically copy the data from an old installation.
if (!FileHelper().exists("/home/user/.local/share/data/ruedigergad.com/meepasswords/encrypted.raw")
&& FileHelper().exists("/home/user/.local/share/data/MeePasswords_DefaultStorage/encrypted.raw")) {
qDebug("Copying old storage.");
FileHelper().mkdir("/home/user/.local/share/data/ruedigergad.com/meepasswords");
FileHelper().cp("/home/user/.local/share/data/MeePasswords_DefaultStorage/encrypted.raw", "/home/user/.local/share/data/ruedigergad.com/meepasswords/encrypted.raw");
}
view->setSource(QUrl("qrc:/qml/harmattan/main2.qml"));
view->showFullScreen();
#elif defined(QT_SIMULATOR)
view->setSource(QUrl("qrc:/qml/harmattan/main.qml"));
view->showFullScreen();
#elif defined(BB10_BUILD)
view->setViewport(new QGLWidget());
view->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
view->setSource(QUrl("qrc:/qml/bb10/main.qml"));
view->setResizeMode(QDeclarativeView::SizeRootObjectToView);
view->showMaximized();
#elif defined(QT5_BUILD)
view->setResizeMode(QQuickView::SizeRootObjectToView);
view->setSource(QUrl("qrc:/qml/qtquick2/main.qml"));
view->resize(400, 500);
view->show();
#else
view->setResizeMode(QDeclarativeView::SizeRootObjectToView);
view->setSource(QUrl("qrc:/qml/desktop/main.qml"));
view->resize(400, 500);
view->show();
#endif
int ret = app->exec();
#if defined(LINUX_DESKTOP) || defined(WINDOWS_DESKTOP)
if (messageServerStarted) {
qDebug("Stopping messageserver...");
messageServerProcess.kill();
}
#endif
#ifdef BB10_BUILD
qDebug("Stopping messageserver...");
messageServerProcess.kill();
#endif
return ret;
}