Results 1 to 2 of 2

Thread: Using zbar::QZBar

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2013
    Posts
    2
    Qt products
    Qt5
    Platforms
    Unix/X11 Android

    Question Using zbar::QZBar

    I created a Qt project, using a barcode encoder/decoder library libzbarqt. When I added private *qr to mainwindow.h and initialized it by adding qr(new zbar::QZBar) to the MainWindow constructor, it didn't work.

    Running it gives:
    Starting /home/lily/program/qt/build-TestQZBar-Desktop-Debug/TestQZBar...
    The program has unexpectedly finished.
    /home/lily/program/qt/build-TestQZBar-Desktop-Debug/TestQZBar exited with code 0

    Running a debugger gives a segmentation fault:
    The inferior stopped because it received a signal from the Operating System.
    Signal name :
    SIGSEGV
    Signal meaning :
    Segmentation fault

    Something went wrong by adding qr(new zvar::QZBar) to instantiate the pointer...
    Missing something obvious...? Will appreciate any help or pointer. The project, header, cpp files, and running environment are as follows.

    In TestQZBar.pro, added the line below:
    unix:!macx: LIBS += -lzbarqt

    ====================mainwindow.h================== =====
    ifndef MAINWINDOW_H
    #define MAINWINDOW_H

    #include <QMainWindow>
    #include <zbar/QZBar.h>

    namespace Ui {
    class MainWindow;
    }

    class MainWindow : public QMainWindow
    {
    Q_OBJECT

    public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

    private:
    Ui::MainWindow *ui;
    zbar::QZBar *qr;
    };

    #endif // MAINWINDOW_H
    ================================================== =====


    ====================mainwindow.cpp================ =====
    #include "mainwindow.h"
    #include "ui_mainwindow.h"

    #include <QDebug>

    MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow),
    qr(new zbar::QZBar)
    {
    ui->setupUi(this);

    qDebug() << "Testing QZBar\n";

    /* if(qr->isVideoEnabled())
    {
    qDebug() << "Video is enabled.\n";
    } else {
    qDebug() << "Video is disabled.\n";
    }
    */
    }

    MainWindow::~MainWindow()
    {
    delete ui;
    }

    ================================================== =====

    Environment:
    Qt Creator 2.7.1 Based on Qt 5.0.2 (64 bit)
    OS is Ubuntu 13.04
    Installed libzbarqt-dev (ver.0.10+doc-8)

  2. #2
    Join Date
    Aug 2013
    Posts
    2
    Qt products
    Qt5
    Platforms
    Unix/X11 Android

    Thumbs up Re: Using zbar::QZBar

    The problem is solved without changing the above code when running qt4 with 32bit gcc compiler
    (Cross-posted here)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.