![]() |
2011-02-12
, 21:16
|
Posts: 726 |
Thanked: 345 times |
Joined on Apr 2010
@ Sweden
|
#2
|
![]() |
2011-02-12
, 21:32
|
Posts: 7 |
Thanked: 0 times |
Joined on Feb 2011
|
#3
|
![]() |
2011-02-12
, 22:30
|
Posts: 28 |
Thanked: 13 times |
Joined on Nov 2010
@ Tampere, Finland
|
#4
|
![]() |
2011-02-13
, 13:05
|
Posts: 7 |
Thanked: 0 times |
Joined on Feb 2011
|
#5
|
![]() |
2011-02-13
, 13:08
|
Posts: 1,086 |
Thanked: 2,964 times |
Joined on Jan 2010
|
#6
|
Finally I could start my application on my N900 (removed a bug), but the "Hello world!" message does not display from the external .txt.
Maybe this happens because of the .txt is not included into the package or it is in the wrong path?!
My program displays the "Hello world!" message from the .txt if the program is running from Qt creator.
![]() |
2011-02-13
, 13:49
|
Posts: 7 |
Thanked: 0 times |
Joined on Feb 2011
|
#7
|
#include<QtCore> #include<QLabel> #include<QFile> #include<QtGui> #include<QString> #include <iostream> #include <QMessagebox> class DblVec : public QVector<int>{ public: DblVec(int n):QVector<int>(n){} }; using namespace std; int main(int argc, char *argv[]) { QApplication a(argc, argv); QWidget *window = new QWidget; QGridLayout *layout = new QGridLayout; QPushButton *readFile = new QPushButton; QString date; quint32 size; DblVec line(size); QTextBrowser *browse = new QTextBrowser; QScrollBar *scrollbar = new QScrollBar; QFile infile("opt/Mad Qt example/data.txt"); window->setWindowTitle("Data"); readFile->setText("Button"); layout->addWidget(readFile, 0, 1); if ( infile.open(QIODevice::ReadOnly |QIODevice::Text) ) { QString line2; QTextStream stream( &infile ); while(!stream.atEnd()) { line2 = stream.readAll(); } browse->setText(line2); browse->setVerticalScrollBar(scrollbar); browse->show(); infile.close(); } layout->addWidget(browse, 0, 0); window->setLayout(layout); window->resize(500, 400); window->show(); return a.exec(); }
![]() |
2011-02-13
, 14:03
|
Posts: 7 |
Thanked: 0 times |
Joined on Feb 2011
|
#8
|
![]() |
2011-02-16
, 06:22
|
Posts: 726 |
Thanked: 345 times |
Joined on Apr 2010
@ Sweden
|
#9
|
foo(); bar(); fie();
![]() |
2011-02-19
, 17:47
|
Posts: 7 |
Thanked: 0 times |
Joined on Feb 2011
|
#10
|
mad pscreate -t qt_simple yourproject
INSTALLS += data data.path = /opt/txt data.files = data.txt
mad qmake mad make mad dpkg-buildpackage
I am newcomer in programming Qt for my N900.
I am writing little first-step-applications for my N900. Everything worked fine till now. I already have own applications for the device, but non of them uses an external data file.
Now I am trying to create an application for my N900 which uses an external .txt file. The package is created successfully, the application is installed successfully, however the binary does not see the .txt (maybe it is not in the package?).
Something is wrong with the package, I think.
I am using MADDE Developer 0.6.72 to create the project skeleton.
I am using Qt creator for create the code. After once the code is created successfully then I am running the following commands in MADDE Developer 0.6.72 for the updated skeleton folder created above.
I writed the following lines into MADDE developer:
<<
//create project sceleton
MADDE-0.6.72 ~/madde
- $ mad pscreate -t qt_simple skeleton
Skeleton skeleton, type=qtprog created
//The code has been edited to read a .txt file.
//I created and included into the code the intended Debian folder //structure.
MADDE-0.6.72 ~/madde
- $ cd skeleton
MADDE-0.6.72 ~/madde/skeleton
- $ mad qmake
MADDE-0.6.72 ~/madde/skeleton
- $ mad make
MADDE-0.6.72 ~/madde/skeleton
- $ mad dpkg-buildpackage
>>
My goal is to create simple program to my N900 which reads and displays a simple "Hello world!" string from an external file (e.g. from a.txt). Please help! I read all the articles about Debian packaging, but no solution.
Thank you for your help!
Last edited by sakal; 2011-02-12 at 21:25.