Results 1 to 3 of 3

Thread: how to catch "click" signal on the dialog

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2010
    Posts
    21
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default how to catch "click" signal on the dialog

    Hello,

    I want to catch "click" signal when the mose is clicked on a dialog, so that, I will implement a slot. Is there a way to do that?

    Thanks for help...

  2. #2
    Join Date
    Feb 2011
    Posts
    14
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: how to catch "click" signal on the dialog

    Code attached:

    untitled.zip

    Basically You define a Signal in your dialog H File:
    ///////////////////
    signals:
    void clicked();
    /// It could be any name....
    ///////////////////

    Then You go a little deeper and define a function in the dialog H File

    virtual void mousePressEvent ( QMouseEvent * event );

    and define it as
    void MainWindow::mousePressEvent ( QMouseEvent * event )
    {
    emit clicked();
    }

    And Lo! You have your own SIGNAL that can be attached to any slot!

  3. The following user says thank you to venkateshhegde for this useful post:

    fulbay (16th February 2011)

  4. #3
    Join Date
    Oct 2010
    Posts
    21
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: how to catch "click" signal on the dialog

    Many many thanks for your help!

Similar Threads

  1. [WebKit] catch "page not found" error
    By maston in forum Qt Programming
    Replies: 3
    Last Post: 16th November 2010, 15:44
  2. Replies: 2
    Last Post: 20th March 2010, 18:22
  3. Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")
    By victor.yacovlev in forum Qt Programming
    Replies: 4
    Last Post: 24th January 2008, 19:05
  4. How to catch "ENTER" with keyPress?
    By lumber44 in forum Qt Programming
    Replies: 8
    Last Post: 30th July 2007, 16:21
  5. Signal defined in "a.h" can not emit in "b.cpp"
    By Shawn in forum Qt Programming
    Replies: 9
    Last Post: 21st May 2007, 16:55

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
  •  
Qt is a trademark of The Qt Company.