Вот вариант для Windows 2000 и выше с использованием WinAPI
widget.h
C++ (Qt)
#ifndef WIDGET_H
#define WIDGET_H
#include <QtGui/QWidget>
namespace Ui {
class Widget;
}
class Widget : public QWidget
{
Q_OBJECT
public:
explicit Widget(QWidget* parent = 0);
~Widget();
Q_INVOKABLE void callAfterStartEventLoop();
private:
Ui::Widget* ui;
};
#endif // WIDGET_H
widget.cpp
C++ (Qt)
#define WINVER 0x0502
#define WIN32_LEAN_AND_MEAN
#define NOCOMM
#include <windows.h>
#include "widget.h"
#include "ui_widget.h"
Widget::Widget(QWidget* parent) :
QWidget(parent, Qt::WindowStaysOnTopHint),
ui(new Ui::Widget)
{
ui->setupUi(this);
QMetaObject::invokeMethod(this, "callAfterStartEventLoop", Qt::QueuedConnection);
}
Widget::~Widget()
{
}
void Widget::callAfterStartEventLoop()
{
#if defined(Q_WS_WIN)
HWND hWnd = effectiveWinId();
SetWindowLong(hWnd, GWL_EXSTYLE, GetWindowLong(hWnd, GWL_EXSTYLE) | WS_EX_LAYERED | WS_EX_TRANSPARENT);
SetLayeredWindowAttributes(hWnd, 0, 255, LWA_ALPHA);
#endif
}