Results 1 to 2 of 2

Thread: mouse doubleclick event on widgets inside the custom-dialog

  1. #1
    Join Date
    Aug 2014
    Posts
    22
    Thanks
    5
    Qt products
    Qt5

    Default mouse doubleclick event on widgets inside the custom-dialog

    Hi All,
    I have created a custom dialog to accept name(line-edit) and phone-number(line-edit) from user.
    I want to handle double click event on line edit for number entry.

    i am able to get the mouse double click event on Dialog but not onthe line-edit.
    Below is the code. please check for error/modification.

    class MYDialog : public QDialog
    {
    Q_OBJECT

    protected:

    private slots:


    public:
    explicit Dialog(QWidget *parent = 0);
    ~Dialog();

    void mouseDoubleClickEvent ( QMouseEvent * event);

    QString *val_from_numpad;

    private:
    Ui::Dialog *ui;
    };


    void MYDialog::mouseDoubleClickEvent ( QMouseEvent * event)
    {
    //event;
    qDebug() << "Double click event on line edit";
    }


    Thanks in Advance

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,419
    Thanks
    37
    Thanked 1,546 Times in 1,496 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: mouse doubleclick event on widgets inside the custom-dialog

    Well, you are implementing the dialog's event handler for double click, not the one of a line edit.

    Naturally you are getting the events for that object not for a different one.

    Either implement that in a QLineEdit subclass or use an event filter.

    Cheers,
    _

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

    SSqt5.2 (28th October 2014)

Similar Threads

  1. Replies: 3
    Last Post: 7th August 2015, 13:37
  2. Assigning event filter for widgets inside groupbox
    By mania in forum Qt Programming
    Replies: 3
    Last Post: 21st June 2014, 23:37
  3. Replies: 1
    Last Post: 5th December 2012, 11:03
  4. Replies: 0
    Last Post: 16th July 2012, 10:56
  5. Replies: 3
    Last Post: 7th January 2012, 09:38

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.