hello, i'm getting the following error:

RuntimeError: no access to protected functions or signals for objects
not created from Python

what i was trying to do is get the underlying lineEdit so i can set
the position of my context menu.

snippet:

class DateEdit(QtGui.QDateEdit):
  """Provides custom context menu"""
  def __init__(self, parent=None):
    super(DateEdit, self).__init__(parent)

  def contextMenuEvent(self, event):
    self.specialDatesMenu()

  def specialDatesMenu(self):
    menu = QtGui.QMenu('Special dates')
    icon = Icon('tango/16x16/mimetypes/x-office-calendar.png').getQIcon()

    menu.addAction(icon, 'today', self.setToday)
    pos = self.lineEdit().cursorRect().center()       # runtime error here
    menu.exec_(pos)

  def setToday(self):
    self.setDate(QtGui.QDate.currentDate())


what am i doing wrong? thanks.

-- 
paul victor noagbodji
_______________________________________________
PyQt mailing list    [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to