Important: Please read the Qt Code of Conduct -

Handling Edit Menu Items (Cut, Copy, Paste, etc.) with multiple widgets

  • I have an application in which the main windows have two widgets than can receive edit actions, depending on where the focus is. One is a QPlainTextEdit, the other is a custom window displaying waveforms. I am wondering what the "best" or "official" way to deal with this is?

    I can implement an action handler in the main window that directs the actions to the widget with current focus. I would also have to handle enabling or disabling the associated menu item depending on whether the widget with focus has any selection (QPlainText Edit provides a signal for this).

    Is there a better way to do this, perhaps entirely with signals and slots directly to the widgets?

    Any suggestions or examples would be very helpful.

    Regards, Glenn

Log in to reply