PDA

View Full Version : mouse doubleclick event on widgets inside the custom-dialog



SSqt5.2
21st October 2014, 11:57
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

anda_skoa
21st October 2014, 16:59
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,
_