PDA

View Full Version : install sqlite



marquessbr
12th November 2012, 11:38
Hi all!

Im newbi in qt and need to use to developer sqlite apps, but how I can use de designer with it?

tank's

peace!

amleto
12th November 2012, 12:51
Why should sqlite be in designer? Database is not gui/widget.

marquessbr
12th November 2012, 15:28
Why should sqlite be in designer? Database is not gui/widget.

hi my friend!
thanks for replying
but I'm having difficulty using the QT interface, I downloaded a practical tutorial on how to create a calculator to start, but the author asked to create the interface of the calculator, I did it without problems following the example he gave, but he asked to create a file ".h" but where should I create this file? in an ordinary text editor and save it in the folder where I recorded the project?

thank you!

Lesiok
12th November 2012, 17:48
marquessbr, do not understand me wrong, but I think first you have to study a tutorial on programming in C / C++. Without it, the moment you come back here with another question on the basis of C++

marquessbr
12th November 2012, 22:40
marquessbr, do not understand me wrong, but I think first you have to study a tutorial on programming in C / C++. Without it, the moment you come back here with another question on the basis of C++

hi my friend!
I have no problem in programming in C / C++, the problem I'm having is with the interface of QT, which is a bit strange for me that always programmed in Delphi and Lazarus / FPC, but thank you, even as I followed the tutorial and finished the project but gave some strange errors and now means no time to see how to solve.

Thanks anyway

Lesiok
13th November 2012, 06:20
Sorry marquessbr but You have problems with C/C++. You are asking what is h file and hwo to create it.

amleto
13th November 2012, 13:35
use Qt Creator and add files to the projects from there.

marquessbr
13th November 2012, 18:42
Hi leslok, I did not ask what is a ".h" file, I know with it is, I asked where it should be saved in a project QT, I do this already solved, and yes, I'm having trouble with C/C++, but it is because of error shown below, which is a copy of the output from my terminal when I'm compiling with qmake.

-----------------------------------------------------------------------------------------------
armando@odin-lap:~/projects/qt/calc$ qmake -project
armando@odin-lap:~/projects/qt/calc$ qmake
armando@odin-lap:~/projects/qt/calc$ make
g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -DQT_WEBKIT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. -I. -o main.o main.cpp
In file included from main.cpp:2:0:
myCalc.h:5:1: erro: stray ‘\302’ in program
myCalc.h:5:1: erro: stray ‘\240’ in program
myCalc.h:6:1: erro: stray ‘\302’ in program
myCalc.h:6:1: erro: stray ‘\240’ in program
myCalc.h:6:1: erro: stray ‘\302’ in program
myCalc.h:6:1: erro: stray ‘\240’ in program
myCalc.h:6:1: erro: stray ‘\302’ in program

...
...

main.cpp:8:2: erro: stray ‘\255’ in program
main.cpp:9:2: erro: stray ‘\302’ in program
main.cpp:9:2: erro: stray ‘\240’ in program
In file included from main.cpp:2:0:
myCalc.h:6:40: erro: ‘Ui’ has not been declared
myCalc.h:6:44: erro: expected ‘{’ before ‘qtCalc’
myCalc.h:7:1: erro: invalid type in declaration before ‘{’ token
myCalc.h:7:1: aviso: extended initializer lists only available with -std=c++0x or -std=gnu++0x [habilitado por padrão]
myCalc.h:8:3: erro: expected primary-expression before ‘public’
myCalc.h:8:3: erro: expected ‘}’ before ‘public’
myCalc.h:8:3: erro: expected ‘,’ or ‘;’ before ‘public’
myCalc.h:8:3: erro: uninitialized const ‘staticMetaObject’ [-fpermissive]
/usr/include/qt4/QtCore/qobjectdefs.h:304:22: nota: ‘const struct QMetaObject’ has no user-provided default constructor
/usr/include/qt4/QtCore/qobjectdefs.h:469:28: nota: and the implicitly-defined constructor does not initialize ‘const QMetaObject* QMetaObject::<anônimo struct>::superdata’
myCalc.h:8:3: erro: ‘virtual’ outside class declaration
myCalc.h:8:3: erro: non-member function ‘const QMetaObject* metaObject()’ cannot have cv-qualifier
myCalc.h:8:3: erro: ‘virtual’ outside class declaration
myCalc.h:8:3: erro: ‘virtual’ outside class declaration
myCalc.h:8:3: erro: expected unqualified-id before ‘private’
myCalc.h:8:3: aviso: ‘visibility’ attribute ignored [-Wattributes]
myCalc.h:9:3: erro: expected unqualified-id before ‘public’
myCalc.h:12:3: erro: expected unqualified-id before ‘public’
myCalc.h:17:3: erro: expected unqualified-id before ‘private’
myCalc.h:21:1: erro: expected declaration before ‘}’ token
myCalc.h:8:3: aviso: ‘void qt_static_metacall(QObject*, QMetaObject::Call, int, void**)’ declared ‘static’ but never defined [-Wunused-function]
make: ** [main.o] Erro 1
armando@odin-lap:~/projects/qt/calc$ ls^C
armando@odin-lap:~/projects/qt/calc$ ^C
armando@odin-lap:~/projects/qt/calc$

-----------------------------------------------------------------------------------------------

here is the code of the "main.cpp; myCalc.cpp; myCalc.h" files, I put the three files in a single pastebin submission:
http://pastebin.com/hZqM5xnz

and this is the myCalc.ui - generated by QT4 designer
http://pastebin.com/dBL7p9Br

the ".cpp" and the ".h" file Im created it in "gedit"!

thank's!

peace!

amleto
13th November 2012, 19:09
for starters you need ';' after class.



class abc
{
};


as for the errors, they are pretty simple obvious, aren't they? You have some non valid chars in your code files. Remove them!

You also reference Ui::qtCalc, but have not included any information about it.


Oh yeah, learn how to use pointers.


ptr>method();

This is NOT correct!

marquessbr
13th November 2012, 22:26
hi my friend, thanks, well, I cant see this inválid chars, mabe it is the " ' " or the " " " chars?
and about UI::qtCalc? where and how it need to be refered?

thank's!!

amleto
13th November 2012, 22:40
re-type the lines with any char problems. use a plain text editor.


and about UI::qtCalc? where and how it need to be refered?
use #include

marquessbr
14th November 2012, 14:16
ok, amlto, thank you!

Im redited my sources and now is ok, but returned this error, as the output of the terminal:

-------------------------------------------------------------------------------------------------
armando@odin-lap:~/projects/qt/calc$ make
g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -DQT_WEBKIT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. -I. -o main.o main.cpp
main.cpp:2:20: erro fatal: qtCalc.h: Arquivo ou diretório não encontrado
compilação terminada.
make: ** [main.o] Erro 1
armando@odin-lap:~/projects/qt/calc$
-------------------------------------------------------------------------------------------------

but why? if I had refered to qtCalc.h in the main.cpp file here is the code:

#include <QApplication>
#include "qtCalc.h"

int*main(int*argc,*char *argv[])
{
QApplication*app(argc,*argv);
Calc**dialog*=*new*Calc();
dialog*>show();
return*app.exec();
}

I need help

peace!

amleto
14th November 2012, 18:32
what is up with your code pasting??

did you actually try and compile this?


#include <QApplication>
#include "qtCalc.h"

int*main(int*argc,*char *argv[])
{
QApplication*app(argc,*argv);
Calc**dialog*=*new*Calc();
dialog*>show();
return*app.exec();
}

what's with all of the '*'??


qtCalc.h: Arquivo ou diretório não encontrado - pretty obvious, nes pas? (yes, I know different language)

marquessbr
15th November 2012, 15:23
Hi, amleto!

I tried other examples and they worked very well with that given to know a little more about how the compiler and also a little on the QT interface.

So thanks for all at now!

I say this because, like I said, I program in other languages, (pascal, python, php, json) and had litle contact with C/C++/QT, but I need to maintain this post unclosed, because the real reason for this post is because I had a idea to a project with will be more complex than its examples, for developer this project I will need to use one database and the sqlite/salite3 is perfect for me, because its amalgamation whose source is write in C.

so, at the right time I'll have to go deeper into the matter and if I have a question I ask for help here in the forum!

thank's

peace!