problem with creating pixmap that can be toggled by an external event (and more)
Ivica Bukvic
ico at fuse.net
Sat Nov 24 09:00:30 GMT 2001
Hi, I am relatively new to the KDE/Qt scene, but do have already some
experience with programming. Currently I am kinda stuck in my project
trying to do the following:
(Btw I am using Kdevelop 2.0 on 8.1 mdk linux, and have designed
front-end with the Qt designer)
I am working on an app that will have a audio playback transport control
(i.e. play, stop, rew, ff etc.) and a led-lamp which comes on when
playback is happening, off when it's not and blinking when the playback
is paused. Simple enough.
I've created a separate pthread which deals with accurate timing and
feeds the main widget class with updated timer values when needed, so
that when the playback is paused, it triggers the particular class slot
every second in order to make the led lamp blink. So what happens is
that since the pixmap has been originally declared as Qlabel pixmap by
Qt designer, I decided to change its contents by calling
PlayIndicator->setPixmap( image1 ); (where playindicator is the Qlabel,
and image1 is an image converted from a file) and have an if statement
and a control variable that toggles the appearance between two images in
a timely fashion, so that it appears to be blinking. The problem is that
when the program is set into motion, the lamp "blinks" ONLY while I move
the mouse, press stuff on keyboard, or click with the mouse (I do not
have to click on anything particular, but just have to keep
moving/clicking anywhere on the desktop). Otherwise the image does not
change. I've tried update() and repaint(x,y,w,h) methods, but none
worked.
Could someone please tell me why does the Qlabel pixmap fail to update
image contents when asked to do so if there is no mouse/keyboard
activity and how can I make it update itself without being dependent on
mouse/keyboard? QMovie really does not seem practical for this kind of
situation, since this led-lamp has multifunction purpose and most of
them pertain to non-animated states.
The second question refers to a fact that LCD Number widget does not
support mouse events on it, but I am trying to implement that due to my
need to create as user-friendly of an interface as possible, so that
user by clicking onto the lcd number's digit would with LEFT click
INCREASE value by one, while with RIGHT click decrease by one. Could
someone please explain me how can I go about achieving this? Do I need
to put the LCD on top of the hidden button widget or something, and then
indirectly control the lcd value through secondary mouse-aware widget,
or is there a more elegant way of solving this problem?
Finally, is there a way in Qt to differentiate between the left and
right clicks? If so could you please tell me how?
Thank you for your assistance! Sincerely,
Ivica Bukvic
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop/attachments/20011124/c0b8f0f3/attachment.html>
More information about the KDevelop
mailing list