Qt5 QML - 文本不会在已部署的应用程序版本中加载

时间:2014-09-29 08:30:03

标签: qml qt5

使用qt-opensource-windows-x86-mingw482_opengl-5.3.2.exe和Qt Creator,我编写了一个Qt5 QML Qt Quick应用程序,在编译期间并且在我自己的系统上运行时,一切正常。但是,当我将此版本exe移动到另一台计算机时,没有任何文本加载和显示出来。

我该如何解决这种奇怪的行为?

main.cpp中:

    #include <QApplication>
    #include <QQmlApplicationEngine>
    #include <QDir>

    int main(int argc, char *argv[]) {
        QApplication app(argc, argv);

        app.addLibraryPath(QString(QDir::toNativeSeparators(QApplication::applicationDirPath())));

        QQmlApplicationEngine engine;
        engine.load(QUrl(QStringLiteral("qrc:/main.qml")));

        return app.exec();
    }

main.qml:

    import QtQuick 2.3
    import QtQuick.Controls 1.2

    ApplicationWindow {
        visible: true
        width: 640
        height: 480
        title: qsTr("Hello World")

        menuBar: MenuBar {
            Menu {
                title: qsTr("File")
                MenuItem {
                    text: qsTr("&Open")
                    onTriggered: console.log("Open action triggered");
                }
                MenuItem {
                    text: qsTr("Exit")
                    onTriggered: Qt.quit();
                }
            }
        }

        Text {
            text: qsTr("Hello World")
            anchors.centerIn: parent
        }
    }

menuBar的文本和上面QML中的Text在其他计算机上消失了!

下面的DebugView日志显示问题似乎取决于OpenGL?

00000001    0.00000000  [4068] getProcAddress: Unable to resolve 'glGenFramebuffers'    
00000002    0.00005326  [4068] getProcAddress: Unable to resolve 'glGenFramebuffersOES' 
00000003    0.00010398  [4068] getProcAddress: Unable to resolve 'glGenFramebuffersARB' 
00000004    0.00015181  [4068] getProcAddress: Unable to resolve 'glGenFramebuffersEXT' 
00000005    0.00051232  [4068] getProcAddress: Unable to resolve 'glGenBuffers' 
00000006    0.00056050  [4068] getProcAddress: Unable to resolve 'glGenBuffersOES'  
00000007    0.00060760  [4068] getProcAddress: Unable to resolve 'glGenBuffersARB'  
00000008    0.00065434  [4068] getProcAddress: Unable to resolve 'glGenBuffersEXT'  
00000009    0.00222535  [4068] getProcAddress: Unable to resolve 'glBindFramebuffer'    
00000010    0.00227571  [4068] getProcAddress: Unable to resolve 'glBindFramebufferOES' 
00000011    0.00232462  [4068] getProcAddress: Unable to resolve 'glBindFramebufferARB' 
00000012    0.00237209  [4068] getProcAddress: Unable to resolve 'glBindFramebufferEXT' 
00000013    0.00248694  [4068] getProcAddress: Unable to resolve 'glGenBuffers' 
00000014    0.00253477  [4068] getProcAddress: Unable to resolve 'glGenBuffersOES'  
00000015    0.00258150  [4068] getProcAddress: Unable to resolve 'glGenBuffersARB'  
00000016    0.00262861  [4068] getProcAddress: Unable to resolve 'glGenBuffersEXT'  
00000017    0.00267643  [4068] getProcAddress: Unable to resolve 'glBindBuffer' 
00000018    0.00272317  [4068] getProcAddress: Unable to resolve 'glBindBufferOES'  
00000019    0.00276991  [4068] getProcAddress: Unable to resolve 'glBindBufferARB'  
00000020    0.00281665  [4068] getProcAddress: Unable to resolve 'glBindBufferEXT'  
00000021    0.00286411  [4068] getProcAddress: Unable to resolve 'glBufferData' 
00000022    0.00295505  [4068] getProcAddress: Unable to resolve 'glBufferDataOES'  
00000023    0.00300288  [4068] getProcAddress: Unable to resolve 'glBufferDataARB'  
00000024    0.00304998  [4068] getProcAddress: Unable to resolve 'glBufferDataEXT'  
00000025    0.00310034  [4068] getProcAddress: Unable to resolve 'glGenBuffers' 
00000026    0.00314708  [4068] getProcAddress: Unable to resolve 'glGenBuffersOES'  
00000027    0.00319346  [4068] getProcAddress: Unable to resolve 'glGenBuffersARB'  
00000028    0.00324092  [4068] getProcAddress: Unable to resolve 'glGenBuffersEXT'  
00000029    0.00328911  [4068] getProcAddress: Unable to resolve 'glBindBuffer' 
00000030    0.00333512  [4068] getProcAddress: Unable to resolve 'glBindBufferOES'  
00000031    0.00338150  [4068] getProcAddress: Unable to resolve 'glBindBufferARB'  
00000032    0.00342787  [4068] getProcAddress: Unable to resolve 'glBindBufferEXT'  
00000033    0.00347498  [4068] getProcAddress: Unable to resolve 'glBufferData' 
00000034    0.00352135  [4068] getProcAddress: Unable to resolve 'glBufferDataOES'  
00000035    0.00356773  [4068] getProcAddress: Unable to resolve 'glBufferDataARB'  
00000036    0.00361374  [4068] getProcAddress: Unable to resolve 'glBufferDataEXT'  
00000037    0.00366193  [4068] getProcAddress: Unable to resolve 'glGenBuffers' 
00000038    0.00370831  [4068] getProcAddress: Unable to resolve 'glGenBuffersOES'  
00000039    0.00375468  [4068] getProcAddress: Unable to resolve 'glGenBuffersARB'  
00000040    0.00380070  [4068] getProcAddress: Unable to resolve 'glGenBuffersEXT'  
00000041    0.00384816  [4068] getProcAddress: Unable to resolve 'glBindBuffer' 
00000042    0.00389454  [4068] getProcAddress: Unable to resolve 'glBindBufferOES'  
00000043    0.00394055  [4068] getProcAddress: Unable to resolve 'glBindBufferARB'  
00000044    0.00398693  [4068] getProcAddress: Unable to resolve 'glBindBufferEXT'  
00000045    0.00403439  [4068] getProcAddress: Unable to resolve 'glBufferData' 
00000046    0.00408113  [4068] getProcAddress: Unable to resolve 'glBufferDataOES'  
00000047    0.00413729  [4068] getProcAddress: Unable to resolve 'glBufferDataARB'  
00000048    0.00418475  [4068] getProcAddress: Unable to resolve 'glBufferDataEXT'  
00000049    0.00592387  [4068] getProcAddress: Unable to resolve 'glBindBuffer' 
00000050    0.00597605  [4068] getProcAddress: Unable to resolve 'glBindBufferOES'  
00000051    0.00602278  [4068] getProcAddress: Unable to resolve 'glBindBufferARB'  
00000052    0.00606916  [4068] getProcAddress: Unable to resolve 'glBindBufferEXT'  
00000053    0.00612061  [4068] getProcAddress: Unable to resolve 'glBindBuffer' 
00000054    0.00616699  [4068] getProcAddress: Unable to resolve 'glBindBufferOES'  
00000055    0.00621336  [4068] getProcAddress: Unable to resolve 'glBindBufferARB'  
00000056    0.00625938  [4068] getProcAddress: Unable to resolve 'glBindBufferEXT'  
00000057    0.00635503  [4068] getProcAddress: Unable to resolve 'glCreateProgram'  
00000058    0.00640249  [4068] getProcAddress: Unable to resolve 'glCreateProgramARB'   
00000059    0.00644996  [4068] getProcAddress: Unable to resolve 'glCreateProgramObject'    
00000060    0.00649778  [4068] getProcAddress: Unable to resolve 'glCreateProgramObjectARB' 
00000061    0.00657387  [4068] QOpenGLShaderProgram: could not create shader program    
00000062    0.00674198  [4068] getProcAddress: Unable to resolve 'glCreateShader'   
00000063    0.00678981  [4068] getProcAddress: Unable to resolve 'glCreateShaderARB'    
00000064    0.00683727  [4068] getProcAddress: Unable to resolve 'glCreateShaderObject' 
00000065    0.00688437  [4068] getProcAddress: Unable to resolve 'glCreateShaderObjectARB'  
00000066    0.00693075  [4068] QOpenGLShader: could not create shader   
00000067    0.00701082  [4068] getProcAddress: Unable to resolve 'glCreateShader'   
00000068    0.00705828  [4068] getProcAddress: Unable to resolve 'glCreateShaderARB'    
00000069    0.00710647  [4068] getProcAddress: Unable to resolve 'glCreateShaderObject' 
00000070    0.00715357  [4068] getProcAddress: Unable to resolve 'glCreateShaderObjectARB'  
00000071    0.00719923  [4068] QOpenGLShader: could not create shader   
00000072    0.00725828  [4068] shader compilation failed:   
00000073    0.00725828  [4068] ""   
00000074    0.00730973  [4068] QOpenGLShaderProgram::uniformLocation( matrix ): shader program is not linked    
00000075    0.00735756  [4068] QOpenGLShaderProgram::uniformLocation( color ): shader program is not linked 
00000076    0.00740575  [4068] QOpenGLShaderProgram::uniformLocation( textureScale ): shader program is not linked  
00000077    0.00745683  [4068] getProcAddress: Unable to resolve 'glBindBuffer' 
00000078    0.00750393  [4068] getProcAddress: Unable to resolve 'glBindBufferOES'  
00000079    0.00755031  [4068] getProcAddress: Unable to resolve 'glBindBufferARB'  
00000080    0.00759705  [4068] getProcAddress: Unable to resolve 'glBindBufferEXT'  
00000081    0.00764415  [4068] getProcAddress: Unable to resolve 'glBindBuffer' 
00000082    0.00769053  [4068] getProcAddress: Unable to resolve 'glBindBufferOES'  
00000083    0.00773727  [4068] getProcAddress: Unable to resolve 'glBindBufferARB'  
00000084    0.00778328  [4068] getProcAddress: Unable to resolve 'glBindBufferEXT'  
00000085    0.00783654  [4068] getProcAddress: Unable to resolve 'glCreateProgram'  
00000086    0.00788328  [4068] getProcAddress: Unable to resolve 'glCreateProgramARB'   
00000087    0.00793002  [4068] getProcAddress: Unable to resolve 'glCreateProgramObject'    
00000088    0.00797676  [4068] getProcAddress: Unable to resolve 'glCreateProgramObjectARB' 
00000089    0.00802277  [4068] QOpenGLShaderProgram: could not create shader program    
00000090    0.00810683  [4068] getProcAddress: Unable to resolve 'glCreateShader'   
00000091    0.00815465  [4068] getProcAddress: Unable to resolve 'glCreateShaderARB'    
00000092    0.00820139  [4068] getProcAddress: Unable to resolve 'glCreateShaderObject' 
00000093    0.00824849  [4068] getProcAddress: Unable to resolve 'glCreateShaderObjectARB'  
00000094    0.00829451  [4068] QOpenGLShader: could not create shader   
00000095    0.00836407  [4068] getProcAddress: Unable to resolve 'glCreateShader'   
00000096    0.00841154  [4068] getProcAddress: Unable to resolve 'glCreateShaderARB'    
00000097    0.00845791  [4068] getProcAddress: Unable to resolve 'glCreateShaderObject' 
00000098    0.00850465  [4068] getProcAddress: Unable to resolve 'glCreateShaderObjectARB'  
00000099    0.00855030  [4068] QOpenGLShader: could not create shader   
00000100    0.00859994  [4068] shader compilation failed:   
00000101    0.00859994  [4068] ""   
00000102    0.00864922  [4068] QOpenGLShaderProgram::uniformLocation( qt_Matrix ): shader program is not linked 
00000103    0.00869704  [4068] QOpenGLShaderProgram::uniformLocation( opacity ): shader program is not linked   
00000104    0.00874595  [4068] getProcAddress: Unable to resolve 'glBindBuffer' 
00000105    0.00879269  [4068] getProcAddress: Unable to resolve 'glBindBufferOES'  
00000106    0.00883835  [4068] getProcAddress: Unable to resolve 'glBindBufferARB'  
00000107    0.00888472  [4068] getProcAddress: Unable to resolve 'glBindBufferEXT'  
00000108    0.00893182  [4068] getProcAddress: Unable to resolve 'glBindBuffer' 
00000109    0.00897820  [4068] getProcAddress: Unable to resolve 'glBindBufferOES'  
00000110    0.00902421  [4068] getProcAddress: Unable to resolve 'glBindBufferARB'  
00000111    0.00907023  [4068] getProcAddress: Unable to resolve 'glBindBufferEXT'  
00000112    0.00913508  [4068] getProcAddress: Unable to resolve 'glCreateProgram'  
00000113    0.00918363  [4068] getProcAddress: Unable to resolve 'glCreateProgramARB'   
00000114    0.00923073  [4068] getProcAddress: Unable to resolve 'glCreateProgramObject'    
00000115    0.00927711  [4068] getProcAddress: Unable to resolve 'glCreateProgramObjectARB' 
00000116    0.00932312  [4068] QOpenGLShaderProgram: could not create shader program    
00000117    0.00939812  [4068] getProcAddress: Unable to resolve 'glCreateShader'   
00000118    0.00944486  [4068] getProcAddress: Unable to resolve 'glCreateShaderARB'    
00000119    0.00949160  [4068] getProcAddress: Unable to resolve 'glCreateShaderObject' 
00000120    0.00953870  [4068] getProcAddress: Unable to resolve 'glCreateShaderObjectARB'  
00000121    0.00958435  [4068] QOpenGLShader: could not create shader   
00000122    0.00965283  [4068] getProcAddress: Unable to resolve 'glCreateShader'   
00000123    0.00969957  [4068] getProcAddress: Unable to resolve 'glCreateShaderARB'    
00000124    0.00974558  [4068] getProcAddress: Unable to resolve 'glCreateShaderObject' 
00000125    0.00979269  [4068] getProcAddress: Unable to resolve 'glCreateShaderObjectARB'  
00000126    0.00983798  [4068] QOpenGLShader: could not create shader   
00000127    0.00988725  [4068] shader compilation failed:   
00000128    0.00988725  [4068] ""   
00000129    0.00993580  [4068] QOpenGLShaderProgram::uniformLocation( qt_Matrix ): shader program is not linked 
00000130    0.00998363  [4068] QOpenGLShaderProgram::uniformLocation( opacity ): shader program is not linked   
00000131    0.01003689  [4068] getProcAddress: Unable to resolve 'glBindBuffer' 
00000132    0.01008326  [4068] getProcAddress: Unable to resolve 'glBindBufferOES'  
00000133    0.01013073  [4068] getProcAddress: Unable to resolve 'glBindBufferARB'  
00000134    0.01017710  [4068] getProcAddress: Unable to resolve 'glBindBufferEXT'  
00000135    0.01022421  [4068] getProcAddress: Unable to resolve 'glBindBuffer' 
00000136    0.01027022  [4068] getProcAddress: Unable to resolve 'glBindBufferOES'  
00000137    0.01031623  [4068] getProcAddress: Unable to resolve 'glBindBufferARB'  
00000138    0.01036261  [4068] getProcAddress: Unable to resolve 'glBindBufferEXT'  
00000139    0.01229194  [4068] getProcAddress: Unable to resolve 'glBindFramebuffer'    
00000140    0.01233687  [4068] getProcAddress: Unable to resolve 'glBindFramebufferOES' 
00000141    0.01238506  [4068] getProcAddress: Unable to resolve 'glBindFramebufferARB' 
00000142    0.01243216  [4068] getProcAddress: Unable to resolve 'glBindFramebufferEXT' 
00000143    0.01325426  [4068] getProcAddress: Unable to resolve 'glBindBuffer' 
00000144    0.01330100  [4068] getProcAddress: Unable to resolve 'glBindBufferOES'  
00000145    0.01334773  [4068] getProcAddress: Unable to resolve 'glBindBufferARB'  
00000146    0.01339447  [4068] getProcAddress: Unable to resolve 'glBindBufferEXT'  
00000147    0.01344447  [4068] getProcAddress: Unable to resolve 'glBindBuffer' 
00000148    0.01349121  [4068] getProcAddress: Unable to resolve 'glBindBufferOES'  
00000149    0.01353759  [4068] getProcAddress: Unable to resolve 'glBindBufferARB'  
00000150    0.01358433  [4068] getProcAddress: Unable to resolve 'glBindBufferEXT'  
00000151    0.01364556  [4068] getProcAddress: Unable to resolve 'glCreateProgram'  
00000152    0.01369266  [4068] getProcAddress: Unable to resolve 'glCreateProgramARB'   
00000153    0.01374012  [4068] getProcAddress: Unable to resolve 'glCreateProgramObject'    
00000154    0.01378795  [4068] getProcAddress: Unable to resolve 'glCreateProgramObjectARB' 
00000155    0.01383650  [4068] QOpenGLShaderProgram: could not create shader program    
00000156    0.01394012  [4068] getProcAddress: Unable to resolve 'glCreateShader'   
00000157    0.01398831  [4068] getProcAddress: Unable to resolve 'glCreateShaderARB'    
00000158    0.01403505  [4068] getProcAddress: Unable to resolve 'glCreateShaderObject' 
00000159    0.01408215  [4068] getProcAddress: Unable to resolve 'glCreateShaderObjectARB'  
00000160    0.01412889  [4068] QOpenGLShader: could not create shader   
00000161    0.01420026  [4068] getProcAddress: Unable to resolve 'glCreateShader'   
00000162    0.01424664  [4068] getProcAddress: Unable to resolve 'glCreateShaderARB'    
00000163    0.01429410  [4068] getProcAddress: Unable to resolve 'glCreateShaderObject' 
00000164    0.01434048  [4068] getProcAddress: Unable to resolve 'glCreateShaderObjectARB'  
00000165    0.01438650  [4068] QOpenGLShader: could not create shader   
00000166    0.01443649  [4068] shader compilation failed:   
00000167    0.01443649  [4068] ""   
00000168    0.01448686  [4068] QOpenGLShaderProgram::uniformLocation( matrix ): shader program is not linked    
00000169    0.01453505  [4068] QOpenGLShaderProgram::uniformLocation( color ): shader program is not linked 
00000170    0.01458323  [4068] QOpenGLShaderProgram::uniformLocation( textureScale ): shader program is not linked  
00000171    0.01463396  [4068] getProcAddress: Unable to resolve 'glBindBuffer' 
00000172    0.01468033  [4068] getProcAddress: Unable to resolve 'glBindBufferOES'  
00000173    0.01472707  [4068] getProcAddress: Unable to resolve 'glBindBufferARB'  
00000174    0.01477272  [4068] getProcAddress: Unable to resolve 'glBindBufferEXT'  
00000175    0.01482019  [4068] getProcAddress: Unable to resolve 'glBindBuffer' 
00000176    0.01486620  [4068] getProcAddress: Unable to resolve 'glBindBufferOES'  
00000177    0.01491258  [4068] getProcAddress: Unable to resolve 'glBindBufferARB'  
00000178    0.01495823  [4068] getProcAddress: Unable to resolve 'glBindBufferEXT'  
00000179    0.01501185  [4068] getProcAddress: Unable to resolve 'glCreateProgram'  
00000180    0.01505823  [4068] getProcAddress: Unable to resolve 'glCreateProgramARB'   
00000181    0.01511584  [4068] getProcAddress: Unable to resolve 'glCreateProgramObject'    
00000182    0.01516439  [4068] getProcAddress: Unable to resolve 'glCreateProgramObjectARB' 
00000183    0.01521076  [4068] QOpenGLShaderProgram: could not create shader program    
00000184    0.01528613  [4068] getProcAddress: Unable to resolve 'glCreateShader'   
00000185    0.01533359  [4068] getProcAddress: Unable to resolve 'glCreateShaderARB'    
00000186    0.01538033  [4068] getProcAddress: Unable to resolve 'glCreateShaderObject' 
00000187    0.01542743  [4068] getProcAddress: Unable to resolve 'glCreateShaderObjectARB'  
00000188    0.01547308  [4068] QOpenGLShader: could not create shader   
00000189    0.01554192  [4068] getProcAddress: Unable to resolve 'glCreateShader'   
00000190    0.01558902  [4068] getProcAddress: Unable to resolve 'glCreateShaderARB'    
00000191    0.01563612  [4068] getProcAddress: Unable to resolve 'glCreateShaderObject' 
00000192    0.01568250  [4068] getProcAddress: Unable to resolve 'glCreateShaderObjectARB'  
00000193    0.01572815  [4068] QOpenGLShader: could not create shader   
00000194    0.01577743  [4068] shader compilation failed:   
00000195    0.01577743  [4068] ""   
00000196    0.01582634  [4068] QOpenGLShaderProgram::uniformLocation( qt_Matrix ): shader program is not linked 
00000197    0.01587417  [4068] QOpenGLShaderProgram::uniformLocation( opacity ): shader program is not linked   
00000198    0.01592308  [4068] getProcAddress: Unable to resolve 'glBindBuffer' 
00000199    0.01596946  [4068] getProcAddress: Unable to resolve 'glBindBufferOES'  
00000200    0.01601583  [4068] getProcAddress: Unable to resolve 'glBindBufferARB'  
00000201    0.01606185  [4068] getProcAddress: Unable to resolve 'glBindBufferEXT'  
00000202    0.01611003  [4068] getProcAddress: Unable to resolve 'glBindBuffer' 
00000203    0.01615641  [4068] getProcAddress: Unable to resolve 'glBindBufferOES'  
00000204    0.01620243  [4068] getProcAddress: Unable to resolve 'glBindBufferARB'  
00000205    0.01624808  [4068] getProcAddress: Unable to resolve 'glBindBufferEXT'  
00000206    0.01630025  [4068] getProcAddress: Unable to resolve 'glCreateProgram'  
00000207    0.01634699  [4068] getProcAddress: Unable to resolve 'glCreateProgramARB'   
00000208    0.01639300  [4068] getProcAddress: Unable to resolve 'glCreateProgramObject'    
00000209    0.01643974  [4068] getProcAddress: Unable to resolve 'glCreateProgramObjectARB' 
00000210    0.01648503  [4068] QOpenGLShaderProgram: could not create shader program    
00000211    0.01656329  [4068] getProcAddress: Unable to resolve 'glCreateShader'   
00000212    0.01660568  [4068] getProcAddress: Unable to resolve 'glCreateShaderARB'    
00000213    0.01665242  [4068] getProcAddress: Unable to resolve 'glCreateShaderObject' 
00000214    0.01669952  [4068] getProcAddress: Unable to resolve 'glCreateShaderObjectARB'  
00000215    0.01674481  [4068] QOpenGLShader: could not create shader   
00000216    0.01681329  [4068] getProcAddress: Unable to resolve 'glCreateShader'   
00000217    0.01686039  [4068] getProcAddress: Unable to resolve 'glCreateShaderARB'    
00000218    0.01690713  [4068] getProcAddress: Unable to resolve 'glCreateShaderObject' 
00000219    0.01695351  [4068] getProcAddress: Unable to resolve 'glCreateShaderObjectARB'  
00000220    0.01699880  [4068] QOpenGLShader: could not create shader   
00000221    0.01704807  [4068] shader compilation failed:   
00000222    0.01704807  [4068] ""   
00000223    0.01709807  [4068] QOpenGLShaderProgram::uniformLocation( qt_Matrix ): shader program is not linked 
00000224    0.01714553  [4068] QOpenGLShaderProgram::uniformLocation( opacity ): shader program is not linked   
00000225    0.01719988  [4068] getProcAddress: Unable to resolve 'glBindBuffer' 
00000226    0.01724590  [4068] getProcAddress: Unable to resolve 'glBindBufferOES'  
00000227    0.01729227  [4068] getProcAddress: Unable to resolve 'glBindBufferARB'  
00000228    0.01733829  [4068] getProcAddress: Unable to resolve 'glBindBufferEXT'  
00000229    0.01738539  [4068] getProcAddress: Unable to resolve 'glBindBuffer' 
00000230    0.01743140  [4068] getProcAddress: Unable to resolve 'glBindBufferOES'  
00000231    0.01747742  [4068] getProcAddress: Unable to resolve 'glBindBufferARB'  
00000232    0.01752343  [4068] getProcAddress: Unable to resolve 'glBindBufferEXT'  

2 个答案:

答案 0 :(得分:0)

正如你所提到的那样,那台计算机上的OpenGL确实很可疑。作为一种解决方法,您可以使用不依赖OpenGL并使用DirectX的ANGLE版Qt。

您可以转到http://qt-project.org/downloads并点击&#34;显示下载&#34;来获得此类版本。例如,您可以尝试使用Qt 5.3.2 for Windows 32-bit(VS 2013,561 MB)&#34;。

答案 1 :(得分:0)

需要OpenGL 2.0,所以我更新了显卡驱动程序,然后显示了那些文本。