Qt Application working fine when running on primary screen but doesn't run on secondary screen?...
Unsolved
General and Desktop
-
Hello,
I have done simple application and run it with creator, no problem at all.
But after deploy on dual screen computer on windows 7 64, run the exe on primary screen it's working fine but running it on secondary the app doesn't work. With double click on exe with app folder on second screen make the app process appear on task manager and disappear without any error...
main.cpp:
#include <QtWebEngine/qtwebengineglobal.h> #include <QQmlContext> #include <QApplication> #include <QOpenGLContext> #include <QtQml> #include "imagemagick.h" #include "download.h" int main(int argc, char *argv[]) { QApplication app(argc, argv); const QString documentsFolder = "E:"; QDir dirAffichageMeteo(documentsFolder+"/AffichageMeteo"); if (!dirAffichageMeteo.exists()){ dirAffichageMeteo.mkdir("."); } QDir dirImages(QDir::toNativeSeparators(documentsFolder+"/AffichageMeteo/Images")); if (!dirImages.exists()){ dirImages.mkdir("."); } QDir dirCropped(QDir::toNativeSeparators(documentsFolder+"/AffichageMeteo/Images/Cropped")); if (!dirCropped.exists()){ dirCropped.mkdir("."); } QDir dirImagesSaved(QDir::toNativeSeparators(documentsFolder+"/AffichageMeteo/ImagesObserved")); if (!dirImagesSaved.exists()){ dirImagesSaved.mkdir("."); } QDir dirImagesJplusUn(QDir::toNativeSeparators(documentsFolder+"/AffichageMeteo/ImagesJplusUn")); if (!dirImagesJplusUn.exists()){ dirImagesJplusUn.mkdir("."); } QDir dirImagesJplusDeux(QDir::toNativeSeparators(documentsFolder+"/AffichageMeteo/ImagesJplusDeux")); if (!dirImagesJplusDeux.exists()){ dirImagesJplusDeux.mkdir("."); } download download; QUrl Url; Url.setUrl(documentsFolder); QtWebEngine::initialize(); QQmlApplicationEngine engine; imagemagick img; engine.rootContext()->setContextProperty("img",&img); engine.rootContext()->setContextProperty("workingDirectory", QUrl::fromLocalFile(app.applicationDirPath())); engine.rootContext()->setContextProperty("download",&download); engine.rootContext()->setContextProperty("Url", Url); engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); return app.exec(); }
mail.qml
import QtQuick.Window 2.2 import QtQuick.Scene3D 2.0 import QtPositioning 5.5 import QtLocation 5.10 import QtWebView 1.1 import QtWebEngine 1.1 import QtQuick.Window 2.3 import Qt.labs.folderlistmodel 2.1 import "quickitemtexture.js" as GLCode import "db.js" as DB Window { id:window visible: true visibility:"Maximized" //title: qsTr("Hello World") onClosing: {download.kill()} onWidthChanged: {window.width>1280?[googlemap.zoomLevel=6.42,googlemap.center=QtPositioning.coordinate(46.0156666666667, 2.32819444444444)]:[googlemap.center=QtPositioning.coordinate(46.0772222222222, 2.25805555555556),googlemap.zoomLevel=5.82]} property string newstitle property string newscontent property string newsimage property string newssourcename property var imagelogo property int indexnews property int totalindexnews property int totalindeximages property int actualindeximages property var obj property string url1:"google" property string messageDirectory:"//dgs1109n007/echange_hangar/Affichage/Display/Messages" property string imageold property string france property var listImages property var infoImageList property int i:0 property int value:0 property int minute:0 property int seconde:0 property var resold; property var la; property var lo; property var tr; property var sp; property int timer_query:0; property int oldHour:0; Timer{ id:timer interval: 100 repeat: true running: true onTriggered: {movieTimer()} } Timer{ id:imagesTimer interval:10000 running: false repeat: true onTriggered: displayImage() } Timer{ id:weatherSource interval:60000 running: true repeat: true onTriggered: {download.sat24Com();oldHour!=new Date().getHours()?[oldHour=new Date().getHours(),download.timeImage(),weather.source = download.src()]:"";new Date().getHours()>10 && new Date().getHours()<=12? [removePath(),download.deleteVideo("France.mp4"),movie.source="file:/"+Url+"/Images/franceEmpty.jpg"]:""} } function movieTimer() { listImages = download.imagesList() if(i<listImages.length && listImages[i]!="Cropped") { movie.source="file://"+Url+"/AffichageMeteo/Images/"+listImages[i] i=i+1 } if(i==listImages.length-1) { i=0 } } function convert() { img.convertimg() displayImage() } function displayImage() { //popup.close() imageinfo.visible=false infoImageList=img.imageList() totalindeximages=infoImageList.length // console.log("actualindeximages "+actualindeximages+" totalindeximages "+totalindeximages) var image=Qt.resolvedUrl("file:"+img.image(infoImageList[actualindeximages])) if(actualindeximages>totalindeximages) { if(image!="file:"+Url+"/Affichage/Display/MessagesConverted/") { imageold=image imageinfo.source=imageold imageinfo.visible=true } actualindeximages=0 } if(actualindeximages<totalindeximages) { if(image!="file:"+Url+"/Affichage/Display/MessagesConverted/") { imageold=image imageinfo.source=imageold imageinfo.visible=true } actualindeximages=actualindeximages+1 } console.log("imageinfo.source "+imageinfo.source) imageinfo.visible=true } function removePath() { for(var i=0; i<polylineLP.pathLength();i++) { polylineLP.removeCoordinate(i) } for(i=0; i<polylineLN.pathLength();i++) { polylineLN.removeCoordinate(i) } for(i=0; i<polylineLT.pathLength();i++) { polylineLT.removeCoordinate(i) } for(i=0; i<polylineGB.pathLength();i++) { polylineGB.removeCoordinate(i) } } function flightradar(registration) { var date= new Date() var res var url = 'http://data-live.flightradar24.com/zones/fcgi/feed.js?reg=!'+registration+'&_='+date var doc= new XMLHttpRequest() doc.onreadystatechange = function(){ if(doc.readyState == XMLHttpRequest.DONE){ res=doc.responseText//JS.data(doc.responseText) if(res.length>35){ var res1=res.split("[") var res2=res1[1] var res3=res2.split(",") var res7=res3[4] // altitude_value la=parseFloat(res3[1]) //latitude_value lo=parseFloat(res3[2]) // longitude_value tr=parseFloat(res3[3]) // track_value sp=parseFloat(res3[5]) // speed_value if(registration=="F-GALP") { polylineLP.addCoordinate(QtPositioning.coordinate(la, lo)) }if(registration=="F-GALN") { polylineLN.addCoordinate(QtPositioning.coordinate(la, lo)) }if(registration=="F-GMLT") { polylineLT.addCoordinate(QtPositioning.coordinate(la, lo)) }if(registration=="F-GMGB") { polylineGB.addCoordinate(QtPositioning.coordinate(la, lo)) } //timer_query=0 } } } doc.open('GET', url, true) doc.send() } function anticipate() { if(timer_query>50 && timer_query<100) { flightradar("F-GALP") timer_query=100; }if(timer_query>110 && timer_query<210) { flightradar("F-GALN") timer_query=210; }if(timer_query>220 && timer_query<330) { flightradar("F-GMLT") timer_query=330; }if(timer_query>340 && timer_query<=440) { flightradar("F-GMGB") timer_query=0; } timer_query=timer_query+1 } Rectangle { height:parent.height width:parent.width/2 anchors.left:parent.left color: "black" opacity:1.0 Image { id: weather anchors.fill: parent fillMode: Image.PreserveAspectFit } Item { height:weather.height width:weather.width opacity: 0.5 Timer{ id:timer2 interval: 100 running: true repeat: true onTriggered: {anticipate()} } Map { id:googlemap anchors.fill:parent plugin: Plugin { name: "itemsoverlay" } color: 'transparent' center: window.width==1920?QtPositioning.coordinate(46.0270833333333, 10.1947777777778):QtPositioning.coordinate(46.0772222222222, 2.25805555555556) zoomLevel: window.width==1920?6.42:5.82 onCenterChanged: console.log(googlemap.center) onZoomLevelChanged: console.log(googlemap.zoomLevel) MapPolyline { id:polylineLP line.width: 4 line.color: 'blue' } MapPolyline { id:polylineLN line.width: 4 line.color: 'white' } MapPolyline { id:polylineLT line.width: 4 line.color: 'red' } MapPolyline { id:polylineGB line.width: 4 line.color: 'black' } } } } Rectangle { height:parent.height width:parent.width/2 anchors.right:parent.right color: "black" opacity:1.0 Image { id: movie anchors.fill: parent fillMode: Image.PreserveAspectFit } } Rectangle{ id:imageinforect height:parent.height-sourcecube.height width:parent.width/2 x:-window.width color:"white" //visible:false Image{ id:imageinfo anchors.fill:parent fillMode:Image.PreserveAspectFit source: "" } } Rectangle { id: textureSource color: "white" width: 500 height: 500 border.color: "transparent" border.width: 4 layer.enabled: true layer.smooth: true visible:false Image{ id:textureSourceImg anchors.fill: parent horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter fillMode: Image.PreserveAspectFit source:"https://logo.clearbit.com/ign.fr" } } Rectangle{ id:sourcecube height:100 width:100 anchors.bottom:parent.bottom anchors.left:parent.left gradient: Gradient { GradientStop { position: 0.0; color: "darkblue" } GradientStop { position: 1.0; color: "blue" } } Canvas3D { id: canvas3d anchors.centerIn: parent anchors.fill:parent focus: true property double xRotAnim: 0.0 property double yRotAnim: 90.0 property double zRotAnim: 0 property bool isRunning: true // Emitted when one time initializations should happen onInitializeGL: { GLCode.initializeGL(canvas3d, textureSource); } // Emitted each time Canvas3D is ready for a new frame onPaintGL: { GLCode.paintGL(canvas3d); } onResizeGL: { GLCode.resizeGL(canvas3d); } SequentialAnimation { id: objAnimationZ loops: Animation.Infinite running: true NumberAnimation { target: canvas3d property: "zRotAnim" from: 360.0 to: 0.0 //easing.type: Easing.InOutSine loops: Animation.Infinite; duration: 80 * Math.abs(to - from) } } } } Timer{ id:infoPauseAfterY interval: 5000 running: true repeat: false onTriggered: messageLeftscrolling.running=true } NumberAnimation { id:messageLeftscrolling running: false alwaysRunToEnd: true targets: imageinforect from: -window.width to:window.width/2 duration: 20000 property: "x" onRunningChanged: if (!running) { infoPauseAfterX.start(); imageinforect.x=window.width/2; } } Timer{ id:infoPauseAfterX interval: 20000 running: false repeat: false onTriggered: messageUpscrolling.running=true } NumberAnimation { id:messageUpscrolling alwaysRunToEnd: true running: false targets: imageinforect from: 0 to:window.height duration: 10000 property: "y" onRunningChanged: if (!running) { imageinforect.y=0; imageinforect.x=-window.width infoPauseAfterY.start(); convert() } } NumberAnimation { id:newscrolling alwaysRunToEnd: true targets: contentText from: window.width to:-window.width duration: 20000 property: "x" onRunningChanged: if (!running) { running=true; jsonparse() } } function jsonparse() { if(indexnews<totalindexnews) { newstitle=obj.articles[indexnews].title newssourcename=obj.articles[indexnews].url.split("//")[1].split("/")[0] if(newssourcename=="") { newssourcename="google.fr" }else{ newssourcename=(((obj.articles[indexnews].url.split("//")[1].split("/")[0].replace(" ","")).replace("'","")).replace("www.","")) } var slpiledname=newssourcename.split(".") if(slpiledname[1]==undefined) { newssourcename=newssourcename+".fr" } if(newssourcename.toLowerCase()=="lefigaro.fr") { textureSourceImg.source="qrc:/Images/lefigaro.png" }else{ textureSourceImg.source="https://logo.clearbit.com/"+newssourcename.toLowerCase() } newsimage=obj.articles[indexnews].urlToImage newscontent=obj.articles[indexnews].description } indexnews=indexnews+1 if(indexnews===totalindexnews) { newsupdate() } } function newsupdate() { var date= new Date() var res if(url1=="google") { var url = 'https://newsapi.org/v2/top-headlines?sources=google-news-fr&apiKey=d2cb3d1934fd48a4ba3c5ee45ce73bdb' }else{ url="https://newsapi.org/v2/top-headlines?country=fr&apiKey=d2cb3d1934fd48a4ba3c5ee45ce73bdb" } var doc= new XMLHttpRequest() doc.onreadystatechange = function(){ if(doc.readyState == XMLHttpRequest.DONE){ res=doc.responseText//JS.data(doc.responseText) //parse data obj = JSON.parse(res) if (typeof(obj) == 'object') { totalindexnews=Object.keys(obj.articles).length-1 indexnews=0 } } } doc.open('GET', url, true) doc.send() //console.log(url) if(url1=="google") { url1="fr" }else{ url1="google" } } Connections{ target: download onSourceChanged: weather.source = download.src() } Rectangle{ height:sourcecube.height width:parent.width-sourcecube.width anchors.left:sourcecube.right anchors.top: sourcecube.top gradient: Gradient { GradientStop { position: 0.0; color: "darkblue" } GradientStop { position: 1.0; color: "blue" } } Text{ id:titleText width:parent.width-imagenews.width anchors.left:parent.left anchors.top: parent.top anchors.topMargin: 5 color:"white" text:newstitle wrapMode : Text.WordWrap font.pixelSize: 20 font.bold: true font.italic: true } Text{ id:contentText width:parent.width anchors.bottom:parent.bottom anchors.margins: 10 color:"white" font.pixelSize: 20 font.italic: true text:newscontent } Image{ id:imagenews anchors.right:parent.right anchors.verticalCenter: parent.verticalCenter anchors.rightMargin: 10 source:newsimage height:parent.height*0.95 width:parent.height*0.95 } } Component.onCompleted:{ newsupdate() newscrolling.running = true messageLeftscrolling.running=true jsonparse() objAnimationZ.resume() convert() download.deleteVideo("France.mp4") } }
Thank you for your help
-
Hi,
Is there any difference between the first and second screen ?
E.g:- same brand ?
- same resolution ?
- connected to the same graphics card ?
Etc.
-
You didn't answer the question about the graphics card. What is it ?
Are the drivers up do date ?