[Interest] Creating Desktop Widgets (aka Desklets) in Qt

Jiří Procházka ojirio at gmail.com
Wed Jul 25 10:07:16 CEST 2012


> > Sent: Wednesday, 25 July 2012 1:35 AM
> > 
> > Hi, I am tasked in creating desktop widgets (aka desklets, stuff like
> > system monitors, clocks, etc) in Qt, the target platform is Windows.
> > 
> > So far I managed to create a frameless window which stays on bottom
> > and isn't shown on taskbar by following window flags: Qt::SubWindow |
> > Qt::FramelessWindowHint | Qt::WindowStaysOnBottomHint
> > 
> > However no matter what I tried, I didn't manage to keep the desklets
> > shown when user presses the Windows "show desktop" icon. Does anybody
> > know a way?
> > 
> > The desklet class is a subclass of QWidget, using QDesktopWidget
> > doesn't help the situation at all (and from docs it's clear it is for
> > different purpose). I tried intercepting events which make the
> > desklet hide, but it seems this is a special case not handled by any
> > event... I tried all prospective window flags, even those more crazy
> > in the aspect. But all to no avail...
> 
> They are called gadgets on Windows. From a quick read, I doubt Qt is any
> use:
> 
> http://msdn.microsoft.com/en-us/library/windows/desktop/bb456468%28v=vs.85%29.aspx
> 
> Regards,
> 
> Tony
>

That is not really what I am looking for, since my target platform
should include Windows XP, also it would be nice if it ran on other
platforms.
On the other hand I made a quite exciting discovery that window type
Qt::ToolTip is shown even when "show desktop" is clicked, but the
problem is that it implies always-on-top.
Weird is that with:
QWidget(0, Qt::ToolTip | Qt::FramelessWindowHint)
the widget shows correctly on top, however with:
QWidget(0, Qt::ToolTip | Qt::FramelessWindowHint |
Qt::WindowStaysOnBottomHint)
it shows on bottom (correctly displaying warning "Incompatible window
flags: the window can't be on top and on bottom at the same time") and
hiding when "show desktop", which seems to be in contradiction with:
http://qt.gitorious.org/qt/qt/blobs/092cd760d5fddf9640a310214fe01929f0fff3a8/src/gui/kernel/qwidget_win.cpp#line441
(git tag of Qt 4.7.4 which is what I use).
Any insight and suggestion are welcome.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120725/6dcbe7ac/attachment.sig>


More information about the Interest mailing list