Posts Tagged ‘QT’

After the real party (SUAS 13) for this summer, i needed some refreshment. Perhaps, an after-party. After party soon began when i returned back home in July, 2013. It began with me setting up a new QT project in my machine. What that project is about ? Let that remains classified for now. I thought to include all the third party libraries that my project needs with in the project. This means, I did not install third party libraries in default locations but in my project folders. So now when ever I move my project to any other  machine, or say any freshly set up machine, I need not to install any third party libraries that my project needs.  Obviously this is not a great work which I did, but essential for good and a complete software.

To check if my software was really “independent”, i quickly installed virtual box and made a virtual system for Ubuntu 12.04.

Next I updated it and installed Qt5. When I tried to run one of the sample qt project. I got an error. The error was something like “-lGL now found”

It clearly showed that libGL was missing. In order to fix it i found following to install libGL on virtualbox

 sudo apt-get install mesa-common-dev

However for one of my friend with same issue, this also worked:

sudoapt-get install libgl1-mesa-dev

Both  installs dev files for libGL. And now it is all set to run the qt project. Except once, when i still found the same error in newly set up virtual machine. This time error occurred due broken reference to by

How did I discover broken link ? I tried to find if my system had any file. And yes it did and right on its place. Next I tried to find if it points to correct file. So I used following command:

 ls -l /usr/lib/x86_64-linux-gnu/

And I found that it points to a file which does not even exist. Hence, the problem was of broken/incorrect links.

So I needed to create a new link where file points to correct file.

I manually searched for and found that the file exists in /usr/lib directory.

to recreate the link, i first had to delete old link:

sudo rm /usr/lib/x86_64-linux-gnu/

This removes my file. Now its time to create new one. To create a new link:

sudo ln -s /usr/lib/ /usr/lib/x86_64-linux-gnu/

This resolved my issue.

Pdf + “Cute” [Touchulator]

Posted: February 3, 2013 in Work
Tags: , ,

So finally i have started my work on “something” new. Lets see how far this goes. So at first I was trying to read pdf file using QT. I found that QT itself does not come with any support to read pdf. However, there are many APIs available for QT. One of them being “Poppler”. Poppler (or libpoppler) is a free software library used to render PDF documents. Hence, I tried to implement poppler with QT.

If we skip the initial googling time, the task was not too difficult. All I had to do was to build poppler library. And then read pdf using this popeller library and rander pages as images. Now this image could easily be displayed thorugh QT.


Screenshot from 2013-02-03 13:34:41




For very basic implementation , this is the code:

QString filename = “/media/BACC8094CC804C97/Docs/Work Docs/PDF/IP/OReilly Learning OpenCV.pdf”;

Poppler::Document* document = Poppler::Document::load(filename);
if (!document || document->isLocked())
// … error message ….
delete document;
// Paranoid safety check
if (document == 0) {
// … error message …
// Access page of the PDF file
int pageNumber = 1;
Poppler::Page* pdfPage = document->page(pageNumber); // Document starts at page 0
if (pdfPage == 0) {
// … error message …
// Generate a QImage of the rendered page
double xres=150.0,yres=200.0;

image = pdfPage->renderToImage(xres, yres, 0, 0, 1000, 1000);
if (image.isNull()) {
// … error message …
// … use image …
// after the usage, the page must be deleted
delete pdfPage;
delete document;