Commit 32bffa78 authored by Friedrich W. H. Kossebau's avatar Friedrich W. H. Kossebau
Browse files

Fix ui viewer/thumbnailer: load designer plugins for 3rd-party widgets

parent 4f134d6b
...@@ -122,6 +122,16 @@ KUIViewerPart::~KUIViewerPart() ...@@ -122,6 +122,16 @@ KUIViewerPart::~KUIViewerPart()
{ {
} }
static QStringList designerPluginPaths()
{
QStringList paths;
const QStringList &libraryPaths = QApplication::libraryPaths();
for (const auto& path : libraryPaths) {
paths.append(path + QLatin1String("/designer"));
}
return paths;
}
bool KUIViewerPart::openFile() bool KUIViewerPart::openFile()
{ {
// m_file is always local so we can use QFile on it // m_file is always local so we can use QFile on it
...@@ -131,6 +141,7 @@ bool KUIViewerPart::openFile() ...@@ -131,6 +141,7 @@ bool KUIViewerPart::openFile()
delete m_view; delete m_view;
QFormBuilder builder; QFormBuilder builder;
builder.setPluginPath(designerPluginPaths());
m_view = builder.load(&file, m_widget); m_view = builder.load(&file, m_widget);
file.close(); file.close();
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <QImage> #include <QImage>
#include <QtDesigner/QFormBuilder> #include <QtDesigner/QFormBuilder>
#include <QWidget> #include <QWidget>
#include <QCoreApplication>
extern "C" extern "C"
{ {
...@@ -36,7 +37,13 @@ extern "C" ...@@ -36,7 +37,13 @@ extern "C"
bool QUICreator::create(const QString &path, int width, int height, QImage & img) bool QUICreator::create(const QString &path, int width, int height, QImage & img)
{ {
QStringList designerPluginPaths;
const QStringList &libraryPaths = QCoreApplication::libraryPaths();
for (const auto& path : libraryPaths) {
designerPluginPaths.append(path + QLatin1String("/designer"));
}
QFormBuilder builder; QFormBuilder builder;
builder.setPluginPath(designerPluginPaths);
QFile file(path); QFile file(path);
if (!file.open(QFile::ReadOnly)) if (!file.open(QFile::ReadOnly))
return false; return false;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment