PDA

View Full Version : MouseEvent & QTextEdit



Sarma
7th March 2006, 10:31
Sir,
Iam having a problem with mouseDoubleClickEvent. Iam showing you the part of my code:

CPT::CPT(QWidget *parent):QWidget(parent)
{
//various child widgets are added
QTextEdit *te=new QTextEdit(this);
//some other widgets
}

Since te is the child widget of CPT, I cannot catch the mouseDoubleClickEvent on it , if I write the following:
void CPT::mouseDoubleClickEvent(QMouseEvent *)
{ ... }

How can I catch this event when mouse is double clicked on te. Kindly show the code part if possible.

Thanks alot ,
Sarma.

Edit/Delete Message

jpn
7th March 2006, 10:33
Please do not double post, and use code-tags around your code postings to make it more readable..

oob2
7th March 2006, 23:06
CPT::CPT(QWidget *parent)
:QWidget(parent)
{
QTextEdit *te=new QTextEdit(this);
connect(te, SIGNAL(doubleClicked(int, int)), SLOT(teDoubleClicked(int,int)));
}

void CPT::teDoubleClicked(int para, int pos)
{
//your code here
}