Results 1 to 13 of 13

Thread: see-through and "click-through" program

  1. #1
    Join Date
    Oct 2008
    Posts
    306
    Thanks
    6
    Thanked 9 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default see-through and "click-through" program

    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..

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,365
    Thanks
    3
    Thanked 5,014 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: see-through and "click-through" program

    Sure we do. So what's the problem?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Oct 2008
    Posts
    306
    Thanks
    6
    Thanked 9 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: see-through and "click-through" program

    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

  4. #4
    Join Date
    Oct 2008
    Posts
    306
    Thanks
    6
    Thanked 9 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: see-through and "click-through" program

    .
    Last edited by been_1990; 3rd October 2009 at 12:07. Reason: double post

  5. #5
    Join Date
    Sep 2009
    Posts
    36
    Thanks
    4
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: see-through and "click-through" program

    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

  6. #6
    Join Date
    Oct 2008
    Posts
    306
    Thanks
    6
    Thanked 9 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: see-through and "click-through" program

    someone else got an idea?

  7. #7
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: see-through and "click-through" program

    Am not sure but may be Qt::WA_TransparentForMouseEvents can help you.

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

  8. #8
    Join Date
    Apr 2008
    Location
    Russia, Moscow
    Posts
    86
    Thanks
    2
    Thanked 7 Times in 7 Posts
    Qt products
    Qt4

    Default Re: see-through and "click-through" program

    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.

  9. #9
    Join Date
    Oct 2008
    Posts
    306
    Thanks
    6
    Thanked 9 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: see-through and "click-through" program

    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.

  10. #10
    Join Date
    Oct 2008
    Posts
    306
    Thanks
    6
    Thanked 9 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: see-through and "click-through" program

    Qt::WA_TransparentForMouseEvents did not work. It makes my clock not appear.

  11. #11
    Join Date
    Oct 2008
    Posts
    306
    Thanks
    6
    Thanked 9 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: see-through and "click-through" program

    so..? Anyone know why? Does anyone have a working example?

  12. #12
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,365
    Thanks
    3
    Thanked 5,014 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: see-through and "click-through" program

    Quote Originally Posted by been_1990 View Post
    Does anyone have a working example?
    How about showing us a non-working one first?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  13. #13
    Join Date
    Oct 2008
    Posts
    306
    Thanks
    6
    Thanked 9 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: see-through and "click-through" program

    Ok.
    This is my main.cpp:
    Qt Code:
    1. int main(int argc, char *argv[])
    2. {
    3. QApplication a(argc, argv);
    4. Widget w;
    5. w.show();
    6. return a.exec();
    7. }
    To copy to clipboard, switch view to plain text mode 

    This is Widget class .cpp:

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

    Qt Code:
    1. Widget::Widget(QWidget *parent)
    2. : QWidget(parent), ui(new Ui::Clock)
    3. {
    4. ui->setupUi(this);
    5. Clock c;
    6. c.show();
    7. }
    8.  
    9. Widget::~Widget()
    10. {
    11. delete ui;
    12. }
    To copy to clipboard, switch view to plain text mode 

    And here is clock.cpp

    Qt Code:
    1. Clock::Clock(QWidget *parent)
    2. : QGraphicsView(parent)
    3. {
    4. setWindowFlags(Qt::FramelessWindowHint);
    5. setWindowFlags(Qt::Tool | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
    6. setStyleSheet("background: transparent; border: none");
    7. this->setAttribute(Qt::WA_TranslucentBackground);
    8. this->setAttribute(Qt::WA_TransparentForMouseEvents);
    9. }
    To copy to clipboard, switch view to plain text mode 

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

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.