When install a .deb file which not in any mirror. there is no way to get this package installed information (even no way to test this package is installed or not). because any package information is getting from Package class, if some package is installed but not in mirror, we can't get this Package object from Backend.
works just fine. $ cat src/main.cpp #include <QApplication> #include <QApt/Backend> #include <QDebug> int main(int argc, char **argv) { QApplication app(argc, argv); QApt::Backend backend; backend.init(); auto pkg = backend.package("discord"); Q_ASSERT(pkg); qDebug() << pkg->isInstalled(); qDebug() << pkg->version(); } $ ./build/src/test test(18175)/(default) main: true test(18175)/(default) main: "0.0.1" $ apt policy discord discord: Installed: 0.0.1 Candidate: 0.0.1 Version table: *** 0.0.1 100 100 /var/lib/dpkg/status
Okey, I checked my code and find some reason. I'm install a 32-bit deb file in 64-bit system, and call backend.package("somename") will return a null pointer, but backend.package("somename:i386") will get right info.