Maverick33
Maverick33

Reputation: 337

How to communicate with Qt widget through external command?

I'm working on a tool, on the main window of the tool there are few Qt widgets added on it. When we used to RMB click on the Qt widget, a context menu pops up (and via eventFilter few functions have been called) to do the required work- say, doTask() slot gets called up with the receiver object.

Now I have to add a banner menu on the window, which has to copy all the features of RMB context menu. Since this banner menu is not of Qt, but written in some internal functions (say, LISP) I have problems in calling that slot function - doTask(), as I don't know what is the receiver object.

How can I communicate with a Qt widget through some external command/language?

Please add comment if anything is not clear in this.

Upvotes: 0

Views: 201

Answers (2)

MSalters
MSalters

Reputation: 179789

Your basic problem is just knowing the receiver object. Once you do, you can call its slot directly (doesn't need to go through a signal).

The menu knows this, because it keeps a pointer to the receiver object. Your own banner menu must do the same. "It doesn't know the receiver object" must therefore be fixed.

Upvotes: 1

GazTheDestroyer
GazTheDestroyer

Reputation: 21241

Can you not expose a simple C style method from a QT aware object that acts as a proxy for the slot calls. ie Your banner calls method, method then calls appropriate slots?

Upvotes: 1

Related Questions