Déployer une application Qt console
Bonjour,
J'ai créé une application qt qui convertie un fichier html en pdf. L'application s'utilise de la manière suivante:
Code:
htmlConverter.exe file:///d:\from.html d:\to.pdf
Depuis Qt Creator ce programme fonctionne en mode debug et release. Mais depuis une console windows je n'arrive pas à le lancer. J'ai mis dans un dossier mon programme htmlConverter.exe et j'ai aussi mis toutes les dll du dossier suivant
Code:
C:\QtSDK\Desktop\Qt\4.8.0\msvc2010\bin
Mais j'obtiens une erreur étrange quand je lance mon programme:
Code:
1 2 3 4
| QIODevice::read: maxSize argument exceeds QByteArray size limit
Qt has caught an exception thrown from an event handler. Throwing
exceptions from an event handler is not supported in Qt. You must
reimplement QApplication::notify() and catch all exceptions there. |
Je pense que cela est un problème de dll...quelqu'un sait ce que je dois faire pour déployer correctement mon application?
En passant voici mon code:
htmlConverter.pro
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
#-------------------------------------------------
#
# Project created by QtCreator 2012-06-29T11:38:55
#
#-------------------------------------------------
QT += core gui network webkit xmlpatterns
TARGET = htmlConverter
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp \
convertor.cpp
OTHER_FILES += \
xsl/eric.xsl \
xsl/eric.xml \
xsl/count.xsl \
xsl/agents.xml
HEADERS += \
convertor.h |
convertor.h
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| #ifndef CONVERTOR_H
#define CONVERTOR_H
#include <QObject>
#include <QtGui>
#include <QtNetwork>
#include <QtWebKit>
class Convertor : public QObject
{
Q_OBJECT
public:
explicit Convertor(QObject *parent = 0);
signals:
public slots:
void setPaths(QString htmlPath, QString pdfPath);
void convert(bool ok);
private:
QWebView web;
QPrinter printer;
}; |
#endif // CONVERTOR_H
convertor.cpp
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| #ifndef CONVERTOR_H
#define CONVERTOR_H
#include <QObject>
#include <QtGui>
#include <QtNetwork>
#include <QtWebKit>
class Convertor : public QObject
{
Q_OBJECT
public:
explicit Convertor(QObject *parent = 0);
signals:
public slots:
void setPaths(QString htmlPath, QString pdfPath);
void convert(bool ok);
private:
QWebView web;
QPrinter printer;
};
#endif // CONVERTOR_H |
main.cpp
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
#include <QTGui/QApplication>
#include <QtCore>
#include <iostream>
#include "convertor.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
if(argc<3){
std::cerr << "You need to enter two arguments : the url and the output pdf file name" << "\n";
return a.exec();
}
Convertor convertor;
convertor.setPaths(argv[1], argv[2]);
return a.exec();
} |
Merci d'avance,
Cédric