How to make full screen
-
I am working on an open source project. When I opened the project on the tablet, it first took up the whole screen. I threw format on the tablet and installed windows 10 myself, this time the application does not open in full screen
When you look at the QT codes, if it is mobile or if the screen is small, it takes full screen mode, although I close this part on the qml side, it does not cover the entire screen.
I'll post the codes as comments.
thank you in advance for the help -
I am working on an open source project. When I opened the project on the tablet, it first took up the whole screen. I threw format on the tablet and installed windows 10 myself, this time the application does not open in full screen
When you look at the QT codes, if it is mobile or if the screen is small, it takes full screen mode, although I close this part on the qml side, it does not cover the entire screen.
I'll post the codes as comments.
thank you in advance for the help@serkan_tr main.cpp
int main(int argc, char *argv[]) { rclcpp::init(argc, argv); #ifndef __mobile__ QString runguardString(QGC_APPLICATION_NAME); runguardString.append("RunGuardKey"); RunGuard guard(runguardString); if (!guard.tryToRun()) { // QApplication is necessary to use QMessageBox QApplication errorApp(argc, argv); QMessageBox::critical(nullptr, QObject::tr("Error"), QObject::tr("A second instance of %1 is already running. Please close the other instance and try again.").arg(QGC_APPLICATION_NAME) ); return -1; } #endif //-- Record boot time QGC::initTimer(); #ifdef Q_OS_UNIX //Force writing to the console on UNIX/BSD devices if (!qEnvironmentVariableIsSet("QT_LOGGING_TO_CONSOLE")) qputenv("QT_LOGGING_TO_CONSOLE", "1"); #endif // install the message handler AppMessages::installHandler(); #ifdef Q_OS_WIN // Set our own OpenGL buglist qputenv("QT_OPENGL_BUGLIST", ":/opengl/resources/opengl/buglist.json"); // Allow for command line override of renderer for (int i = 0; i < argc; i++) { const QString arg(argv[i]); if (arg == QStringLiteral("-angle")) { QCoreApplication::setAttribute(Qt::AA_UseOpenGLES); break; } else if (arg == QStringLiteral("-swrast")) { QCoreApplication::setAttribute(Qt::AA_UseSoftwareOpenGL); break; } } #endif #ifndef NO_SERIAL_LINK qRegisterMetaType<QSerialPort::SerialPortError>(); #endif #ifdef QGC_ENABLE_BLUETOOTH qRegisterMetaType<QBluetoothSocket::SocketError>(); qRegisterMetaType<QBluetoothServiceInfo>(); #endif qRegisterMetaType<QAbstractSocket::SocketError>(); qRegisterMetaType<Vehicle::MavCmdResultFailureCode_t>("Vehicle::MavCmdResultFailureCode_t"); // We statically link our own QtLocation plugin #ifdef Q_OS_WIN // In Windows, the compiler doesn't see the use of the class created by Q_IMPORT_PLUGIN #pragma warning( disable : 4930 4101 ) #endif Q_IMPORT_PLUGIN(QGeoServiceProviderFactoryQGC) bool runUnitTests = false; // Run unit tests QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); QGCApplication* app = new QGCApplication(argc, argv, runUnitTests); Q_CHECK_PTR(app); if(app->isErrorState()) { app->exec(); return -1; } // #ifdef Q_OS_LINUX QApplication::setWindowIcon(QIcon(":/res/resources/icons/qgroundcontrol.ico")); getQGCMapEngine()->init(); qRegisterMetaType<QList<QPair<QByteArray,QByteArray> > >(); app->_initCommon(); int exitCode = 0; { #ifdef UNITTEST_BUILD if (runUnitTests) { for (int i=0; i < (stressUnitTests ? 20 : 1); i++) { if (!app->_initForUnitTests()) { return -1; } // Run the test int failures = UnitTest::run(unitTestOptions); if (failures == 0) { qDebug() << "ALL TESTS PASSED"; exitCode = 0; } else { qDebug() << failures << " TESTS FAILED!"; exitCode = -failures; break; } } } else #endif } { #ifdef __android__ checkAndroidWritePermission(); #endif if (!app->_initForNormalAppBoot()) { return -1; } exitCode = app->exec(); } app->_shutdown(); delete app; //-- Shutdown Cache System destroyMapEngine(); rclcpp::shutdown(); qDebug() << "After app delete"; return exitCode; }
-
@serkan_tr main.cpp
int main(int argc, char *argv[]) { rclcpp::init(argc, argv); #ifndef __mobile__ QString runguardString(QGC_APPLICATION_NAME); runguardString.append("RunGuardKey"); RunGuard guard(runguardString); if (!guard.tryToRun()) { // QApplication is necessary to use QMessageBox QApplication errorApp(argc, argv); QMessageBox::critical(nullptr, QObject::tr("Error"), QObject::tr("A second instance of %1 is already running. Please close the other instance and try again.").arg(QGC_APPLICATION_NAME) ); return -1; } #endif //-- Record boot time QGC::initTimer(); #ifdef Q_OS_UNIX //Force writing to the console on UNIX/BSD devices if (!qEnvironmentVariableIsSet("QT_LOGGING_TO_CONSOLE")) qputenv("QT_LOGGING_TO_CONSOLE", "1"); #endif // install the message handler AppMessages::installHandler(); #ifdef Q_OS_WIN // Set our own OpenGL buglist qputenv("QT_OPENGL_BUGLIST", ":/opengl/resources/opengl/buglist.json"); // Allow for command line override of renderer for (int i = 0; i < argc; i++) { const QString arg(argv[i]); if (arg == QStringLiteral("-angle")) { QCoreApplication::setAttribute(Qt::AA_UseOpenGLES); break; } else if (arg == QStringLiteral("-swrast")) { QCoreApplication::setAttribute(Qt::AA_UseSoftwareOpenGL); break; } } #endif #ifndef NO_SERIAL_LINK qRegisterMetaType<QSerialPort::SerialPortError>(); #endif #ifdef QGC_ENABLE_BLUETOOTH qRegisterMetaType<QBluetoothSocket::SocketError>(); qRegisterMetaType<QBluetoothServiceInfo>(); #endif qRegisterMetaType<QAbstractSocket::SocketError>(); qRegisterMetaType<Vehicle::MavCmdResultFailureCode_t>("Vehicle::MavCmdResultFailureCode_t"); // We statically link our own QtLocation plugin #ifdef Q_OS_WIN // In Windows, the compiler doesn't see the use of the class created by Q_IMPORT_PLUGIN #pragma warning( disable : 4930 4101 ) #endif Q_IMPORT_PLUGIN(QGeoServiceProviderFactoryQGC) bool runUnitTests = false; // Run unit tests QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); QGCApplication* app = new QGCApplication(argc, argv, runUnitTests); Q_CHECK_PTR(app); if(app->isErrorState()) { app->exec(); return -1; } // #ifdef Q_OS_LINUX QApplication::setWindowIcon(QIcon(":/res/resources/icons/qgroundcontrol.ico")); getQGCMapEngine()->init(); qRegisterMetaType<QList<QPair<QByteArray,QByteArray> > >(); app->_initCommon(); int exitCode = 0; { #ifdef UNITTEST_BUILD if (runUnitTests) { for (int i=0; i < (stressUnitTests ? 20 : 1); i++) { if (!app->_initForUnitTests()) { return -1; } // Run the test int failures = UnitTest::run(unitTestOptions); if (failures == 0) { qDebug() << "ALL TESTS PASSED"; exitCode = 0; } else { qDebug() << failures << " TESTS FAILED!"; exitCode = -failures; break; } } } else #endif } { #ifdef __android__ checkAndroidWritePermission(); #endif if (!app->_initForNormalAppBoot()) { return -1; } exitCode = app->exec(); } app->_shutdown(); delete app; //-- Shutdown Cache System destroyMapEngine(); rclcpp::shutdown(); qDebug() << "After app delete"; return exitCode; }
@serkan_tr QGCApplication.cpp
class FinishVideoInitialization : public QRunnable { public: FinishVideoInitialization(VideoManager* manager) : _manager(manager) {} void run () { _manager->_initVideo(); } private: VideoManager* _manager; }; QGCApplication* QGCApplication::_app = nullptr; const char* QGCApplication::_deleteAllSettingsKey = "DeleteAllSettingsNextBoot"; const char* QGCApplication::_settingsVersionKey = "SettingsVersion"; // Mavlink status structures for entire app mavlink_status_t m_mavlink_status[MAVLINK_COMM_NUM_BUFFERS]; // Qml Singleton factories static QObject* screenToolsControllerSingletonFactory(QQmlEngine*, QJSEngine*) { ScreenToolsController* screenToolsController = new ScreenToolsController; return screenToolsController; } static QObject* mavlinkSingletonFactory(QQmlEngine*, QJSEngine*) { return new QGCMAVLink(); } static QObject* qgroundcontrolQmlGlobalSingletonFactory(QQmlEngine*, QJSEngine*) { // We create this object as a QGCTool even though it isn't in the toolbox QGroundControlQmlGlobal* qmlGlobal = new QGroundControlQmlGlobal(qgcApp(), qgcApp()->toolbox()); qmlGlobal->setToolbox(qgcApp()->toolbox()); return qmlGlobal; } static QObject* shapeFileHelperSingletonFactory(QQmlEngine*, QJSEngine*) { return new ShapeFileHelper; } QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting) : QApplication (argc, argv) , _runningUnitTests (unitTesting) { _app = this; _msecsElapsedTime.start(); #ifdef Q_OS_LINUX #ifndef __mobile__ if (!_runningUnitTests) { if (getuid() == 0) { _exitWithError(QString( tr("You are running %1 as root. " "You should not do this since it will cause other issues with %1." "%1 will now exit.<br/><br/>" "If you are having serial port issues on Ubuntu, execute the following commands to fix most issues:<br/>" "<pre>sudo usermod -a -G dialout $USER<br/>" "sudo apt-get remove modemmanager</pre>").arg(qgcApp()->applicationName()))); return; } // Determine if we have the correct permissions to access USB serial devices QFile permFile("/etc/group"); if(permFile.open(QIODevice::ReadOnly)) { while(!permFile.atEnd()) { QString line = permFile.readLine(); if (line.contains("dialout") && !line.contains(getenv("USER"))) { permFile.close(); _exitWithError(QString( tr("The current user does not have the correct permissions to access serial devices. " "You should also remove modemmanager since it also interferes.<br/><br/>" "If you are using Ubuntu, execute the following commands to fix these issues:<br/>" "<pre>sudo usermod -a -G dialout $USER<br/>" "sudo apt-get remove modemmanager</pre>"))); return; } } permFile.close(); } // Always set style to default, this way QT_QUICK_CONTROLS_STYLE environment variable doesn't cause random changes in ui QQuickStyle::setStyle("Default"); } #endif #endif // Setup for network proxy support QNetworkProxyFactory::setUseSystemConfiguration(true); // Parse command line options bool fClearSettingsOptions = false; // Clear stored settings bool fClearCache = false; // Clear parameter/airframe caches bool logging = false; // Turn on logging QString loggingOptions; CmdLineOpt_t rgCmdLineOptions[] = { { "--clear-settings", &fClearSettingsOptions, nullptr }, { "--clear-cache", &fClearCache, nullptr }, { "--logging", &logging, &loggingOptions }, { "--fake-mobile", &_fakeMobile, nullptr }, { "--log-output", &_logOutput, nullptr }, // Add additional command line option flags here }; ParseCmdLineOptions(argc, argv, rgCmdLineOptions, sizeof(rgCmdLineOptions)/sizeof(rgCmdLineOptions[0]), false); // Set up timer for delayed missing fact display _missingParamsDelayedDisplayTimer.setSingleShot(true); _missingParamsDelayedDisplayTimer.setInterval(_missingParamsDelayedDisplayTimerTimeout); connect(&_missingParamsDelayedDisplayTimer, &QTimer::timeout, this, &QGCApplication::_missingParamsDisplay); // Set application information QString applicationName; if (_runningUnitTests) { // We don't want unit tests to use the same QSettings space as the normal app. So we tweak the app // name. Also we want to run unit tests with clean settings every time. applicationName = QStringLiteral("%1_unittest").arg(QGC_APPLICATION_NAME); } else { #ifdef DAILY_BUILD // This gives daily builds their own separate settings space. Allowing you to use daily and stable builds // side by side without daily screwing up your stable settings. applicationName = QStringLiteral("%1 Daily").arg(QGC_APPLICATION_NAME); #else applicationName = QGC_APPLICATION_NAME; #endif } setApplicationName(applicationName); setOrganizationName(QGC_ORG_NAME); setOrganizationDomain(QGC_ORG_DOMAIN); this->setApplicationVersion(QString(APP_VERSION_STR)); // Set settings format QSettings::setDefaultFormat(QSettings::IniFormat); QSettings settings; qDebug() << "*******Settings location" << settings.fileName() << "Is writable?:" << settings.isWritable(); #ifdef UNITTEST_BUILD if (!settings.isWritable()) { qWarning() << "Setings location is not writable"; } #endif // The setting will delete all settings on this boot fClearSettingsOptions |= settings.contains(_deleteAllSettingsKey); if (_runningUnitTests) { // Unit tests run with clean settings fClearSettingsOptions = true; } if (fClearSettingsOptions) { // User requested settings to be cleared on command line settings.clear(); // Clear parameter cache QDir paramDir(ParameterManager::parameterCacheDir()); paramDir.removeRecursively(); paramDir.mkpath(paramDir.absolutePath()); } else { // Determine if upgrade message for settings version bump is required. Check and clear must happen before toolbox is started since // that will write some settings. if (settings.contains(_settingsVersionKey)) { if (settings.value(_settingsVersionKey).toInt() != QGC_SETTINGS_VERSION) { settings.clear(); _settingsUpgraded = true; } } } settings.setValue(_settingsVersionKey, QGC_SETTINGS_VERSION); if (fClearCache) { QDir dir(ParameterManager::parameterCacheDir()); dir.removeRecursively(); QFile airframe(cachedAirframeMetaDataFile()); airframe.remove(); QFile parameter(cachedParameterMetaDataFile()); parameter.remove(); } // Set up our logging filters QGCLoggingCategoryRegister::instance()->setFilterRulesFromSettings(loggingOptions); // Initialize Bluetooth #ifdef QGC_ENABLE_BLUETOOTH QBluetoothLocalDevice localDevice; if (localDevice.isValid()) { _bluetoothAvailable = true; } #endif // Gstreamer debug settings int gstDebugLevel = 0; if (settings.contains(AppSettings::gstDebugLevelName)) { gstDebugLevel = settings.value(AppSettings::gstDebugLevelName).toInt(); } #if defined(QGC_GST_STREAMING) // Initialize Video Receiver GStreamer::initialize(argc, argv, gstDebugLevel); #else Q_UNUSED(gstDebugLevel) #endif // We need to set language as early as possible prior to loading on JSON files. setLanguage(); _toolbox = new QGCToolbox(this); _toolbox->setChildToolboxes(); #ifndef __mobile__ _gpsRtkFactGroup = new GPSRTKFactGroup(this); GPSManager *gpsManager = _toolbox->gpsManager(); if (gpsManager) { connect(gpsManager, &GPSManager::onConnect, this, &QGCApplication::_onGPSConnect); connect(gpsManager, &GPSManager::onDisconnect, this, &QGCApplication::_onGPSDisconnect); connect(gpsManager, &GPSManager::surveyInStatus, this, &QGCApplication::_gpsSurveyInStatus); connect(gpsManager, &GPSManager::satelliteUpdate, this, &QGCApplication::_gpsNumSatellites); } #endif /* __mobile__ */ _checkForNewVersion(); }
Just step the constructor part because the code is too long
-
@serkan_tr QGCApplication.cpp
class FinishVideoInitialization : public QRunnable { public: FinishVideoInitialization(VideoManager* manager) : _manager(manager) {} void run () { _manager->_initVideo(); } private: VideoManager* _manager; }; QGCApplication* QGCApplication::_app = nullptr; const char* QGCApplication::_deleteAllSettingsKey = "DeleteAllSettingsNextBoot"; const char* QGCApplication::_settingsVersionKey = "SettingsVersion"; // Mavlink status structures for entire app mavlink_status_t m_mavlink_status[MAVLINK_COMM_NUM_BUFFERS]; // Qml Singleton factories static QObject* screenToolsControllerSingletonFactory(QQmlEngine*, QJSEngine*) { ScreenToolsController* screenToolsController = new ScreenToolsController; return screenToolsController; } static QObject* mavlinkSingletonFactory(QQmlEngine*, QJSEngine*) { return new QGCMAVLink(); } static QObject* qgroundcontrolQmlGlobalSingletonFactory(QQmlEngine*, QJSEngine*) { // We create this object as a QGCTool even though it isn't in the toolbox QGroundControlQmlGlobal* qmlGlobal = new QGroundControlQmlGlobal(qgcApp(), qgcApp()->toolbox()); qmlGlobal->setToolbox(qgcApp()->toolbox()); return qmlGlobal; } static QObject* shapeFileHelperSingletonFactory(QQmlEngine*, QJSEngine*) { return new ShapeFileHelper; } QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting) : QApplication (argc, argv) , _runningUnitTests (unitTesting) { _app = this; _msecsElapsedTime.start(); #ifdef Q_OS_LINUX #ifndef __mobile__ if (!_runningUnitTests) { if (getuid() == 0) { _exitWithError(QString( tr("You are running %1 as root. " "You should not do this since it will cause other issues with %1." "%1 will now exit.<br/><br/>" "If you are having serial port issues on Ubuntu, execute the following commands to fix most issues:<br/>" "<pre>sudo usermod -a -G dialout $USER<br/>" "sudo apt-get remove modemmanager</pre>").arg(qgcApp()->applicationName()))); return; } // Determine if we have the correct permissions to access USB serial devices QFile permFile("/etc/group"); if(permFile.open(QIODevice::ReadOnly)) { while(!permFile.atEnd()) { QString line = permFile.readLine(); if (line.contains("dialout") && !line.contains(getenv("USER"))) { permFile.close(); _exitWithError(QString( tr("The current user does not have the correct permissions to access serial devices. " "You should also remove modemmanager since it also interferes.<br/><br/>" "If you are using Ubuntu, execute the following commands to fix these issues:<br/>" "<pre>sudo usermod -a -G dialout $USER<br/>" "sudo apt-get remove modemmanager</pre>"))); return; } } permFile.close(); } // Always set style to default, this way QT_QUICK_CONTROLS_STYLE environment variable doesn't cause random changes in ui QQuickStyle::setStyle("Default"); } #endif #endif // Setup for network proxy support QNetworkProxyFactory::setUseSystemConfiguration(true); // Parse command line options bool fClearSettingsOptions = false; // Clear stored settings bool fClearCache = false; // Clear parameter/airframe caches bool logging = false; // Turn on logging QString loggingOptions; CmdLineOpt_t rgCmdLineOptions[] = { { "--clear-settings", &fClearSettingsOptions, nullptr }, { "--clear-cache", &fClearCache, nullptr }, { "--logging", &logging, &loggingOptions }, { "--fake-mobile", &_fakeMobile, nullptr }, { "--log-output", &_logOutput, nullptr }, // Add additional command line option flags here }; ParseCmdLineOptions(argc, argv, rgCmdLineOptions, sizeof(rgCmdLineOptions)/sizeof(rgCmdLineOptions[0]), false); // Set up timer for delayed missing fact display _missingParamsDelayedDisplayTimer.setSingleShot(true); _missingParamsDelayedDisplayTimer.setInterval(_missingParamsDelayedDisplayTimerTimeout); connect(&_missingParamsDelayedDisplayTimer, &QTimer::timeout, this, &QGCApplication::_missingParamsDisplay); // Set application information QString applicationName; if (_runningUnitTests) { // We don't want unit tests to use the same QSettings space as the normal app. So we tweak the app // name. Also we want to run unit tests with clean settings every time. applicationName = QStringLiteral("%1_unittest").arg(QGC_APPLICATION_NAME); } else { #ifdef DAILY_BUILD // This gives daily builds their own separate settings space. Allowing you to use daily and stable builds // side by side without daily screwing up your stable settings. applicationName = QStringLiteral("%1 Daily").arg(QGC_APPLICATION_NAME); #else applicationName = QGC_APPLICATION_NAME; #endif } setApplicationName(applicationName); setOrganizationName(QGC_ORG_NAME); setOrganizationDomain(QGC_ORG_DOMAIN); this->setApplicationVersion(QString(APP_VERSION_STR)); // Set settings format QSettings::setDefaultFormat(QSettings::IniFormat); QSettings settings; qDebug() << "*******Settings location" << settings.fileName() << "Is writable?:" << settings.isWritable(); #ifdef UNITTEST_BUILD if (!settings.isWritable()) { qWarning() << "Setings location is not writable"; } #endif // The setting will delete all settings on this boot fClearSettingsOptions |= settings.contains(_deleteAllSettingsKey); if (_runningUnitTests) { // Unit tests run with clean settings fClearSettingsOptions = true; } if (fClearSettingsOptions) { // User requested settings to be cleared on command line settings.clear(); // Clear parameter cache QDir paramDir(ParameterManager::parameterCacheDir()); paramDir.removeRecursively(); paramDir.mkpath(paramDir.absolutePath()); } else { // Determine if upgrade message for settings version bump is required. Check and clear must happen before toolbox is started since // that will write some settings. if (settings.contains(_settingsVersionKey)) { if (settings.value(_settingsVersionKey).toInt() != QGC_SETTINGS_VERSION) { settings.clear(); _settingsUpgraded = true; } } } settings.setValue(_settingsVersionKey, QGC_SETTINGS_VERSION); if (fClearCache) { QDir dir(ParameterManager::parameterCacheDir()); dir.removeRecursively(); QFile airframe(cachedAirframeMetaDataFile()); airframe.remove(); QFile parameter(cachedParameterMetaDataFile()); parameter.remove(); } // Set up our logging filters QGCLoggingCategoryRegister::instance()->setFilterRulesFromSettings(loggingOptions); // Initialize Bluetooth #ifdef QGC_ENABLE_BLUETOOTH QBluetoothLocalDevice localDevice; if (localDevice.isValid()) { _bluetoothAvailable = true; } #endif // Gstreamer debug settings int gstDebugLevel = 0; if (settings.contains(AppSettings::gstDebugLevelName)) { gstDebugLevel = settings.value(AppSettings::gstDebugLevelName).toInt(); } #if defined(QGC_GST_STREAMING) // Initialize Video Receiver GStreamer::initialize(argc, argv, gstDebugLevel); #else Q_UNUSED(gstDebugLevel) #endif // We need to set language as early as possible prior to loading on JSON files. setLanguage(); _toolbox = new QGCToolbox(this); _toolbox->setChildToolboxes(); #ifndef __mobile__ _gpsRtkFactGroup = new GPSRTKFactGroup(this); GPSManager *gpsManager = _toolbox->gpsManager(); if (gpsManager) { connect(gpsManager, &GPSManager::onConnect, this, &QGCApplication::_onGPSConnect); connect(gpsManager, &GPSManager::onDisconnect, this, &QGCApplication::_onGPSDisconnect); connect(gpsManager, &GPSManager::surveyInStatus, this, &QGCApplication::_gpsSurveyInStatus); connect(gpsManager, &GPSManager::satelliteUpdate, this, &QGCApplication::_gpsNumSatellites); } #endif /* __mobile__ */ _checkForNewVersion(); }
Just step the constructor part because the code is too long
@serkan_tr main.qml
ApplicationWindow { id: mainWindow minimumWidth: ScreenTools.isMobile ? Screen.width : Math.min(ScreenTools.defaultFontPixelWidth * 100, Screen.width) minimumHeight: ScreenTools.isMobile ? Screen.height : Math.min(ScreenTools.defaultFontPixelWidth * 50, Screen.height) visible: true // visibility: mainWindow.FullScreen Component.onCompleted: { console.log((ScreenTools.defaultFontPixelWidth * 100).toString(),"--",Screen.width.toString(),"\n\n") //-- Full screen on mobile or tiny screens // mainWindow.minimumWidth = Math.min(1000,1000/*ScreenTools.defaultFontPixelWidth * 100, Screen.width*/) // mainWindow.showFullScreen() // console.log("\n\nsignal\n\n") if (!ScreenTools.isMobile || Screen.height / ScreenTools.realPixelDensity < 120 /*|| 1 === 1*/) { console.log("APP: true") // mainWindow.FullScreen mainWindow.showFullScreen() } else { console.log("APP: false") width = ScreenTools.isMobile ? Screen.width : Math.min(250 * Screen.pixelDensity, Screen.width) height = ScreenTools.isMobile ? Screen.height : Math.min(150 * Screen.pixelDensity, Screen.height) // mainWindow.showFullScreen() } // Start the sequence of first run prompt(s) firstRunPromptManager.nextPrompt() } QtObject { id: firstRunPromptManager property var currentDialog: null property var rgPromptIds: QGroundControl.corePlugin.firstRunPromptsToShow() property int nextPromptIdIndex: 0 function clearNextPromptSignal() { if (currentDialog) { currentDialog.closed.disconnect(nextPrompt) } } function nextPrompt() { if (nextPromptIdIndex < rgPromptIds.length) { var component = Qt.createComponent(QGroundControl.corePlugin.firstRunPromptResource(rgPromptIds[nextPromptIdIndex])); currentDialog = component.createObject(mainWindow) currentDialog.closed.connect(nextPrompt) currentDialog.open() nextPromptIdIndex++ } else { currentDialog = null showPreFlightChecklistIfNeeded() } } } property var _rgPreventViewSwitch: [ false ] readonly property real _topBottomMargins: ScreenTools.defaultFontPixelHeight * 0.5 //------------------------------------------------------------------------- //-- Global Scope Variables QtObject { id: globals readonly property var activeVehicle: QGroundControl.multiVehicleManager.activeVehicle readonly property real defaultTextHeight: ScreenTools.defaultFontPixelHeight readonly property real defaultTextWidth: ScreenTools.defaultFontPixelWidth readonly property var planMasterControllerFlyView: flightView.planController readonly property var guidedControllerFlyView: flightView.guidedController property var planMasterControllerPlanView: null property var currentPlanMissionItem: planMasterControllerPlanView ? planMasterControllerPlanView.missionController.currentPlanViewItem : null } /// Default color palette used throughout the UI QGCPalette { id: qgcPal; colorGroupEnabled: true } //------------------------------------------------------------------------- //-- Actions signal armVehicleRequest signal forceArmVehicleRequest signal disarmVehicleRequest signal vtolTransitionToFwdFlightRequest signal vtolTransitionToMRFlightRequest signal showPreFlightChecklistIfNeeded //------------------------------------------------------------------------- //-- Global Scope Functions /// Prevent view switching function pushPreventViewSwitch() { _rgPreventViewSwitch.push(true) } /// Allow view switching function popPreventViewSwitch() { if (_rgPreventViewSwitch.length == 1) { console.warn("mainWindow.popPreventViewSwitch called when nothing pushed") return } _rgPreventViewSwitch.pop() } /// @return true: View switches are not currently allowed function preventViewSwitch() { return _rgPreventViewSwitch[_rgPreventViewSwitch.length - 1] } function viewSwitch(currentToolbar) { toolDrawer.visible = false toolDrawer.toolSource = "" flightView.visible = false planView.visible = false toolbar.currentToolbar = currentToolbar } function showFlyView() { if (!flightView.visible) { mainWindow.showPreFlightChecklistIfNeeded() } viewSwitch(toolbar.flyViewToolbar) flightView.visible = true } function showPlanView() { viewSwitch(toolbar.planViewToolbar) planView.visible = true } function showTool(toolTitle, toolSource, toolIcon) { toolDrawer.backIcon = flightView.visible ? "/qmlimages/PaperPlane.svg" : "/qmlimages/Plan.svg" toolDrawer.toolTitle = toolTitle toolDrawer.toolSource = toolSource toolDrawer.toolIcon = toolIcon toolDrawer.visible = true } function showMapTool(toolSourceMap) { toolDrawermap.toolSourceMap = toolSourceMap toolDrawermap.visible = true } function showLedTool(toolSourceLed){ toolDrawerled.toolSourceLed=toolSourceLed if(toolDrawerled.visible==false){ toolDrawerled.visible=true } else{ toolDrawerled.visible=false } } function showCalibTool(toolSourceCalib){ toolDrawercalibration.toolSourceCalib = toolSourceCalib if(toolDrawercalibration.visible==false){ toolDrawercalibration.visible=true } else{ toolDrawercalibration.visible=false } } function showAnalyzeTool() { showTool(qsTr("Analyze Tools"), "AnalyzeView.qml", "/qmlimages/Analyze.svg") } function showSetupTool() { showTool(qsTr("Vehicle Setup"), "SetupView.qml", "/qmlimages/Gears.svg") } function showSettingsTool() { showTool(qsTr("Application Settings"), "AppSettings.qml", "/res/QGCLogoWhite") } function showLedToolpup(){ showLedTool("LedSettings2.qml") } function showMapToolpup(){ showMapTool("MapSettings.qml") } function showCamTool(){ showTool(qsTr("Camera Settings"),"CameraSettings.qml","/InstrumentValueIcons/camera-svgrepo-white.svg") } function showCalibToolpup(){ showCalibTool("CalibrationSettings.qml") } //------------------------------------------------------------------------- //-- Global simple message dialog function showMessageDialog(dialogTitle, dialogText, buttons = StandardButton.Ok, acceptFunction = null) { simpleMessageDialogComponent.createObject(mainWindow, { title: dialogTitle, text: dialogText, buttons: buttons, acceptFunction: acceptFunction }).open() } // This variant is only meant to be called by QGCApplication function _showMessageDialog(dialogTitle, dialogText) { showMessageDialog(dialogTitle, dialogText) } Component { id: simpleMessageDialogComponent QGCSimpleMessageDialog { } } /// Saves main window position and size MainWindowSavedState { window: mainWindow } property bool _forceClose: false function finishCloseProcess() { _forceClose = true // For some reason on the Qml side Qt doesn't automatically disconnect a signal when an object is destroyed. // So we have to do it ourselves otherwise the signal flows through on app shutdown to an object which no longer exists. firstRunPromptManager.clearNextPromptSignal() QGroundControl.linkManager.shutdown() QGroundControl.videoManager.stopVideo(); mainWindow.close() } // On attempting an application close we check for: // Unsaved missions - then // Pending parameter writes - then // Active connections property string closeDialogTitle: qsTr("Close %1").arg(QGroundControl.appName) function checkForUnsavedMission() { if (globals.planMasterControllerPlanView && globals.planMasterControllerPlanView.dirty) { showMessageDialog(closeDialogTitle, qsTr("You have a mission edit in progress which has not been saved/sent. If you close you will lose changes. Are you sure you want to close?"), StandardButton.Yes | StandardButton.No, function() { checkForPendingParameterWrites() }) } else { checkForPendingParameterWrites() } } function checkForPendingParameterWrites() { for (var index=0; index<QGroundControl.multiVehicleManager.vehicles.count; index++) { if (QGroundControl.multiVehicleManager.vehicles.get(index).parameterManager.pendingWrites) { mainWindow.showMessageDialog(closeDialogTitle, qsTr("You have pending parameter updates to a vehicle. If you close you will lose changes. Are you sure you want to close?"), StandardButton.Yes | StandardButton.No, function() { checkForActiveConnections() }) return } } checkForActiveConnections() } function checkForActiveConnections() { if (QGroundControl.multiVehicleManager.activeVehicle) { mainWindow.showMessageDialog(closeDialogTitle, qsTr("There are still active connections to vehicles. Are you sure you want to exit?"), StandardButton.Yes | StandardButton.No, function() { finishCloseProcess() }) } else { finishCloseProcess() } } onClosing: { if (!_forceClose) { close.accepted = false checkForUnsavedMission() } } //------------------------------------------------------------------------- /// Main, full window background (Fly View) background: Item { id: rootBackground anchors.fill: parent } //------------------------------------------------------------------------- /// Toolbar header: MainToolBar { id: toolbar height: ScreenTools.headerHeight visible: false /*!QGroundControl.videoManager.fullScreen*/ } footer: LogReplayStatusBar { visible: QGroundControl.settingsManager.flyViewSettings.showLogReplayStatusBar.rawValue } function showToolSelectDialog() { if (!mainWindow.preventViewSwitch()) { toolSelectDialogComponent.createObject(mainWindow).open() } } FlyView { id: flightView anchors.fill: parent } /* PlanView { id: planView anchors.fill: parent visible: false }*/ function toolDrawerVisible(){ toolDrawer.visible=false } Rectangle { id: toolDrawer width: 900 height: 500 color:qgcPal.window anchors{ horizontalCenter:parent.horizontalCenter verticalCenter:parent.verticalCenter } visible: false property alias backIcon: backIcon.source property alias toolTitle: toolbarDrawerText.text property alias toolSource: toolDrawerLoader.source property alias toolIcon: toolIcon.source Rectangle { id: toolDrawerToolbar anchors.left: parent.left anchors.right: parent.right anchors.top: parent.top height: ScreenTools.toolbarHeight color: parent.color RowLayout { anchors.leftMargin: ScreenTools.defaultFontPixelWidth anchors.left: parent.left anchors.top: parent.top anchors.bottom: parent.bottom spacing: ScreenTools.defaultFontPixelWidth QGCColoredImage { id: backIcon width: ScreenTools.defaultFontPixelHeight * 2 height: ScreenTools.defaultFontPixelHeight * 2 fillMode: Image.PreserveAspectFit mipmap: true color: qgcPal.text } QGCLabel { id: backTextLabel text: qsTr("Back") } QGCLabel { font.pointSize: ScreenTools.largeFontPointSize text: "<" } QGCColoredImage { id: toolIcon width: ScreenTools.defaultFontPixelHeight * 2 height: ScreenTools.defaultFontPixelHeight * 2 fillMode: Image.PreserveAspectFit mipmap: true color: qgcPal.text } QGCLabel { id: toolbarDrawerText font.pointSize: ScreenTools.largeFontPointSize } } QGCMouseArea { anchors.top: parent.top anchors.bottom: parent.bottom x: parent.mapFromItem(backIcon, backIcon.x, backIcon.y).x width: (backTextLabel.x + backTextLabel.width) - backIcon.x onClicked: { toolDrawer.visible = false toolDrawer.toolSource = "" toolDrawermap.visible=false } } } Loader { id: toolDrawerLoader anchors.left: parent.left anchors.right: parent.right anchors.top: toolDrawerToolbar.bottom anchors.bottom: parent.bottom Connections { target: toolDrawerLoader.item ignoreUnknownSignals: true onPopout: toolDrawer.visible = false } } } function toolDrawermapVisible(){ toolDrawermap.visible=false } Rectangle { id: toolDrawermap width: 700 height: 300 color:qgcPal.window radius: 50 anchors{ horizontalCenter:parent.horizontalCenter verticalCenter:parent.verticalCenter } visible: false property alias toolSourceMap: toolDrawerLoadermap.source property alias toolIconMap: toolIconmap.source Rectangle { id: toolDrawerToolbarmap anchors.left: parent.left width:470 anchors.leftMargin:40 anchors.top: parent.top anchors.topMargin:20 radius: 90 RowLayout { anchors.leftMargin: ScreenTools.defaultFontPixelWidth anchors.left: parent.left anchors.top: parent.top anchors.bottom: parent.bottom spacing: ScreenTools.defaultFontPixelWidth QGCColoredImage { id: backIconmap width: ScreenTools.defaultFontPixelHeight * 2 height: ScreenTools.defaultFontPixelHeight * 2 fillMode: Image.PreserveAspectFit mipmap: true color: qgcPal.text MouseArea{ anchors.fill:parent onClicked: { toolDrawermap.visible = false toolDrawer.visible=false } } } QGCLabel { id: backTextLabelmap text: qsTr("Back") } QGCLabel { font.pointSize: ScreenTools.largeFontPointSize text: "<" } QGCColoredImage { id: toolIconmap width: ScreenTools.defaultFontPixelHeight * 2 height: ScreenTools.defaultFontPixelHeight * 2 fillMode: Image.PreserveAspectFit mipmap: true color: qgcPal.text } QGCLabel { id: toolbarDrawerTextmap font.pointSize: ScreenTools.largeFontPointSize } } QGCMouseArea { anchors.top: parent.top anchors.bottom: parent.bottom x: parent.mapFromItem(backIconmap, backIconmap.x, backIconmap.y).x width: (backTextLabelmap.x + backTextLabelmap.width) - backIconmap.x onClicked: { toolDrawermap.visible = false toolDrawermap.toolSource = "" toolDrawer.visible =false } } } Loader { id: toolDrawerLoadermap anchors.left: parent.left anchors.top: parent.top anchors.right: parent.right Connections { target: toolDrawerLoadermap.item ignoreUnknownSignals: true onPopout: toolDrawermap.visible = false } } } function toolDrawerLedvisible(){ toolDrawerled.visible=false } Rectangle { id: toolDrawerled width: 700 height: 300 color:qgcPal.window radius:50 anchors{ horizontalCenter:parent.horizontalCenter verticalCenter:parent.verticalCenter } visible: false property alias toolSourceLed: toolDrawerLoaderled.source Loader { id: toolDrawerLoaderled anchors.left: parent.left anchors.top: parent.top anchors.right: parent.right Connections { target: toolDrawerLoaderled.item ignoreUnknownSignals: true onPopout: toolDrawerled.visible = false } } } function toolDrawerCalibvisible(){ toolDrawercalibration.visible=false } Rectangle { id: toolDrawercalibration width: 850 height: 465 color:qgcPal.window radius:50 anchors{ horizontalCenter:parent.horizontalCenter verticalCenter:parent.verticalCenter } visible: false property alias toolSourceCalib: toolDrawerLoadercalib.source Loader { id: toolDrawerLoadercalib anchors.left: parent.left anchors.top: parent.top anchors.right: parent.right Connections { target: toolDrawerLoadercalib.item ignoreUnknownSignals: true onPopout: toolDrawercalibration.visible = false } } } //------------------------------------------------------------------------- //-- Critical Vehicle Message Popup property var _vehicleMessageQueue: [] property string _vehicleMessage: "" function showCriticalVehicleMessage(message) { indicatorPopup.close() if (criticalVehicleMessagePopup.visible || QGroundControl.videoManager.fullScreen) { _vehicleMessageQueue.push(message) } else { _vehicleMessage = message criticalVehicleMessagePopup.open() } } Popup { id: criticalVehicleMessagePopup y: ScreenTools.defaultFontPixelHeight x: Math.round((mainWindow.width - width) * 0.5) width: mainWindow.width * 0.55 height: ScreenTools.defaultFontPixelHeight * 6 modal: false focus: true closePolicy: Popup.CloseOnEscape background: Rectangle { anchors.fill: parent color: qgcPal.alertBackground radius: ScreenTools.defaultFontPixelHeight * 0.5 border.color: qgcPal.alertBorder border.width: 2 } onOpened: { criticalVehicleMessageText.text = mainWindow._vehicleMessage } onClosed: { //-- Are there messages in the waiting queue? if(mainWindow._vehicleMessageQueue.length) { mainWindow._vehicleMessage = "" //-- Show all messages in queue for (var i = 0; i < mainWindow._vehicleMessageQueue.length; i++) { var text = mainWindow._vehicleMessageQueue[i] if(i) mainWindow._vehicleMessage += "<br>" mainWindow._vehicleMessage += text } //-- Clear it mainWindow._vehicleMessageQueue = [] criticalVehicleMessagePopup.open() } else { mainWindow._vehicleMessage = "" } } Flickable { id: criticalVehicleMessageFlick anchors.margins: ScreenTools.defaultFontPixelHeight * 0.5 anchors.fill: parent contentHeight: criticalVehicleMessageText.height contentWidth: criticalVehicleMessageText.width boundsBehavior: Flickable.StopAtBounds pixelAligned: true clip: true TextEdit { id: criticalVehicleMessageText width: criticalVehicleMessagePopup.width - criticalVehicleMessageClose.width - (ScreenTools.defaultFontPixelHeight * 2) anchors.centerIn: parent readOnly: true textFormat: TextEdit.RichText font.pointSize: ScreenTools.defaultFontPointSize font.family: ScreenTools.demiboldFontFamily wrapMode: TextEdit.WordWrap color: qgcPal.alertText } } //-- Dismiss Vehicle Message QGCColoredImage { id: criticalVehicleMessageClose anchors.margins: ScreenTools.defaultFontPixelHeight * 0.5 anchors.top: parent.top anchors.right: parent.right width: ScreenTools.isMobile ? ScreenTools.defaultFontPixelHeight * 1.5 : ScreenTools.defaultFontPixelHeight height: width sourceSize.height: width source: "/res/XDelete.svg" fillMode: Image.PreserveAspectFit color: qgcPal.alertText MouseArea { anchors.fill: parent anchors.margins: -ScreenTools.defaultFontPixelHeight onClicked: { criticalVehicleMessagePopup.close() } } } //-- More text below indicator QGCColoredImage { anchors.margins: ScreenTools.defaultFontPixelHeight * 0.5 anchors.bottom: parent.bottom anchors.right: parent.right width: ScreenTools.isMobile ? ScreenTools.defaultFontPixelHeight * 1.5 : ScreenTools.defaultFontPixelHeight height: width sourceSize.height: width source: "/res/ArrowDown.svg" fillMode: Image.PreserveAspectFit visible: criticalVehicleMessageText.lineCount > 5 color: qgcPal.alertText MouseArea { anchors.fill: parent onClicked: { criticalVehicleMessageFlick.flick(0,-500) } } } } //------------------------------------------------------------------------- //-- Indicator Popups function showIndicatorPopup(item, dropItem) { indicatorPopup.currentIndicator = dropItem indicatorPopup.currentItem = item indicatorPopup.open() } function hideIndicatorPopup() { indicatorPopup.close() indicatorPopup.currentItem = null indicatorPopup.currentIndicator = null } Popup { id: indicatorPopup padding: ScreenTools.defaultFontPixelWidth * 0.75 modal: true focus: true closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside property var currentItem: null property var currentIndicator: null background: Rectangle { width: loader.width height: loader.height color: Qt.rgba(0,0,0,0) } Loader { id: loader onLoaded: { var centerX = mainWindow.contentItem.mapFromItem(indicatorPopup.currentItem, 0, 0).x - (loader.width * 0.5) if((centerX + indicatorPopup.width) > (mainWindow.width - ScreenTools.defaultFontPixelWidth)) { centerX = mainWindow.width - indicatorPopup.width - ScreenTools.defaultFontPixelWidth } indicatorPopup.x = centerX } } onOpened: { loader.sourceComponent = indicatorPopup.currentIndicator } onClosed: { loader.sourceComponent = null indicatorPopup.currentIndicator = null } } }
-
@serkan_tr main.cpp
int main(int argc, char *argv[]) { rclcpp::init(argc, argv); #ifndef __mobile__ QString runguardString(QGC_APPLICATION_NAME); runguardString.append("RunGuardKey"); RunGuard guard(runguardString); if (!guard.tryToRun()) { // QApplication is necessary to use QMessageBox QApplication errorApp(argc, argv); QMessageBox::critical(nullptr, QObject::tr("Error"), QObject::tr("A second instance of %1 is already running. Please close the other instance and try again.").arg(QGC_APPLICATION_NAME) ); return -1; } #endif //-- Record boot time QGC::initTimer(); #ifdef Q_OS_UNIX //Force writing to the console on UNIX/BSD devices if (!qEnvironmentVariableIsSet("QT_LOGGING_TO_CONSOLE")) qputenv("QT_LOGGING_TO_CONSOLE", "1"); #endif // install the message handler AppMessages::installHandler(); #ifdef Q_OS_WIN // Set our own OpenGL buglist qputenv("QT_OPENGL_BUGLIST", ":/opengl/resources/opengl/buglist.json"); // Allow for command line override of renderer for (int i = 0; i < argc; i++) { const QString arg(argv[i]); if (arg == QStringLiteral("-angle")) { QCoreApplication::setAttribute(Qt::AA_UseOpenGLES); break; } else if (arg == QStringLiteral("-swrast")) { QCoreApplication::setAttribute(Qt::AA_UseSoftwareOpenGL); break; } } #endif #ifndef NO_SERIAL_LINK qRegisterMetaType<QSerialPort::SerialPortError>(); #endif #ifdef QGC_ENABLE_BLUETOOTH qRegisterMetaType<QBluetoothSocket::SocketError>(); qRegisterMetaType<QBluetoothServiceInfo>(); #endif qRegisterMetaType<QAbstractSocket::SocketError>(); qRegisterMetaType<Vehicle::MavCmdResultFailureCode_t>("Vehicle::MavCmdResultFailureCode_t"); // We statically link our own QtLocation plugin #ifdef Q_OS_WIN // In Windows, the compiler doesn't see the use of the class created by Q_IMPORT_PLUGIN #pragma warning( disable : 4930 4101 ) #endif Q_IMPORT_PLUGIN(QGeoServiceProviderFactoryQGC) bool runUnitTests = false; // Run unit tests QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); QGCApplication* app = new QGCApplication(argc, argv, runUnitTests); Q_CHECK_PTR(app); if(app->isErrorState()) { app->exec(); return -1; } // #ifdef Q_OS_LINUX QApplication::setWindowIcon(QIcon(":/res/resources/icons/qgroundcontrol.ico")); getQGCMapEngine()->init(); qRegisterMetaType<QList<QPair<QByteArray,QByteArray> > >(); app->_initCommon(); int exitCode = 0; { #ifdef UNITTEST_BUILD if (runUnitTests) { for (int i=0; i < (stressUnitTests ? 20 : 1); i++) { if (!app->_initForUnitTests()) { return -1; } // Run the test int failures = UnitTest::run(unitTestOptions); if (failures == 0) { qDebug() << "ALL TESTS PASSED"; exitCode = 0; } else { qDebug() << failures << " TESTS FAILED!"; exitCode = -failures; break; } } } else #endif } { #ifdef __android__ checkAndroidWritePermission(); #endif if (!app->_initForNormalAppBoot()) { return -1; } exitCode = app->exec(); } app->_shutdown(); delete app; //-- Shutdown Cache System destroyMapEngine(); rclcpp::shutdown(); qDebug() << "After app delete"; return exitCode; }
@serkan_tr I happend to know the source code a bit. You may try to replace the two lines(line 27 and 28):
minimumWidth: ScreenTools.isMobile ? Screen.width : Math.min(ScreenTools.defaultFontPixelWidth * 100, Screen.width) minimumHeight: ScreenTools.isMobile ? Screen.height : Math.min(ScreenTools.defaultFontPixelWidth * 50, Screen.height)
of the code here
https://github.com/mavlink/qgroundcontrol/blob/master/src/ui/MainRootWindow.qml
with
visibility: Window.FullScreen
to see if it helps. -
@serkan_tr main.qml
ApplicationWindow { id: mainWindow minimumWidth: ScreenTools.isMobile ? Screen.width : Math.min(ScreenTools.defaultFontPixelWidth * 100, Screen.width) minimumHeight: ScreenTools.isMobile ? Screen.height : Math.min(ScreenTools.defaultFontPixelWidth * 50, Screen.height) visible: true // visibility: mainWindow.FullScreen Component.onCompleted: { console.log((ScreenTools.defaultFontPixelWidth * 100).toString(),"--",Screen.width.toString(),"\n\n") //-- Full screen on mobile or tiny screens // mainWindow.minimumWidth = Math.min(1000,1000/*ScreenTools.defaultFontPixelWidth * 100, Screen.width*/) // mainWindow.showFullScreen() // console.log("\n\nsignal\n\n") if (!ScreenTools.isMobile || Screen.height / ScreenTools.realPixelDensity < 120 /*|| 1 === 1*/) { console.log("APP: true") // mainWindow.FullScreen mainWindow.showFullScreen() } else { console.log("APP: false") width = ScreenTools.isMobile ? Screen.width : Math.min(250 * Screen.pixelDensity, Screen.width) height = ScreenTools.isMobile ? Screen.height : Math.min(150 * Screen.pixelDensity, Screen.height) // mainWindow.showFullScreen() } // Start the sequence of first run prompt(s) firstRunPromptManager.nextPrompt() } QtObject { id: firstRunPromptManager property var currentDialog: null property var rgPromptIds: QGroundControl.corePlugin.firstRunPromptsToShow() property int nextPromptIdIndex: 0 function clearNextPromptSignal() { if (currentDialog) { currentDialog.closed.disconnect(nextPrompt) } } function nextPrompt() { if (nextPromptIdIndex < rgPromptIds.length) { var component = Qt.createComponent(QGroundControl.corePlugin.firstRunPromptResource(rgPromptIds[nextPromptIdIndex])); currentDialog = component.createObject(mainWindow) currentDialog.closed.connect(nextPrompt) currentDialog.open() nextPromptIdIndex++ } else { currentDialog = null showPreFlightChecklistIfNeeded() } } } property var _rgPreventViewSwitch: [ false ] readonly property real _topBottomMargins: ScreenTools.defaultFontPixelHeight * 0.5 //------------------------------------------------------------------------- //-- Global Scope Variables QtObject { id: globals readonly property var activeVehicle: QGroundControl.multiVehicleManager.activeVehicle readonly property real defaultTextHeight: ScreenTools.defaultFontPixelHeight readonly property real defaultTextWidth: ScreenTools.defaultFontPixelWidth readonly property var planMasterControllerFlyView: flightView.planController readonly property var guidedControllerFlyView: flightView.guidedController property var planMasterControllerPlanView: null property var currentPlanMissionItem: planMasterControllerPlanView ? planMasterControllerPlanView.missionController.currentPlanViewItem : null } /// Default color palette used throughout the UI QGCPalette { id: qgcPal; colorGroupEnabled: true } //------------------------------------------------------------------------- //-- Actions signal armVehicleRequest signal forceArmVehicleRequest signal disarmVehicleRequest signal vtolTransitionToFwdFlightRequest signal vtolTransitionToMRFlightRequest signal showPreFlightChecklistIfNeeded //------------------------------------------------------------------------- //-- Global Scope Functions /// Prevent view switching function pushPreventViewSwitch() { _rgPreventViewSwitch.push(true) } /// Allow view switching function popPreventViewSwitch() { if (_rgPreventViewSwitch.length == 1) { console.warn("mainWindow.popPreventViewSwitch called when nothing pushed") return } _rgPreventViewSwitch.pop() } /// @return true: View switches are not currently allowed function preventViewSwitch() { return _rgPreventViewSwitch[_rgPreventViewSwitch.length - 1] } function viewSwitch(currentToolbar) { toolDrawer.visible = false toolDrawer.toolSource = "" flightView.visible = false planView.visible = false toolbar.currentToolbar = currentToolbar } function showFlyView() { if (!flightView.visible) { mainWindow.showPreFlightChecklistIfNeeded() } viewSwitch(toolbar.flyViewToolbar) flightView.visible = true } function showPlanView() { viewSwitch(toolbar.planViewToolbar) planView.visible = true } function showTool(toolTitle, toolSource, toolIcon) { toolDrawer.backIcon = flightView.visible ? "/qmlimages/PaperPlane.svg" : "/qmlimages/Plan.svg" toolDrawer.toolTitle = toolTitle toolDrawer.toolSource = toolSource toolDrawer.toolIcon = toolIcon toolDrawer.visible = true } function showMapTool(toolSourceMap) { toolDrawermap.toolSourceMap = toolSourceMap toolDrawermap.visible = true } function showLedTool(toolSourceLed){ toolDrawerled.toolSourceLed=toolSourceLed if(toolDrawerled.visible==false){ toolDrawerled.visible=true } else{ toolDrawerled.visible=false } } function showCalibTool(toolSourceCalib){ toolDrawercalibration.toolSourceCalib = toolSourceCalib if(toolDrawercalibration.visible==false){ toolDrawercalibration.visible=true } else{ toolDrawercalibration.visible=false } } function showAnalyzeTool() { showTool(qsTr("Analyze Tools"), "AnalyzeView.qml", "/qmlimages/Analyze.svg") } function showSetupTool() { showTool(qsTr("Vehicle Setup"), "SetupView.qml", "/qmlimages/Gears.svg") } function showSettingsTool() { showTool(qsTr("Application Settings"), "AppSettings.qml", "/res/QGCLogoWhite") } function showLedToolpup(){ showLedTool("LedSettings2.qml") } function showMapToolpup(){ showMapTool("MapSettings.qml") } function showCamTool(){ showTool(qsTr("Camera Settings"),"CameraSettings.qml","/InstrumentValueIcons/camera-svgrepo-white.svg") } function showCalibToolpup(){ showCalibTool("CalibrationSettings.qml") } //------------------------------------------------------------------------- //-- Global simple message dialog function showMessageDialog(dialogTitle, dialogText, buttons = StandardButton.Ok, acceptFunction = null) { simpleMessageDialogComponent.createObject(mainWindow, { title: dialogTitle, text: dialogText, buttons: buttons, acceptFunction: acceptFunction }).open() } // This variant is only meant to be called by QGCApplication function _showMessageDialog(dialogTitle, dialogText) { showMessageDialog(dialogTitle, dialogText) } Component { id: simpleMessageDialogComponent QGCSimpleMessageDialog { } } /// Saves main window position and size MainWindowSavedState { window: mainWindow } property bool _forceClose: false function finishCloseProcess() { _forceClose = true // For some reason on the Qml side Qt doesn't automatically disconnect a signal when an object is destroyed. // So we have to do it ourselves otherwise the signal flows through on app shutdown to an object which no longer exists. firstRunPromptManager.clearNextPromptSignal() QGroundControl.linkManager.shutdown() QGroundControl.videoManager.stopVideo(); mainWindow.close() } // On attempting an application close we check for: // Unsaved missions - then // Pending parameter writes - then // Active connections property string closeDialogTitle: qsTr("Close %1").arg(QGroundControl.appName) function checkForUnsavedMission() { if (globals.planMasterControllerPlanView && globals.planMasterControllerPlanView.dirty) { showMessageDialog(closeDialogTitle, qsTr("You have a mission edit in progress which has not been saved/sent. If you close you will lose changes. Are you sure you want to close?"), StandardButton.Yes | StandardButton.No, function() { checkForPendingParameterWrites() }) } else { checkForPendingParameterWrites() } } function checkForPendingParameterWrites() { for (var index=0; index<QGroundControl.multiVehicleManager.vehicles.count; index++) { if (QGroundControl.multiVehicleManager.vehicles.get(index).parameterManager.pendingWrites) { mainWindow.showMessageDialog(closeDialogTitle, qsTr("You have pending parameter updates to a vehicle. If you close you will lose changes. Are you sure you want to close?"), StandardButton.Yes | StandardButton.No, function() { checkForActiveConnections() }) return } } checkForActiveConnections() } function checkForActiveConnections() { if (QGroundControl.multiVehicleManager.activeVehicle) { mainWindow.showMessageDialog(closeDialogTitle, qsTr("There are still active connections to vehicles. Are you sure you want to exit?"), StandardButton.Yes | StandardButton.No, function() { finishCloseProcess() }) } else { finishCloseProcess() } } onClosing: { if (!_forceClose) { close.accepted = false checkForUnsavedMission() } } //------------------------------------------------------------------------- /// Main, full window background (Fly View) background: Item { id: rootBackground anchors.fill: parent } //------------------------------------------------------------------------- /// Toolbar header: MainToolBar { id: toolbar height: ScreenTools.headerHeight visible: false /*!QGroundControl.videoManager.fullScreen*/ } footer: LogReplayStatusBar { visible: QGroundControl.settingsManager.flyViewSettings.showLogReplayStatusBar.rawValue } function showToolSelectDialog() { if (!mainWindow.preventViewSwitch()) { toolSelectDialogComponent.createObject(mainWindow).open() } } FlyView { id: flightView anchors.fill: parent } /* PlanView { id: planView anchors.fill: parent visible: false }*/ function toolDrawerVisible(){ toolDrawer.visible=false } Rectangle { id: toolDrawer width: 900 height: 500 color:qgcPal.window anchors{ horizontalCenter:parent.horizontalCenter verticalCenter:parent.verticalCenter } visible: false property alias backIcon: backIcon.source property alias toolTitle: toolbarDrawerText.text property alias toolSource: toolDrawerLoader.source property alias toolIcon: toolIcon.source Rectangle { id: toolDrawerToolbar anchors.left: parent.left anchors.right: parent.right anchors.top: parent.top height: ScreenTools.toolbarHeight color: parent.color RowLayout { anchors.leftMargin: ScreenTools.defaultFontPixelWidth anchors.left: parent.left anchors.top: parent.top anchors.bottom: parent.bottom spacing: ScreenTools.defaultFontPixelWidth QGCColoredImage { id: backIcon width: ScreenTools.defaultFontPixelHeight * 2 height: ScreenTools.defaultFontPixelHeight * 2 fillMode: Image.PreserveAspectFit mipmap: true color: qgcPal.text } QGCLabel { id: backTextLabel text: qsTr("Back") } QGCLabel { font.pointSize: ScreenTools.largeFontPointSize text: "<" } QGCColoredImage { id: toolIcon width: ScreenTools.defaultFontPixelHeight * 2 height: ScreenTools.defaultFontPixelHeight * 2 fillMode: Image.PreserveAspectFit mipmap: true color: qgcPal.text } QGCLabel { id: toolbarDrawerText font.pointSize: ScreenTools.largeFontPointSize } } QGCMouseArea { anchors.top: parent.top anchors.bottom: parent.bottom x: parent.mapFromItem(backIcon, backIcon.x, backIcon.y).x width: (backTextLabel.x + backTextLabel.width) - backIcon.x onClicked: { toolDrawer.visible = false toolDrawer.toolSource = "" toolDrawermap.visible=false } } } Loader { id: toolDrawerLoader anchors.left: parent.left anchors.right: parent.right anchors.top: toolDrawerToolbar.bottom anchors.bottom: parent.bottom Connections { target: toolDrawerLoader.item ignoreUnknownSignals: true onPopout: toolDrawer.visible = false } } } function toolDrawermapVisible(){ toolDrawermap.visible=false } Rectangle { id: toolDrawermap width: 700 height: 300 color:qgcPal.window radius: 50 anchors{ horizontalCenter:parent.horizontalCenter verticalCenter:parent.verticalCenter } visible: false property alias toolSourceMap: toolDrawerLoadermap.source property alias toolIconMap: toolIconmap.source Rectangle { id: toolDrawerToolbarmap anchors.left: parent.left width:470 anchors.leftMargin:40 anchors.top: parent.top anchors.topMargin:20 radius: 90 RowLayout { anchors.leftMargin: ScreenTools.defaultFontPixelWidth anchors.left: parent.left anchors.top: parent.top anchors.bottom: parent.bottom spacing: ScreenTools.defaultFontPixelWidth QGCColoredImage { id: backIconmap width: ScreenTools.defaultFontPixelHeight * 2 height: ScreenTools.defaultFontPixelHeight * 2 fillMode: Image.PreserveAspectFit mipmap: true color: qgcPal.text MouseArea{ anchors.fill:parent onClicked: { toolDrawermap.visible = false toolDrawer.visible=false } } } QGCLabel { id: backTextLabelmap text: qsTr("Back") } QGCLabel { font.pointSize: ScreenTools.largeFontPointSize text: "<" } QGCColoredImage { id: toolIconmap width: ScreenTools.defaultFontPixelHeight * 2 height: ScreenTools.defaultFontPixelHeight * 2 fillMode: Image.PreserveAspectFit mipmap: true color: qgcPal.text } QGCLabel { id: toolbarDrawerTextmap font.pointSize: ScreenTools.largeFontPointSize } } QGCMouseArea { anchors.top: parent.top anchors.bottom: parent.bottom x: parent.mapFromItem(backIconmap, backIconmap.x, backIconmap.y).x width: (backTextLabelmap.x + backTextLabelmap.width) - backIconmap.x onClicked: { toolDrawermap.visible = false toolDrawermap.toolSource = "" toolDrawer.visible =false } } } Loader { id: toolDrawerLoadermap anchors.left: parent.left anchors.top: parent.top anchors.right: parent.right Connections { target: toolDrawerLoadermap.item ignoreUnknownSignals: true onPopout: toolDrawermap.visible = false } } } function toolDrawerLedvisible(){ toolDrawerled.visible=false } Rectangle { id: toolDrawerled width: 700 height: 300 color:qgcPal.window radius:50 anchors{ horizontalCenter:parent.horizontalCenter verticalCenter:parent.verticalCenter } visible: false property alias toolSourceLed: toolDrawerLoaderled.source Loader { id: toolDrawerLoaderled anchors.left: parent.left anchors.top: parent.top anchors.right: parent.right Connections { target: toolDrawerLoaderled.item ignoreUnknownSignals: true onPopout: toolDrawerled.visible = false } } } function toolDrawerCalibvisible(){ toolDrawercalibration.visible=false } Rectangle { id: toolDrawercalibration width: 850 height: 465 color:qgcPal.window radius:50 anchors{ horizontalCenter:parent.horizontalCenter verticalCenter:parent.verticalCenter } visible: false property alias toolSourceCalib: toolDrawerLoadercalib.source Loader { id: toolDrawerLoadercalib anchors.left: parent.left anchors.top: parent.top anchors.right: parent.right Connections { target: toolDrawerLoadercalib.item ignoreUnknownSignals: true onPopout: toolDrawercalibration.visible = false } } } //------------------------------------------------------------------------- //-- Critical Vehicle Message Popup property var _vehicleMessageQueue: [] property string _vehicleMessage: "" function showCriticalVehicleMessage(message) { indicatorPopup.close() if (criticalVehicleMessagePopup.visible || QGroundControl.videoManager.fullScreen) { _vehicleMessageQueue.push(message) } else { _vehicleMessage = message criticalVehicleMessagePopup.open() } } Popup { id: criticalVehicleMessagePopup y: ScreenTools.defaultFontPixelHeight x: Math.round((mainWindow.width - width) * 0.5) width: mainWindow.width * 0.55 height: ScreenTools.defaultFontPixelHeight * 6 modal: false focus: true closePolicy: Popup.CloseOnEscape background: Rectangle { anchors.fill: parent color: qgcPal.alertBackground radius: ScreenTools.defaultFontPixelHeight * 0.5 border.color: qgcPal.alertBorder border.width: 2 } onOpened: { criticalVehicleMessageText.text = mainWindow._vehicleMessage } onClosed: { //-- Are there messages in the waiting queue? if(mainWindow._vehicleMessageQueue.length) { mainWindow._vehicleMessage = "" //-- Show all messages in queue for (var i = 0; i < mainWindow._vehicleMessageQueue.length; i++) { var text = mainWindow._vehicleMessageQueue[i] if(i) mainWindow._vehicleMessage += "<br>" mainWindow._vehicleMessage += text } //-- Clear it mainWindow._vehicleMessageQueue = [] criticalVehicleMessagePopup.open() } else { mainWindow._vehicleMessage = "" } } Flickable { id: criticalVehicleMessageFlick anchors.margins: ScreenTools.defaultFontPixelHeight * 0.5 anchors.fill: parent contentHeight: criticalVehicleMessageText.height contentWidth: criticalVehicleMessageText.width boundsBehavior: Flickable.StopAtBounds pixelAligned: true clip: true TextEdit { id: criticalVehicleMessageText width: criticalVehicleMessagePopup.width - criticalVehicleMessageClose.width - (ScreenTools.defaultFontPixelHeight * 2) anchors.centerIn: parent readOnly: true textFormat: TextEdit.RichText font.pointSize: ScreenTools.defaultFontPointSize font.family: ScreenTools.demiboldFontFamily wrapMode: TextEdit.WordWrap color: qgcPal.alertText } } //-- Dismiss Vehicle Message QGCColoredImage { id: criticalVehicleMessageClose anchors.margins: ScreenTools.defaultFontPixelHeight * 0.5 anchors.top: parent.top anchors.right: parent.right width: ScreenTools.isMobile ? ScreenTools.defaultFontPixelHeight * 1.5 : ScreenTools.defaultFontPixelHeight height: width sourceSize.height: width source: "/res/XDelete.svg" fillMode: Image.PreserveAspectFit color: qgcPal.alertText MouseArea { anchors.fill: parent anchors.margins: -ScreenTools.defaultFontPixelHeight onClicked: { criticalVehicleMessagePopup.close() } } } //-- More text below indicator QGCColoredImage { anchors.margins: ScreenTools.defaultFontPixelHeight * 0.5 anchors.bottom: parent.bottom anchors.right: parent.right width: ScreenTools.isMobile ? ScreenTools.defaultFontPixelHeight * 1.5 : ScreenTools.defaultFontPixelHeight height: width sourceSize.height: width source: "/res/ArrowDown.svg" fillMode: Image.PreserveAspectFit visible: criticalVehicleMessageText.lineCount > 5 color: qgcPal.alertText MouseArea { anchors.fill: parent onClicked: { criticalVehicleMessageFlick.flick(0,-500) } } } } //------------------------------------------------------------------------- //-- Indicator Popups function showIndicatorPopup(item, dropItem) { indicatorPopup.currentIndicator = dropItem indicatorPopup.currentItem = item indicatorPopup.open() } function hideIndicatorPopup() { indicatorPopup.close() indicatorPopup.currentItem = null indicatorPopup.currentIndicator = null } Popup { id: indicatorPopup padding: ScreenTools.defaultFontPixelWidth * 0.75 modal: true focus: true closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside property var currentItem: null property var currentIndicator: null background: Rectangle { width: loader.width height: loader.height color: Qt.rgba(0,0,0,0) } Loader { id: loader onLoaded: { var centerX = mainWindow.contentItem.mapFromItem(indicatorPopup.currentItem, 0, 0).x - (loader.width * 0.5) if((centerX + indicatorPopup.width) > (mainWindow.width - ScreenTools.defaultFontPixelWidth)) { centerX = mainWindow.width - indicatorPopup.width - ScreenTools.defaultFontPixelWidth } indicatorPopup.x = centerX } } onOpened: { loader.sourceComponent = indicatorPopup.currentIndicator } onClosed: { loader.sourceComponent = null indicatorPopup.currentIndicator = null } } }
@serkan_tr said in How to make full screen:
if (!ScreenTools.isMobile || Screen.height / ScreenTools.realPixelDensity < 120 /|| 1 === 1/) {
console.log("APP: true")
// mainWindow.FullScreen
mainWindow.showFullScreen()} else { console.log("APP: false") width = ScreenTools.isMobile ? Screen.width : Math.min(250 * Screen.pixelDensity, Screen.width) height = ScreenTools.isMobile ? Screen.height : Math.min(150 * Screen.pixelDensity, Screen.height)
// mainWindow.showFullScreen()
}
I guess this is what I'm doing. Even if I put "mainWindow.showFullScreen()" else here, it doesn't work, the bottom part is still visible.
My goal is to show the inside of my app as it was before formatting the tablet. I want it to completely fill the screen. no matter what device, tablet phone computer only this one should appear -
@serkan_tr I happend to know the source code a bit. You may try to replace the two lines(line 27 and 28):
minimumWidth: ScreenTools.isMobile ? Screen.width : Math.min(ScreenTools.defaultFontPixelWidth * 100, Screen.width) minimumHeight: ScreenTools.isMobile ? Screen.height : Math.min(ScreenTools.defaultFontPixelWidth * 50, Screen.height)
of the code here
https://github.com/mavlink/qgroundcontrol/blob/master/src/ui/MainRootWindow.qml
with
visibility: Window.FullScreen
to see if it helps. -
@JoeCFD I tried changing these lines but the screen size still did not change.
what exactly should i write@serkan_tr can you show your picture? I use it for Linux and Android without issues. Maybe Windows 10 is too old.
mainWindow.showFullScreen() is not needed.You can also try to get screen size from your main and set it somewhere.
QRect rec = QGuiApplication::screens().at( 0 )->geometry();
QSize( rec.width(), rec.height() ) is the screen size;then, pass the size to
height and width of your mainWindow -
@serkan_tr can you show your picture? I use it for Linux and Android without issues. Maybe Windows 10 is too old.
mainWindow.showFullScreen() is not needed.You can also try to get screen size from your main and set it somewhere.
QRect rec = QGuiApplication::screens().at( 0 )->geometry();
QSize( rec.width(), rec.height() ) is the screen size;then, pass the size to
height and width of your mainWindow -
@JoeCFD
27 and 28 no matter what I do, only the smallest state changes
The "windows taskbar" part at the bottom still appears
@serkan_tr I said remove or comment them out.
Use only
visibility: Window.FullScreen -
@serkan_tr I said remove or comment them out.
Use only
visibility: Window.FullScreen@JoeCFD I made the comments line everywhere, I only made the part you said active, but it is still full screen, the vindow and application parts are visible at the bottom.
ApplicationWindow { id: mainWindow // minimumWidth: ScreenTools.isMobile ? Screen.width : Math.min(ScreenTools.defaultFontPixelWidth * 100, Screen.width) // minimumHeight: ScreenTools.isMobile ? Screen.height : Math.min(ScreenTools.defaultFontPixelWidth * 50, Screen.height) // visible: true visibility: Window.FullScreen // visibility: Window.FullScreen // visibility: mainWindow.FullScreen // Component.onCompleted: { // console.log((ScreenTools.defaultFontPixelWidth * 100).toString(),"--",Screen.width.toString(),"\n\n") // //-- Full screen on mobile or tiny screens //// mainWindow.minimumWidth = Math.min(1000,1000/*ScreenTools.defaultFontPixelWidth * 100, Screen.width*/) //// mainWindow.showFullScreen() //// console.log("\n\nsignal\n\n") // if (!ScreenTools.isMobile || Screen.height / ScreenTools.realPixelDensity < 120 /*|| 1 === 1*/) { // console.log("APP: true") //// mainWindow.FullScreen // mainWindow.showFullScreen() // } else { // console.log("APP: false") // width = ScreenTools.isMobile ? Screen.width : Math.min(250 * Screen.pixelDensity, Screen.width) // height = ScreenTools.isMobile ? Screen.height : Math.min(150 * Screen.pixelDensity, Screen.height) //// mainWindow.showFullScreen() // } // // Start the sequence of first run prompt(s) // firstRunPromptManager.nextPrompt() // }
-
S serkan_tr has marked this topic as solved on