Results 1 to 3 of 3

Thread: multiple calls to QTableWidget::cellDoubleClicked(int,int) slot

  1. #1
    Join Date
    May 2014
    Posts
    2
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default multiple calls to QTableWidget::cellDoubleClicked(int,int) slot

    Hello everybody,

    This is my fist post on this forum. I am a rather experimented programmer on Visual C++ and have been moving to Qt since a few months (with the idea of never come back to VC++). I use Qt 5.2.0 with the minGW compiler on Windows 7 64bits.

    I have a MDI application, each MDI child window contains a QSplitter, one of the panes of the Splitter contains a QTabWidget which in turn contains a QTableWidget. I want deal with a double click on a cell of the QTableWidget* tableWidget on the splitter window (because I want to act on another pane of the splitter), so I wrote a public slot in the splitter window 'on_cellDoubleClicked(int row,int col)' and connected it:

    connect(tableWidget,SIGNAL(cellDoubleClicked(int,i nt)),this,SLOT(on_cellDoubleClicked(int,int)));

    The connection works fine, the problem is that when I double-click ONCE on a tableWidget cell, the slot on_cellDoubleClicked(int,int)) is called MANY TIMES in succession, typically eigth times.

    Does someone knows what is the problem ? Thanks in advance.

    Jean-Claude

  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: multiple calls to QTableWidget::cellDoubleClicked(int,int) slot

    This is strange.

    Could you have multiple connections to the same slot, e.g. the same connect having been executed multiple times or the signal being connected to multiple receiver instances?

    Cheers,
    _

  3. #3
    Join Date
    May 2014
    Posts
    2
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: multiple calls to QTableWidget::cellDoubleClicked(int,int) slot

    Your are perfectly right. Instead of calling connect() in the constructor, I called it on the function that displays data on the QTableWidget. I moved the connect() to the constructor and the problem disapeared!

    Thank you very much!

Similar Threads

  1. QTableWidget cellClicked and cellDoubleClicked
    By WikiWiki in forum Qt Programming
    Replies: 1
    Last Post: 10th May 2013, 11:39
  2. Replies: 2
    Last Post: 19th October 2011, 10:30
  3. Error Exiting slot calls
    By jacks916 in forum Qt Programming
    Replies: 10
    Last Post: 11th August 2011, 13:19
  4. Replies: 2
    Last Post: 1st August 2010, 10:55
  5. multiple QTimer::singleShot() calls?
    By mattc in forum Qt Programming
    Replies: 1
    Last Post: 27th July 2009, 20:22

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.