Results 1 to 10 of 10
Hybrid View
-
16-01-2010, 12:16 #1
-= TeamSpeak User =-
- Join Date
- Jan 2010
- Location
- Europe
- Posts
- 12
[Solved] QApplication & QWidget in the Plugin crashes
I am trying to create a widget inside the plugin, however since you cant have 2 QApplications in one Project its not running stable.
I am using QT 4.5.3 and visual studio 2008
I've read that it should work with the qApp macro.
But since the macro returns a NULL pointer it clearly does not work.
So, was anyone actually able to display a widget?
And if yes, how?
It is kind of beyond why there isnt a function in the api where I can register/pass a QWidget pointer since the client is working with Qt and it shouldnt be a problem to let the client display plugin widgets.
This way you could embed the plugins configwidget and have a uniform look for all config windows.
And you could very easily add/extend existing parts of the client.
Anyway, any suggestions as to how to get this working (stable
) are appreciated.
Last edited by Honc__; 10-02-2010 at 16:52.
-
16-01-2010, 12:46 #2
-= TeamSpeak User =-
- Join Date
- Jul 2006
- Location
- Germany
- Posts
- 11
I did just create a simple Win32 dialog box (without anything in it) and the client crashed on me, so you are not alone with Qt.
-
16-01-2010, 14:45 #3
-= TeamSpeak User =-
- Join Date
- Jan 2010
- Location
- Germany
- Posts
- 21
I had the same problem when I tried to create a QT form.
The following snippet shows what I did. First I thought the crash had sth. to do with the uninitialized argv pointer. But then I commented out everything above "ConfigDialog configDialog = (0, Qt:
ialog);" and the crash were still there.
Code:/* Plugin might offer a configuration window.I f ts3plugin_offersConfigure returns 0, this function does not need to be implemented. */ void ts3plugin_configure(void* handle) { // create a new instance of QApplication with params argc and argv int argc = 0; char **argv; QApplication app( argc, argv ); // create a new instance of MainWindow with no parent widget ConfigDialog configDialog = (0, Qt::Dialog); // Shows the widget and its child widgets. configDialog.show(); ts3Functions.logMessage("QT application created", LogLevel_DEBUG, LOG_CHANNEL, NULL); // Enters the main event loop and waits until exit() is called // or the main widget is destroyed or by default the last window closed, // and returns the value that was set via to exit() // (which is 0 if exit() is called via quit()). app.exec(); }
-
17-01-2010, 02:12 #4
-= TeamSpeak User =-
- Join Date
- Jan 2010
- Location
- Switzerland
- Posts
- 6
currently (client beta9), you cannot use Qt (in a stable way) because Qt requires that _all_ of its functionality that could potentially cause drawing to be in the Qt main thread (also referred to as GUI thread). Since the ts3plugin_configure hook is not called by this said main thread, this requirement is hard to meet :-). It's done this way because other UI frameworks may require to be in a different thread when showing a window blocks. Still, Qt being the framework used by TS3 itself, it should be useable for plugin configuration windows. They promised me, the next beta will get a change, to make this work. Please see:
http://forum.teamspeak.com/showthread.php?t=49772
You also may read there, why the qApp macro returns a NULL pointer. Short version: creating an instance of QApplication in your plugin calls for trouble, because there's already one there, you just can't see it. You need to link against the same Qt libraries the TS3 application comes bundled with.Last edited by ch4llenger; 17-01-2010 at 21:14.
-
17-01-2010, 12:38 #5
-= TeamSpeak User =-
- Join Date
- Jan 2010
- Location
- Europe
- Posts
- 12
Thank you for clearing that up. Was pretty sure it was a thread problem, but since I've never tried to do it that way I was not certain.
So the only solution would be a function where you can pass your widget to the client application so it can be displayed by the gui thread.
I guess we'll have to wait for the next beta release then.
Is there a release date for the next beta?Last edited by Honc__; 17-01-2010 at 12:54.
-
17-01-2010, 16:14 #6
-= TeamSpeak User =-
- Join Date
- Jan 2010
- Location
- Switzerland
- Posts
- 6
At least I'm not aware of a release date. I hope soon.
As pointed out by PeterS in the other thread, the solution will not be a callback which can return a pointer to a QWindow. Instead, we will be given the choice wether the ts3plugin_configure hook is called from the main (gui) thread or by a separate thread, which should be enough to open a QWindow in a plugin and is a more generic solution, i.e. also helps with other UI frameworks that require drawing operations to be done in the main thread (for example Cocoa is one of them too).
-
30-01-2010, 16:28 #7
-= TeamSpeak User =-
- Join Date
- Jan 2010
- Location
- Europe
- Posts
- 12
Well I've got my overlay prototype working.
But since its not working as intended (for now you have to start it through the config dialog -> open plugins -> select plugin -> press configure) its not very userfriendly.
So is there anything planned so you could pass a QWidgetpointer to the client so he can display it?
-
10-02-2010, 16:51 #8
-= TeamSpeak User =-
- Join Date
- Jan 2010
- Location
- Europe
- Posts
- 12
You have to link again the release dlls of QT, and everything works fine.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
SirReal's G15 plugin
By SirReal in forum [TeamSpeak 2] Addons & ScriptsReplies: 147Last Post: 21-06-2011, 10:42 -
[NOW AVAILABLE] Wordpress TS3 Viewer Widget / Plugin
By MichaelP in forum ToolsReplies: 17Last Post: 27-10-2010, 15:32 -
Plugin SDK <-> Lua Plugin
By Neico in forum PluginsReplies: 0Last Post: 20-12-2009, 21:54 -
TeamSpeak Plugin for Logitech G15 Keyboard LCD
By schmads in forum [TeamSpeak 2] Addons & ScriptsReplies: 18Last Post: 23-12-2007, 05:30 -
An idea for gameserver plugin - comments?
By [PWG] Tackdriver in forum [TeamSpeak 2] Addons & ScriptsReplies: 7Last Post: 15-04-2007, 19:01


Reply With Quote