Results 1 to 4 of 4

Thread: adding right click to tableview cells

  1. #1
    Join Date
    Nov 2012
    Posts
    35
    Thanks
    1
    Thanked 7 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Question adding right click to tableview cells

    I want to have a right click menu from which i can rename, delete or open the selected image in QTableView from cells.

    Here is what I have so f
    Qt Code:
    1. def _connections(self):
    2. self.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
    3. self.connect(self, QtCore.SIGNAL(self.customContextMenuRequested(QtCore.QPoint)), self, QtCore.SLOT(displayMenu(QtCore.QPoint)))
    4. if self._slideShowWin:
    5. self._slideShowWin.bar.galrBtn.clicked[bool].connect(self._openSlideShow)
    6.  
    7. def displayMenu(self, pos):
    8. self.menu = QtGui.QMenu()
    9. self.menu.addAction(self.close)
    10. self.menu.exec_(self.mapToGlobal(event.pos()))
    To copy to clipboard, switch view to plain text mode 


    But keep getting the error saying
    self.connect(self, QtCore.SIGNAL(self.customContextMenuRequested(QtCo re.QPoint)), self, QtCore.SLOT(displayMenu(QtCore.QPoint)))
    TypeError: native Qt signal is not callable

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

    Default Re: adding right click to tableview cells

    My guess would be the "self." inside the SIGNAL() is wrong.

    Cheers,
    _

  3. #3
    Join Date
    Nov 2012
    Posts
    35
    Thanks
    1
    Thanked 7 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: adding right click to tableview cells

    Quote Originally Posted by anda_skoa View Post
    My guess would be the "self." inside the SIGNAL() is wrong.

    Cheers,
    _
    self is my QTableView

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

    Default Re: adding right click to tableview cells

    Quote Originally Posted by krystosan View Post
    self is my QTableView
    Yes it is. How is that related to what I wrote?

    Cheers,
    _

Similar Threads

  1. Adding HTML code into QTableWidget cells
    By a5633Oy in forum Qt Programming
    Replies: 0
    Last Post: 18th December 2013, 13:18
  2. Preventing display spinbox in tableview cells
    By alizadeh91 in forum Qt Programming
    Replies: 2
    Last Post: 30th December 2012, 11:48
  3. Replies: 0
    Last Post: 28th October 2011, 18:46
  4. Replies: 1
    Last Post: 7th May 2011, 20:24
  5. right click in TableView?
    By nategoofs in forum Qt Programming
    Replies: 1
    Last Post: 14th August 2007, 06:32

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.