View Full Version : Add QSvgWidget to Layout

18th August 2009, 19:19
I have private QSvgWidget in a shared library and once created, it is shown by svgWidget.show(); and it gets displayed on the screen. I want to be able to add the Widget to a layout in a QMainWindow with something like: SvgView-> addWidget(_myViewer->_svgWidget);. Is there a way to do this without making svgWidget public?


18th August 2009, 23:14
You could make the mainwindow public to the shared library and at the widget from there but I doubt that this is what you had in mind.

Next trick: Get the mainwindow in the shared library by QApplication::topLevelWidgets

This would also work the other way around to find the widget.

But all of these are hacks so I wonder what you realy want to do. You can have a look at other frameworks that do similar:

KDE's ioslaves
Qt's widget plugins.

19th August 2009, 00:15
Thanks for the suggestions. I will try those out and see if they will do the job.