On 02/04/12 16:32, Thiago Macieira wrote:
On segunda-feira, 2 de abril de 2012 10.07.54, Thiago Macieira wrote:
On segunda-feira, 2 de abril de 2012 15.49.25, Nikos Chantziaras wrote:
On 02/04/12 15:38, Thiago Macieira wrote:
On segunda-feira, 2 de abril de 2012 15.17.31, Nikos Chantziaras wrote:
I have a use case where linking an executable statically against Qt
makes sense. However, the resulting binary fails to use KDE's current
widget style (like Oxygen). Is this even possible with binaries that
link-in Qt statically?
No. It's completely impossible.
Ah, too bad. Thanks for the quick response.
Purely out of curiosity though, why is that?
[...]
If you can make the Oxygen plugin not link to Qt, then it can be loaded.
[...]
Qt plugins cannot be loaded *because* they link to Qt. The plugin requires
functions and other symbols that are present in the Qt libraries. However, the
Qt libraries were already linked into the application. And, worse, since it
was a static link, only what you used of Qt got linked.
So there are broad swathes of Qt missing. And the ones that are present are
unusable because they were statically linked.
Loading the dynamic Qt would not work either because some symbols might
resolve into the application, some others to the libs you loaded. Really bad
idea.
For that reason, the QPluginLoader class in a static Qt does load anything. It
operates only on the "static plugins" -- that is, plugin code compiled as a
static lib and linked into the application.
Makes perfect sense. Thanks for the explanation. :-)
If you want the Oxygen style in your app, there's a workaround: use the Gtk
style and make Gtk use Oxygen. The Oxygen-Gtk plugin has no Qt dependency:
$ ldd /usr/lib64/gtk-2.0/2.10.0/engines/liboxygen-gtk.so | grep -c Qt
0
Oxygen-Gtk has visual bugs when used by Qt apps. I reported one, but
it's a usual WONTFIX or INVALID case, since using Oxygen-Gtk with Qt is
not supported to begin with.
It's not a real problem anyway though. Qt libraries can always be
bundled together with a dynamically linked executable. I was looking
for a way to cut down on size a bit, but it's nothing dramatic.
Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<