Results 1 to 3 of 3

Thread: Disable MouseEvent function

  1. #1
    Join Date
    Jun 2013
    Posts
    46
    Thanks
    24
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Windows

    Question Disable MouseEvent function

    Good Day,

    Subclassed QGraphicsView
    Created functions for mouseMove & mousePressed events accordingly

    after that a user must be given the option to move the image in graphicsView
    how do I disable the mouseEvent functions so the user can move the image
    Qt Code:
    1. newImage2->setFlag(QGraphicsItem::ItemIsMovable); // this does not work because the mouse events were overridden
    To copy to clipboard, switch view to plain text mode 
    Is there a way I can create a Toggle button of sorts to decide which mouseEvent must be called

    Ideas please
    Kind Regards

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,356
    Thanks
    3
    Thanked 5,010 Times in 4,789 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Blog Entries
    4
    Wiki edits
    10

    Default Re: Disable MouseEvent function

    Call the base class implementation from your event handler.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. The following user says thank you to wysota for this useful post:

    2lights (26th August 2013)

  4. #3
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    658
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Disable MouseEvent function

    use event filter with mouseevent ..

    Qt Code:
    1. bool Window::eventFilter(QObject *watched, QEvent* e)
    2. {
    3. if (watched == chatEdit && e->type() == QEvent::MouseEvent) {
    4. /** ignore it */
    5. return true;
    6. }
    7. }
    8. return QWidget::eventFilter(watched, e);
    9. }
    To copy to clipboard, switch view to plain text mode 

    and dont forget to install it and remove whenever it required ..
    view->installEventFilter(this);
    "Behind every great fortune lies a crime" - Balzac

  5. The following user says thank you to wagmare for this useful post:

    2lights (26th August 2013)

Similar Threads

  1. qt mouseEvent
    By lapdx in forum Qt Programming
    Replies: 0
    Last Post: 8th November 2012, 13:37
  2. mouseEvent with two mice
    By yun in forum Newbie
    Replies: 0
    Last Post: 6th May 2009, 10:25
  3. problem in mouseEvent
    By wagmare in forum Qt Programming
    Replies: 7
    Last Post: 9th April 2009, 06:20
  4. How did I disable auto-scrolling function in tree-view
    By alfa_wu in forum Qt Programming
    Replies: 1
    Last Post: 28th September 2007, 08:31
  5. MouseEvent on a line
    By Kapil in forum Newbie
    Replies: 1
    Last Post: 25th March 2006, 08:52

Tags for this Thread

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.