I have tried the installeventFilter as well, I am now pasting the code as I think it might be the problem with my code.
Here is my class:
Qt Code:
  1. SelectableItem_C::SelectableItem_C(QWidget* parent)
  2. {
  3. _label_textedit = new QTextEdit(this);
  4. _label_textedit->setFont(font);
  5. _label_textedit->setAlignment(Qt::AlignCenter);
  6. _label_textedit->setPaletteBackgroundColor(dark_background);
  7. _label_textedit->setAutoFillBackground(true);
  8. _label_textedit->setFrameShape(QFrame::NoFrame);
  9. _label_textedit->setWordWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
  10. _label_textedit->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  11. _label_textedit->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  12. _label_textedit->setTextInteractionFlags(Qt::NoTextInteraction);
  13.  
  14.  
  15. QSizePolicy sizePolicy(static_cast<QSizePolicy::Policy>(5), static_cast<QSizePolicy::Policy>(5));
  16. sizePolicy.setHorizontalStretch(0);
  17. sizePolicy.setVerticalStretch(0);
  18. sizePolicy.setHeightForWidth(_label_textedit->sizePolicy().hasHeightForWidth());
  19. _label_textedit->setSizePolicy(sizePolicy);
  20.  
  21. _label_textedit->viewport()->setCursor(Qt::ArrowCursor);
  22. _label_textedit->installEventFilter(this);
  23. _label_textedit->viewport()->setMouseTracking(true);
  24.  
  25. }
To copy to clipboard, switch view to plain text mode 

and here is the event filter function in this class
Qt Code:
  1. bool SelectableItem_C::eventFilter( QObject *obj, QEvent *ev )
  2. {
  3. //printf("got in\n");
  4. if ( obj == _label_textedit )
  5. {
  6. if ( ev->type() == QEvent::MouseButtonPress )
  7. {
  8. emit MousePressed_Signal(this);
  9. return TRUE;
  10. }
  11. }
  12. else
  13. {
  14. //printf("af: %d,%d\n",e->x(),e->y());
  15. // pass the event on to the parent class
  16. return QWidget::eventFilter( obj, ev );
  17. }
  18. return TRUE;
  19. }
To copy to clipboard, switch view to plain text mode 
I have defined a "MousePressed_Signal" which is doing the desired work.
I could not even come in to the "If condition" with my debugging.
One more thing is that I have overridden the functions "mousePressEvent" and "mouseDoubleClickEvent" for my class. I can see that control goes to the function "mouseDoubleClickEvent" when I double click on the QTextEdit control, but not when I just do a single click on the same QTextEdit ?