×
Namespaces

Variants
Actions
(Difference between revisions)

Utility to quickly check Qt and Qt Mobility versions

From Nokia Developer Wiki
Jump to: navigation, search
hamishwillee (Talk | contribs)
m (Text replace - "Category:MeeGo" to "Category:MeeGo Harmattan")
hamishwillee (Talk | contribs)
m (Text replace - "<code cpp>" to "<code cpp-qt>")
 
(One intermediate revision by one user not shown)
Line 1: Line 1:
 
[[Category:Qt]][[Category:Qt Mobility]]
 
[[Category:Qt]][[Category:Qt Mobility]]
 
    
 
    
{{ArticleMetaData
+
{{ArticleMetaData <!-- v1.2 -->
|id=
+
|platform=Symbian
+
|devices=Emulator/ N900
+
|category=Qt
+
|subcategory=
+
|creationdate=
+
|keywords= QGLFormat
+
 
+
 
|sourcecode= <!-- Link to example source code (e.g. [[Media:The Code Example ZIP.zip]]) -->
 
|sourcecode= <!-- Link to example source code (e.g. [[Media:The Code Example ZIP.zip]]) -->
 
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
 
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
|sdk=<!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Nokia Qt SDK 1.1]) -->
+
|devices= Emulator/ N900
|devicecompatability=<!-- Compatible devices (e.g.: All* (must have GPS) ) -->
+
|sdk= <!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Nokia Qt SDK 1.1]) -->
|signing=<!-- Empty or one of Self-Signed, DevCert, Manufacturer -->
+
|platform= Symbian
|capabilities=<!-- Capabilities required (e.g. Location, NetworkServices.) -->
+
|devicecompatability= <!-- Compatible devices (e.g.: All* (must have GPS) ) -->
|author=[[User:Maveric]]
+
|dependencies= <!-- Any other/external dependencies e.g.: Google Maps Api v1.0 -->
 +
|signing= <!-- Empty or one of Self-Signed, DevCert, Manufacturer -->
 +
|capabilities= <!-- Capabilities required by the article/code example (e.g. Location, NetworkServices. -->
 +
|keywords= QGLFormat
 +
|language= <!-- Language category code for non-English topics - e.g. Lang-Chinese -->
 +
|translated-by= <!-- [[User:XXXX]] -->
 +
|translated-from-title= <!-- Title only -->
 +
|translated-from-id= <!-- Id of translated revision -->
 +
|review-by= <!-- After re-review: [[User:username]] -->
 +
|review-timestamp= <!-- After re-review: YYYYMMDD -->
 +
|update-by= <!-- After significant update: [[User:username]]-->
 +
|update-timestamp= <!-- After significant update: YYYYMMDD -->
 +
|creationdate= 20101214
 +
|author= [[User:Maveric]]
 +
<!-- The following are not in current metadata -->
 +
|subcategory=
 
}}
 
}}
  
Line 30: Line 37:
 
==Example code==
 
==Example code==
  
<code cpp>
+
<code cpp-qt>
  
 
#include <QtGui>
 
#include <QtGui>

Latest revision as of 04:18, 11 October 2012


Article Metadata
Tested with
Devices(s): Emulator/ N900
Compatibility
Platform(s): Symbian
Symbian
Article
Keywords: QGLFormat
Created: Maveric (14 Dec 2010)
Last edited: hamishwillee (11 Oct 2012)


[edit] Introduction

This article shows how to find out the current version of Qt, Qt Mobility and also OpenGL.


[edit] Prerequisities

You would need the Qt SDK installed to compile the utility example code.

[edit] Example code

#include <QtGui>
#include <QtOpenGL>
#include <qmobilityglobal.h>
 
const char* openglVersion()
{
const char *OpenGLVersion;
switch (QGLFormat::openGLVersionFlags()) {
case QGLFormat::OpenGL_Version_1_1:
OpenGLVersion = "OpenGL 1.1";
break;
case QGLFormat::OpenGL_Version_1_2:
OpenGLVersion = "OpenGL 1.2";
break;
case QGLFormat::OpenGL_Version_1_3:
OpenGLVersion = "OpenGL 1.3";
break;
case QGLFormat::OpenGL_Version_1_4:
OpenGLVersion = "OpenGL 1.4";
break;
case QGLFormat::OpenGL_Version_1_5:
OpenGLVersion = "OpenGL 1.5";
break;
case QGLFormat::OpenGL_Version_2_0:
OpenGLVersion = "OpenGL 2.0";
break;
case QGLFormat::OpenGL_Version_2_1:
OpenGLVersion = "OpenGL 2.1";
break;
case QGLFormat::OpenGL_Version_3_0:
OpenGLVersion = "OpenGL 3.0";
break;
case QGLFormat::OpenGL_ES_CommonLite_Version_1_0:
OpenGLVersion = "OpenGL ES Common Lite 1.0";
break;
case QGLFormat::OpenGL_ES_Common_Version_1_0:
OpenGLVersion = "OpenGL ES Common Lite 1.0";
break;
case QGLFormat::OpenGL_ES_CommonLite_Version_1_1:
OpenGLVersion = "OpenGL ES Common Lite 1.1";
break;
case QGLFormat::OpenGL_ES_Common_Version_1_1:
OpenGLVersion = "OpenGL ES Common Lite 1.1";
break;
case QGLFormat::OpenGL_ES_Version_2_0:
OpenGLVersion = "OpenGL ES 2.0";
break;
case QGLFormat::OpenGL_Version_None:
default:
OpenGLVersion = "No Open GL";
break;
}
return OpenGLVersion;
}
 
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
 
QFont font("Nokia Sans", 32);
QLabel label;
label.setFont(font);
label.setText(QString("%1Qt: %2<br>Runtime Qt: %3<br>Qt Mobility: %4<br>OpenGL: %5")
.arg(qstrcmp(QT_VERSION_STR, qVersion()) ? "<h1 style=\"color: red\">Mismatch detected!</h1>" : "")
.arg(QT_VERSION_STR)
.arg(qVersion())
.arg(QTM_VERSION_STR)
.arg(openglVersion()));
label.setAlignment(Qt::AlignCenter);
label.show();
 
return a.exec();
}

The QGLFormat class specifies the display format of an OpenGL rendering context.

You should compile this example for yourself using the SDK for your target device.

This page was last modified on 11 October 2012, at 04:18.
97 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×