Hi everyone.
I created a program based on the QCad Application framework that has a QTableWidget in a QDockWidget. I need to update contents of this table when user switches between opened files in the application. How can I be informed that user has selected a new tab in MDI area?
Update a table when user switches between opened tabs
Moderator: andrew
Forum rules
Always indicate your operating system and QCAD version.
Attach drawing files, scripts and screenshots.
Post one question per topic.
Always indicate your operating system and QCAD version.
Attach drawing files, scripts and screenshots.
Post one question per topic.
Re: Update a table when user switches between opened tabs
Creating a focus listener class:
function MyFocusListener() { RFocusListenerAdapter.call(this); } MyFocusListener.prototype = new RFocusListenerAdapter(); MyFocusListener.prototype.updateFocus = function(documentInterface) { // this will be called whenever the user switched to another document // documentInterface may be undefined if no document is open (last document was closed) // in this case, a widget is typically cleared };Installing the focus listener:
var appWin = EAction.getMainWindow(); var fl = new MyFocusListener(); appWin.addFocusListener(fl);
Re: Update a table when user switches between opened tabs
Thanks but I got this error :
Code: Select all
RMainWindow: Argument 0 is not of type RViewFocusListener *RViewFocusListener *.
Re: Update a table when user switches between opened tabs
Sorry, the last line should be:
appWin.addFocusListener(fl);(I've also corrected this in the previous post to avoid confusion for other readers).