Showing posts with label Qt. Show all posts
Showing posts with label Qt. Show all posts
Thursday, January 12, 2012
Rendering images in a background thread in Qt
QImage instead of QPainter should be used. According to the QImage class reference, QPainter can be used to draw directly onto images. When using QPainter on a QImage, the painting can be performed in another thread than the current GUI thread.
Tuesday, January 3, 2012
OpenGL Version in Windows Remote Desktop
Qt shows that the current version and the only supported version in Windows Remote Desktop is 1.1.
Changing the current OpenGL version in Qt
We can change the current OpenGL version by creating a QGLFormat object and calling QGLFormat::setVersion, then passing the format into the QGLWidget's contructor.
NOTE: OpenGL 3.3 is being shown on my current machine with an ATI Radeon HD 2400 Pro graphics card. However, setting the version to 3.2 will give out a lot of warnings and nothing is being drawn on the screen. Setting the version to any versions between 1.x and 2.x will end up with version 3.3. The only version that I can successfully set to is 3.0 only.
NOTE: OpenGL 3.3 is being shown on my current machine with an ATI Radeon HD 2400 Pro graphics card. However, setting the version to 3.2 will give out a lot of warnings and nothing is being drawn on the screen. Setting the version to any versions between 1.x and 2.x will end up with version 3.3. The only version that I can successfully set to is 3.0 only.
The supported OpenGL versions in Qt
The supported OpenGL versions can be queried from QGLFormat in a QGLWidget. The function QGLFormat::openGLVersionFlags returns all the supported versions of the platform.
The current OpenGL version in Qt
The OpenGL version can queried from QGLFormat in a QGLWidget . The function QGLFormat::majorVersion and QGLFormat::minorVersion returns the current OpenGL version the platform is using.
Monday, December 12, 2011
QT_FORWARD_DECLARE_CLASS should be used for forward declaration of Qt classes
Using QT_FORWARD_DECLARE_CLASS, the forward declaration will still work if someone configures Qt with -qtnamespace:
For example, if someone configures a MyNamespace, QT_FORWARD_DECLARE_CLASS(QWidget) becomes:
namespace MyNamespace { class QWidget; }
using ::MyNamespace::QWidget;
whereas normal "class QWidget" forward declaration will cause a conflict since the class is declared outside the namespace.
For example, if someone configures a MyNamespace, QT_FORWARD_DECLARE_CLASS(QWidget) becomes:
namespace MyNamespace { class QWidget; }
using ::MyNamespace::QWidget;
whereas normal "class QWidget" forward declaration will cause a conflict since the class is declared outside the namespace.
Wednesday, July 27, 2011
Qt::ApplicationShortcut
If you set the shortcut context to Qt::ApplicationShortcut (or maybe other types too) in a QAction, you have to add the action to a widget by calling QWidget::addAction() before it can be used. This doesn't mean that the action will be visible. Adding the action to the widget will just make the shortcut part of the widget's event loop.
Monday, February 21, 2011
Starting a QThread
We must create the QApplication (or QCoreApplication) object before we create a QThread.
Subscribe to:
Posts (Atom)