PDA

View Full Version : see-through and "click-through" program



been_1990
3rd October 2009, 01:08
I just finished building a analog clock. What I aim to do is re-create a cool feature I found on a Desktop clock program. Which is having the clock always on top of any windows(included movies playing fullscreen, but I dont want that...) and it being see-through and "click-through", in other words if I have to click on a window behind it, I can, while it continues to be on top of the window. I hope you can understand what I mean.. :o

wysota
3rd October 2009, 09:14
Sure we do. So what's the problem?

been_1990
3rd October 2009, 11:06
Haha.. Ok I discovered the name of the Clock I wanna copy, its called "ClocX". It has several options like:
Always on top
Pin to Desktop
Click through
Unmovable window
On mouse-over lower opacity
etc...

So those features I would like to copy. :) Especially the click-through, the others I might be able to do myself.
Link: www.clocx.net

been_1990
3rd October 2009, 11:35
:) .

soxs060389
3rd October 2009, 16:34
Well, you could just h ave said:

Is there a way to passthrough klicks through a Qt Application like blah blah does.
Plx help me, I did blah blah but no success.

Greets <your name here>

and btw I'd like to know that feature too, but I can't do anything at this point for you/me.

Greets

been_1990
7th October 2009, 03:09
someone else got an idea?

aamer4yu
7th October 2009, 06:00
Am not sure but may be Qt::WA_TransparentForMouseEvents can help you.

Also look for QWidget::setWindowOpacity , Qt::WA_TranslucentBackground

SABROG
7th October 2009, 07:06
Qt::WA_TransparentForMouseEvents works only on child widgets, not for top level main windows.

I heard what possible cut 1 pix hole under mouse cursors for this.

been_1990
14th October 2009, 12:28
Qt::WA_TransparentForMouseEvents may work for me cause my clock is a QT::Tool and child widget. I did that so the clock would not get a taskbar button. Will try and post results.

been_1990
16th October 2009, 01:30
Qt::WA_TransparentForMouseEvents did not work. It makes my clock not appear.

been_1990
18th October 2009, 20:03
so..? Anyone know why? Does anyone have a working example?

wysota
18th October 2009, 20:34
Does anyone have a working example?

How about showing us a non-working one first?

been_1990
19th October 2009, 12:44
Ok.
This is my main.cpp:

int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Widget w;
w.show();
return a.exec();
}

This is Widget class .cpp:

#include <QtGUI>
#include "ui_widget.h"
#include "clock.h"


Widget::Widget(QWidget *parent)
: QWidget(parent), ui(new Ui::Clock)
{
ui->setupUi(this);
Clock c;
c.show();
}

Widget::~Widget()
{
delete ui;
}

And here is clock.cpp


Clock::Clock(QWidget *parent)
: QGraphicsView(parent)
{
setWindowFlags(Qt::FramelessWindowHint);
setWindowFlags(Qt::Tool | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
setStyleSheet("background: transparent; border: none");
this->setAttribute(Qt::WA_TranslucentBackground);
this->setAttribute(Qt::WA_TransparentForMouseEvents);
}

I didn't post the whole files, but if needed no prob.