本文整理汇总了C++中QtQuick2ApplicationViewer::setMinimumSize方法的典型用法代码示例。如果您正苦于以下问题:C++ QtQuick2ApplicationViewer::setMinimumSize方法的具体用法?C++ QtQuick2ApplicationViewer::setMinimumSize怎么用?C++ QtQuick2ApplicationViewer::setMinimumSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QtQuick2ApplicationViewer
的用法示例。
在下文中一共展示了QtQuick2ApplicationViewer::setMinimumSize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
qmlRegisterType<PieChart>("Charts", 1, 0, "PieChart");
qmlRegisterType<PieSlice>("Charts", 1, 0, "PieSlice");
Configuration m_configuration;
SerialLink m_serialLink;
MavLinkManager m_mavlink_manager;
LinkManager m_gLinkManager;
QtQuick2ApplicationViewer viewer;
QtQuick2ApplicationViewer splashscreen;
QString customPath = "Sqlite/OfflineStorage";
QDir dir;
if(dir.mkpath(QString(customPath))){
// qDebug() << "Default path >> "+viewer.engine()->offlineStoragePath();
viewer.engine()->setOfflineStoragePath(QString(customPath));
// qDebug() << "New path >> "+viewer.engine()->offlineStoragePath();
}
// using as normal
// viewer.setMainQmlFile(QStringLiteral("qml/gStabiSC/main.qml"));
// using qml files form resources file, uncomment this to compile all qml file to .exe
splashscreen.setSource(QUrl("qrc:/qml/gStabiSC/GSplashScreen.qml"));
splashscreen.setFlags(Qt::FramelessWindowHint);
splashscreen.setMinimumSize(QSize(1000,500));
splashscreen.show();
viewer.setSource(QUrl("qrc:/qml/gStabiSC/GMain.qml"));
viewer.setTitle(QString("%1 %2").arg(APPLICATION_NAME).arg(APPLICATION_VERSION));
viewer.setMinimumSize(QSize(APPLICATION_WIDTH,APPLICATION_HEIGHT));
viewer.setMaximumSize(QSize(APPLICATION_WIDTH,APPLICATION_HEIGHT));
// viewer.addImportPath("qrc:/qml/gStabiSC");
// viewer.addImportPath("qrc:/qml/gStabiSC/Components");
// viewer.addImportPath("qrc:/qml/gStabiSC/GDashboard");
// viewer.addImportPath("qrc:/javascript/storage.js");
viewer.rootContext()->setContextProperty("_configuration",&m_configuration);
viewer.rootContext()->setContextProperty("_serialLink", &m_serialLink);
viewer.rootContext()->setContextProperty("_mavlink_manager", &m_mavlink_manager);
m_gLinkManager.connectLink(&m_serialLink,&m_mavlink_manager);
QTimer::singleShot(3000, &splashscreen, SLOT(close()));
QTimer::singleShot(3000, &viewer, SLOT(show()));
return app.exec();
}
示例2: main
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QByteArray applicationName;
applicationName = QFileInfo(QCoreApplication::applicationFilePath()).fileName().toUtf8();
qputenv("APP_ID", applicationName);
qmlRegisterType<WhiteListItem>("Ubuntu.Checkbox", 0, 1, "WhiteListItem");
qmlRegisterType<TestItem>("Ubuntu.Checkbox", 0, 1, "TestItem");
QtQuick2ApplicationViewer viewer;
// Create our GuiEngine and hang it on QGuiApplication
GuiEngine guiengine((QObject*)&app);
// Register the applicationName with the QML runtime
viewer.rootContext()->setContextProperty("applicationName", applicationName);
// Register the GuiEngine with the QML runtime
viewer.rootContext()->setContextProperty("guiEngine", &guiengine);
// Initialise - connect to Plainbox
guiengine.Initialise();
// WhiteList Item Model Factory and placeholder model registered with QML engine
WhiteListModelFactory whitelistfactory;
viewer.rootContext()->setContextProperty("whitelistitemFactory",&whitelistfactory);
/* We need a placeholder object here or the QML integration is unhappy
* that this isnt a recognisable Qt object.
*/
ListModel* whitelistmodel = new ListModel(new WhiteListItem, qApp);
if (!whitelistmodel) {
// Essentially we are likely out of memory here
qDebug("Cannot create whitelist model");
exit(1);
}
viewer.rootContext()->setContextProperty("whiteListModel", whitelistmodel);
// Test Item Model Factory and placeholder model registered with QML engine
TestItemModel testitemFactory;
viewer.rootContext()->setContextProperty("testitemFactory",&testitemFactory);
/* We need a placeholder object here or the QML integration is unhappy
* that this isnt a recognisable Qt object.
*/
ListModel* testlistmodel = new ListModel(new TestItem, qApp); //CreateTestListModel();
if (!testlistmodel) {
// Essentially we are likely out of memory here
qDebug("Cannot create testlist model");
exit(1);
}
viewer.rootContext()->setContextProperty("testListModel", testlistmodel);
// We may not need this at all
CommandTool cmdTool;
viewer.rootContext()->setContextProperty("cmdTool", &cmdTool);
// In the beginning, lets see if we need to resume
bool resumeSession = false;
QString previous = guiengine.GuiPreviousSessionFile();
if ( previous.isEmpty() ) {
// Show the Welcome screen
} else {
// show the resume screen
qDebug() << "Resume session file : " << previous;
resumeSession = true;
}
viewer.rootContext()->setContextProperty("resumePreviousSession",resumeSession);
// Now, load the main page
viewer.setMainQmlFile(QStringLiteral("../share/checkbox-gui/qml/checkbox-gui.qml"));
viewer.setTitle(app.tr("System Testing"));
// Ensure a reasonable minimum size for this window
viewer.setMinimumSize(QSize(800,600));
viewer.showExpanded();
int errcode = app.exec();
// Shutdown the guiengine
guiengine.Shutdown();
return errcode;
//.........这里部分代码省略.........