Results 1 to 4 of 4

Thread: Qt MousePressEvent on QTableWidget project

  1. #1
    Join Date
    Nov 2013
    Posts
    15
    Qt products
    Qt5
    Platforms
    MacOS X Windows

    Default Qt MousePressEvent on QTableWidget project

    I want to use MousePressEvent but I dont know how I need to create the files...(main.cpp, ProjectQt.cpp,ProjectQt.h)

    Anyone help me to run MousePressEvent on a QTableWidget application. for example I found the event method but I dont know how I can run the method.

    Qt Code:
    1. void mousePressEvent ( QMouseEvent * event ){
    2. if(event->button() == Qt::LeftButton){
    3.  
    4. }
    5. }
    To copy to clipboard, switch view to plain text mode 

    Anyone help me?

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Qt MousePressEvent on QTableWidget project

    Maybe it is even better if you ask about the thing you actually want to do.
    There could be an easier way than to implement your own mouse handling, e.g. already existing signals.

    Cheers,
    _

  3. #3
    Join Date
    Nov 2013
    Posts
    15
    Qt products
    Qt5
    Platforms
    MacOS X Windows

    Default Re: Qt MousePressEvent on QTableWidget project

    I can insert new Rows on a QTableWidget and can select items on that table. How can I unselect the selected items on the QTableWidget? I think I can do that action with mousePressedEvent. But I dont know how...


    Added after 33 minutes:


    I think the method can use like that but I still dont know X and Y . anyone know ?


    connect(X,SIGNAL(Y),this,SLOT(mousePressEvent()));
    Last edited by citix; 16th January 2014 at 14:05.

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Qt MousePressEvent on QTableWidget project

    Have you tried a different selection mode?

    If that does not work, what about connecting to the cellPressed() signal?

    Cheers,
    _

Similar Threads

  1. mousePressEvent with QColumnView
    By BreakBad in forum Qt Programming
    Replies: 2
    Last Post: 13th August 2013, 20:43
  2. mousePressEvent problem
    By jhowland in forum Qt Programming
    Replies: 9
    Last Post: 19th April 2010, 00:53
  3. Replies: 8
    Last Post: 16th April 2010, 10:41
  4. MousePressEvent for QTextEdit
    By anju123 in forum Qt Programming
    Replies: 9
    Last Post: 16th August 2007, 07:08
  5. mousePressEvent
    By mickey in forum Newbie
    Replies: 3
    Last Post: 21st March 2006, 16:36

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.