Qt based UI in plugin c++

Typically: "How do I... ", "How can I... " questions
Post Reply
vrepUser1
Posts: 10
Joined: 22 Oct 2016, 16:20

Qt based UI in plugin c++

Post by vrepUser1 »

Hi,
I didnt find out how to use the functions of the Qt based plugin (v_repExtCustomUI) in my own plugin in c++. What I'm missing?

Best
vrepUser1

fferri
Posts: 1217
Joined: 09 Sep 2013, 19:28

Re: Qt based UI in plugin c++

Post by fferri »

The CustomUI plugin only provides a Lua interface.

If you are writing a C++ plugin, you can use the Qt API directly.

The only aspect you should take care of is threads: there are two threads where your code can be run:
  • the main (UI) thread, where the user interface code and Qt widgets are running
  • the SIM thread, where the V-REP API must be called.
Plugin entry-points and messages can be called from the UI or SIM thread (check the documentation), so be careful about running things in the correct thread. You can use Qt's signal-slot mechanisms to easily send messages across threads.

vrepUser1
Posts: 10
Joined: 22 Oct 2016, 16:20

Re: Qt based UI in plugin c++

Post by vrepUser1 »

Hi fferri,
thank you for the hints. So you mean I should only call Qt functions during the callback-message which are marked as "(called from the UI thread)", like "sim_message_eventcallback_guipass (called from the UI thread)"?

Best,
vrepUser1

fferri
Posts: 1217
Joined: 09 Sep 2013, 19:28

Re: Qt based UI in plugin c++

Post by fferri »

Yes, exactly.

Also: only call the V-REP API functions from those messages NOT marked as "called from the UI thread".

Post Reply