Results 1 to 7 of 7

Thread: QTableWidget mouseEvents

  1. #1
    Join Date
    Jul 2009
    Posts
    5

    Default QTableWidget mouseEvents

    Hello all,

    I have implemented a Class that inhertis QTableWidget und implemented the mouseEvent methods:
    Qt Code:
    1. void mousePressEvent(QMouseEvent* e);
    2. void mouseDoppelClickEvent(QMouseEvent* e);
    3. void mouseMoveEvent(QMouseEvent* e);
    To copy to clipboard, switch view to plain text mode 

    but I just receive a mousePressEvent when I doppel click on a widget. It is very curious!!! Has anyone an idea???
    best regards

  2. #2
    Join Date
    Aug 2008
    Posts
    134
    Thanks
    10
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTableWidget mouseEvents

    Please provide sample code other than above
    try using
    Qt Code:
    1. void setMouseTracking ( bool enable )
    To copy to clipboard, switch view to plain text mode 
    .

    please check the spelling of mouseDoppelClickEvent();
    it should be mouseDoubleClickEvent()

  3. #3
    Join Date
    Jul 2009
    Posts
    5

    Default Re: QTableWidget mouseEvents

    oh, yes, i misspelt double, thank you.
    now the following:
    at first double click, I still receive mosuePressEvent, after that I correctly receive mouseDoubleClickEvent.
    and then I always receive the same mouseDoubleClickEvent, it doesn't matter where I double click on my QGraphicsView!!!

    but I still don't receive mousePressEvent und mouseMoveEvent. I have to go mad!!!

    setMouseTracking(true) doen't help. I want to receive a mouseEvent only on click, double click, and move (press mouse button, move, release mouse button) and not mouse over etc.

    I hope somebody can help me

  4. #4
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QTableWidget mouseEvents

    try this
    Qt Code:
    1. graphicsView->viewport()->setMouseTracking(true);
    To copy to clipboard, switch view to plain text mode 
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  5. #5
    Join Date
    Jul 2009
    Posts
    5

    Default Re: QTableWidget mouseEvents

    graphicsView->viewport()->setMouseTracking(true); doesn't help too...

  6. #6
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QTableWidget mouseEvents

    then, prepare compilable example which reproduces the problem and post it.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  7. #7
    Join Date
    Jul 2009
    Posts
    5

    Default Re: QTableWidget mouseEvents

    I have fixed the problem. The reason was that I implemented my own GrpahicsView and I had implemented the mouse events in my GraphicsView too.
    It works perfect as soon as I remove the mouse events from MyGraphicsView.
    Thanks for your answers.

Similar Threads

  1. QComboBox in QTableWidget : display troubles.
    By Nyphel in forum Qt Programming
    Replies: 2
    Last Post: 13th October 2007, 23:29
  2. Select columns from a QTableWidget
    By toglez in forum Qt Programming
    Replies: 10
    Last Post: 7th October 2007, 15:15
  3. QTableWidget (resizing rows, turning off selection, etc.)
    By kiss-o-matic in forum Qt Programming
    Replies: 6
    Last Post: 11th January 2007, 01:57
  4. QTableWidget editing question
    By Trasmeister in forum Qt Programming
    Replies: 1
    Last Post: 20th September 2006, 18:46
  5. Replies: 6
    Last Post: 5th March 2006, 21:05

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.