ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
The form I'm using was already transformed using designer (qt4) and I dropped the qt3 version from the project. The other code I had already made for the project, I'll include it (or should I say twist it) it once I get the naked frame up and running correctly. And thanks for that information. I had alredy read about it on the QT4 help pages.
The problem is that I thought it was going to compile formas/principal/formabase_qt4.ui into formas/principal/ui_formabase_qt4.h, and that was my include in main.cpp, but it uics it into ui_formabase_qt4.h (in that same directory of main.cpp). I had to change the include in main.cpp, and then it worked.
Now are there any advices to make the application finish once I close the main frame?
I noticed there was a mistake (i think) in the tutorial that I corrected. The binary ran anyway, but the form showed up with no content. After a while looking at the code, I noticed that the extended class was calling setupUi(this) instead of setupUi(parent). I made the correction and then the frame showed up!
What I'm missing now is the auto-connection. I have two buttons in my form: btnBuscar and btnDetener.
See? Very simple and straight forward. Yet when I click on btnBuscar, there's no warning showing up in the console. :'( Is there something I have to do on the .pro file?
And I still have the problem that the application is not finishing after I close the form (the only form).
Oh, I did that in order to move on... but according to QT4 documentation uic (somehow) can do that work for me automagically. Look QT's autoconnection feature in the QT4 documentation.
That would be ok, but I just want a message to show up in my console, not in a window. I made the change you suggested before, and now the compiler says it can't convert from std::string to char *. It's ok if I just comment those lines (by now)... they're just debugging messages, no big deal (again, by now)... but look at this next problem (and this has me ):
Code:
int i = 0;
while (query.next()) {
records->setItem(i, 0, QTableWidgetItem(query.value(1).toString()));
i++;
}
And the compiler says it can't find a matching function for QTableWidget::setItem(int&, int , QTableWidgetItem)... and please, notice the & of int&. Where does that come from? i is just an int, right?
It is expecting the TableWidgetItem to be passed as a pointer. Don't worry about the reference the compiler does that because you have passed a variable rather than a literal. So try:
principal.o: in the function `Principal::btnBuscarClicked()':
principal.cpp:(.text+0x1d0): reference to `QSqlDatabase::QSqlDatabase()' undefined
principal.cpp:(.text+0x1fb): reference to `QSqlQuery::QSqlQuery(QString const&, QSqlDatabase)' undefined
principal.cpp:(.text+0x229): reference to `QSqlDatabase::~QSqlDatabase()' undefined
principal.cpp:(.text+0x28e): reference to `QSqlQuery::prepare(QString const&)' undefined
.
.
.
What did I do in my past life to deserve this punishment? :'( :-D
Looks as if the linker is not including the QT files. You may need to check your QMake. Sorry I've not actually got access to any of my make files to see what they look like for a comparison
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.