If you created your pixel data using GDI functions its likely that you ended up with pixels in the form 0x00rrggbb as GDI will unset the alpha channel of all
pixels it touches. You can work around this by manually patching up the alpha channel, afterwards or by only using GDI functions that support a proper
alpha channel, like AlphaBlend.
Is it possible to have transparent Qt widgets on top of a QGLWidget?
Qt provides a way to paint to an OpenGL context, but this is in the end painted separately from Qt and the two painting systems are not synchronized, so Qt
cannot compose (semi-)transparent images on top of a QGLWidget. At best, you can have opaque widgets on top of the QGLWidget, but even then you
may experience some flicker due to the painting being asynchronous.
Where do I find the resource editor in the integrated Qt Designer when using the Qt Eclipse Integration?
The Qt Eclipse Integration comes with a full editor for resource files. Just double click on the resource file in the Projects view. The integrated Qt Designer
doesn't come with an extra resource editor.
Is there a way to make a menu in a QMainWindow that automatically redirects standard commands to the current widget ?
There is no automatic way to redirect the commands in a QMainWindow's http://doc.qt.io/qt-5/qmainwindow.html menu to the current widget. If you
would like e.g the Copy command to be redirected to the current widget, then you can listen for the QApplication::focusChanged() http://doc.qt.io/qt-
5/qapplication.html#focusChanged signal and connect that signal to a slot which determines which actions should be executed for the current widget.
How do I find out why my mouse and keyboard work in QVFb, but not on my target system?
Keyboard and mouse problems should always be debugged on the Linux frame buffer not in QVFb as QVFb uses X keyboard and mouse drivers.
To debug on the Linux frame buffer, run the application in a console on your desktop system, with the option: -display LinuxFb instead of -display QVFb.
How can I specify the spacing between the text and the icon for an item in a view?
In order to specify the margin between the decoration and the text for an item in a view, you can subclass the style and reimplement pixelMetric()
http://doc.qt.io/qt-5/qstyle.html#pixelMetric to return the value you want for PM_FocusFrameHMargin http://doc.qt.io/qt-5/qstyle.html#PixelMetric-enum
and/or PM_FocusFrameVMargin. Alternatively, you can reimplement paint() http://doc.qt.io/qt-5/qstyleditemdelegate.html#paint for the item delegate to
draw the margins as you want.
The following example demonstrates how this can be done by reimplementing pixelMetric():
#include <QtGui>
class Style: public QWindowsStyle
{
public:
Style() {}
int pixelMetric(PixelMetric metric, const QStyleOption *option = 0,
const QWidget *widget = 0) const
{
if (metric == PM_FocusFrameHMargin) {
return 10;
} else {
return QWindowsStyle::pixelMetric(metric, option, widget);
}
}
};
int main(int argc, char **argv)
{
QApplication app(argc, argv);
QTreeWidget tree;
tree.setStyle(new Style());
QPixmap pix(12, 12);
pix.fill(Qt::red);
QTreeWidgetItem *item1 = new QTreeWidgetItem(&tree);
item1->setText(0, "first");
item1->setIcon(0, QIcon(pix));
QTreeWidgetItem *item2 = new QTreeWidgetItem(&tree);
item2->setText(0, "second");
item2->setIcon(0, QIcon(pix));
tree.show();
return app.exec();
}