Results 1 to 7 of 7

Thread: Possible to call QMouseEvent inside a function?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Join Date
    Nov 2010
    Posts
    97
    Thanks
    6
    Thanked 11 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Possible to call QMouseEvent inside a function?

    Quote Originally Posted by shuawinn View Post
    void ParaConnectWidget::linedrawer()
    {
    mousePressEvent(QMouseEvent *)
    mousePressEvent(QMouseEvent *)
    }
    That's not legal C++; you don't pass types as function parameters, only variables. You could probably build a QMouseEvent and pass it on, but I doubt that would work as you intend it to.

    Most UI libraries have a way to queue new events, I'd assume Qt is no different. I don't know how though and again, I doubt that's what you want anyway.

    IMNSHO, this is an incorrect use of the event system. Your linedrawer() function should be constructing something to tell some object to draw a line, something that would also be constructed by the event system when user interaction would result in the same outcome.

  2. The following user says thank you to nroberts for this useful post:

    shuawinn (23rd December 2010)

Similar Threads

  1. Replies: 4
    Last Post: 7th May 2012, 15:39
  2. Qt function call in vb.net
    By abghosh in forum Qt Programming
    Replies: 7
    Last Post: 6th March 2010, 17:00
  3. Cannot call OpenCV 2.0 functions inside Qt slots
    By Asfer in forum Qt Programming
    Replies: 2
    Last Post: 19th February 2010, 11:48
  4. Replies: 3
    Last Post: 5th February 2010, 19:48
  5. trying to call Xlib inside qt app
    By phixx in forum Qt Programming
    Replies: 4
    Last Post: 12th February 2008, 20:28

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
  •  
Qt is a trademark of The Qt Company.