Important: Please read the Qt Code of Conduct -

createStandardContextMenu() for others than QLineEdit/QTextEdit/QPlainTextEdit

  • I am wondering why only these three classes provide that function, whereas QDateTimeEdit (and its subclasses QDateEdit + QTimeEdit) do not.

    When I simple want to an additional menu entry in QDateEdit to set the field to the current day (or similar) it seems that I have to copy the code from QAbstractSpinBox::contextMenuEvent(...) or is there a nicer way to do this?

  • Lifetime Qt Champion


    Might be a simple as the use case never showed up. You can try using an event filter and catch QContextMenuEvent

    Hope it helps

Log in to reply