File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -63,11 +63,24 @@ int main(int argc, char **argv)
6363 textLabel->setTextInteractionFlags (Qt::TextSelectableByMouse);
6464
6565 QDir pluginsDir (QLatin1String (" ../src/" ));
66+
67+ #if defined(_WIN32)
68+ // Under Windows the 3rd Party Dlls are next to the plugin in the same directory
69+ // in order to find them we set the current directory to the plugin directory
70+ QDir::setCurrent (pluginsDir.path ());
71+ #endif
72+
6673 const QStringList entries = pluginsDir.entryList (QDir::Files);
6774 for (const QString &fileName : entries) {
6875 QPluginLoader pluginLoader (pluginsDir.absoluteFilePath (fileName));
6976 auto plugin = pluginLoader.instance ();
70- if (plugin) {
77+ if (plugin == nullptr ) {
78+ if (!pluginLoader.metaData ().isEmpty ()) {
79+ qDebug () << " Error loading plugin" << fileName << pluginLoader.errorString ();
80+ } else {
81+ qDebug () << " Checked" << fileName << " and it's not a plugin." ;
82+ }
83+ } else {
7184 auto pluginOcr = qobject_cast<IPluginOcrOther*>(plugin);
7285 if (pluginOcr) {
7386 qDebug () << " Loaded plugin " << fileName << " with version " << pluginOcr->version ();
@@ -77,7 +90,7 @@ int main(int argc, char **argv)
7790 qCritical () << " Unable to cast to interface" ;
7891 }
7992 pluginLoader.unload ();
80- }
93+ }
8194 }
8295
8396 mainWindow.show ();
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ OcrWrapper::~OcrWrapper()
3131
3232QString OcrWrapper::recognize (const QPixmap &pixmap) const
3333{
34- if (mTessApi ->Init (nullptr , nullptr ) == 0 )
34+ if (mTessApi ->Init (nullptr , " eng " ) == 0 )
3535 {
3636 auto pix = makePixFromPixmap (pixmap);
3737 mTessApi ->SetImage (pix);
You can’t perform that action at this time.
0 commit comments