[Digikam-devel] Accessing digikam database from external application

Xavier Chardon chardon at agroparistech.fr
Wed Mar 31 10:01:20 BST 2010


Hi all,

Could someone give me some hints on how to access a digikam database from a
new application, using libdigikamdatabase?

I tried to look in the source code of digikam. I found out I should do
something like that:

#include <databaseaccess.h>

int main(){

   Digikam::DatabaseAccess::setParameters(

Digikam::DatabaseParameters(Digikam::DatabaseParameters::parametersForSQLiteDefaultFile("/path/to/database")
)
                    );

   Digikam::DatabaseAccess::checkReadyForUse ();

   Digikam::DatabaseAccess DbA = Digikam::DatabaseAccess();
   // Then I should be able to access the database with:
   DbA.db()

 };


Now, the problem occurs when I call the function "setParameters". I get the
following output:
QEventLoop: Cannot be used without QApplication
QObject::connect: Cannot connect (null)::aboutToQuit() to
Digikam::DatabaseCoreBackend::slotMainThreadFinished()
QEventLoop: Cannot be used without QApplication


So the questions are:
Am I on the right way or is there a better solution?
If I am on the right way, can I use the digikam libs outside of a
QApplication? Will it work in a plasmoid?

Thanks,

Xavier
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/digikam-devel/attachments/20100331/e113d729/attachment.html>


More information about the Digikam-devel mailing list