[Qt-interest] Generating mouse press event; but text don't highlight

John McClurkin jwm at nei.nih.gov
Thu Sep 24 15:18:16 CEST 2009


Purushottam R S wrote:
> Sorry about my bad communication, Looks like I confused people.
> 
> Problem is: When I am generating Mouse Press event and then move the 
> mouse, the text is NOT highlighted.
> 
> (MousePressEvent handler, received "press" event properly)
> 
> Here is my code.: - (I doing this in QWebView derived class)
> 
> QPoint gpos = QCursor::pos();
> QMouseEvent *event;
> event = new QMouseEvent( QEvent::MouseButtonPress,
>                         mapFromGlobal( gpos ), gpos,
>                         Qt::LeftButton,Qt::NoButton,Qt::NoModifier);
> QApplication::postEvent(this,event);
> QApplication::processEvents();
> 
> 
> regards
> Purush

As Thiago said, highlighting requires a drag event. You don't seem to be 
  generating a drag event.
Why are you creating and posting your own mouse events?

> 
> ------------------------------------------------------------------------
> *From:* Purushottam R S <purushottam_r_s at yahoo.com>
> *To:* qt-interest at trolltech.com
> *Sent:* Thursday, 24 September, 2009 12:10:44 PM
> *Subject:* Generating mouse press event; but text don't highlight
> 
> Hi All,
> 
> I am generating Mouse Press event(without releasing) and It Works.
> But if I move the mouse after that, the text below mouse pointer is not 
> getting highlighted (selected). Can anybody tell me what is wrong..
> 
> Here is my code.: - (I doing this in QWebView derived class)
> 
> QPoint gpos = QCursor::pos();
> QMouseEvent *event;
> event = new QMouseEvent( QEvent::MouseButtonPress,
>                         mapFromGlobal( gpos ), gpos,
>                         Qt::LeftButton,Qt::NoButton,Qt::NoModifier);
> QApplication::postEvent(this,event);
> QApplication::processEvents();
> 
> regards
> Purush
> 
> ------------------------------------------------------------------------
> Now, send attachments up to 25MB with Yahoo! India Mail. Learn how 
> <http://in.rd.yahoo.com/tagline_galaxy_2/*http://in.overview.mail.yahoo.com/photos>.
> 
> ------------------------------------------------------------------------
> Now, send attachments up to 25MB with Yahoo! India Mail. Learn how 
> <http://in.rd.yahoo.com/tagline_galaxy_2/*http://in.overview.mail.yahoo.com/photos>.



More information about the Qt-interest-old mailing list