• I want to learn how to use Qt with C++
    13 replies, posted
Well, I know a fair bit about C++, and I want one of my C++ programs to run in my own GUI instead of the console. I don't want anything fancy like buttons, I just want my own GUI, instead of that dirty ol' console. My main thing is that I want the user to be able to copy and paste stuff easier. It's kind of the point on my program. Anyways, where do I go to learn how to incorporate Qt, or any other GUI program into my C++. I just want text, and input. My code is here: [code] #include <iostream> #include "conio.h" #include <string> #include <time.h> #include <cstdlib> using namespace std; void keep(); void keep() { string UserInput; srand ((unsigned) time(0)); int random = (rand()%10); string name; string response; system ("title Easy Roll V.0.4"); cout << "Easy Roll V.0.4 \n"; cout << "--------------------------------------------------- \n"; cout << "Enter the player's name. (No spaces) \n"; getline(cin, name); cout << "Enter the player's command \n"; getline(cin, UserInput); cout << " \n"; cout << "--------------------------------------------------- "; cout << " \n"; cout << name; cout << " \n"; cout << "Action: "; cout << UserInput; cout << " \n"; cout << "Roll: "; cout << random << " \n"; cout << "Outcome: "; cout << " \n"; cout << " \n"; } int main() {char cInput; while(true) { keep(); cout << "Enter C to repeat, anything else to close program"; cout << " \n"; cin >> cInput; cin.ignore(99999, '\n'); if(cInput != 'C') if(cInput != 'c') { break; } } system("pause"); } [/code] I want that to be in it's own GUI. Just a textbox with inputs. Thanks.
[QUOTE=LieutenantLeo;27825576]Well, I know a fair bit about C++, and I want one of my C++ programs to run in my own GUI instead of the console. I don't want anything fancy like buttons, I just want my own GUI, instead of that dirty ol' console. My main thing is that I want the user to be able to copy and paste stuff easier. It's kind of the point on my program. Anyways, where do I go to learn how to incorporate Qt, or any other GUI program into my C++. I just want text, and input. My code is here: [code] #include <iostream> #include "conio.h" #include <string> #include <time.h> #include <cstdlib> using namespace std; void keep(); void keep() { string UserInput; srand ((unsigned) time(0)); int random = (rand()%10); string name; string response; system ("title Easy Roll V.0.4"); cout << "Easy Roll V.0.4 \n"; cout << "--------------------------------------------------- \n"; cout << "Enter the player's name. (No spaces) \n"; getline(cin, name); cout << "Enter the player's command \n"; getline(cin, UserInput); cout << " \n"; cout << "--------------------------------------------------- "; cout << " \n"; cout << name; cout << " \n"; cout << "Action: "; cout << UserInput; cout << " \n"; cout << "Roll: "; cout << random << " \n"; cout << "Outcome: "; cout << " \n"; cout << " \n"; } int main() {char cInput; while(true) { keep(); cout << "Enter C to repeat, anything else to close program"; cout << " \n"; cin >> cInput; cin.ignore(99999, '\n'); if(cInput != 'C') if(cInput != 'c') { break; } } system("pause"); } [/code] I want that to be in it's own GUI. Just a textbox with inputs. Thanks.[/QUOTE] Google Qt with C++.
[QUOTE=supersnail11;27825606]Google Qt with C++.[/QUOTE] I'm going to ignore you because you are a [b] HUGE [/b] idiot. Actually I searched stuff like that and couldn't find anything USEFUL that teaches me.
[QUOTE=LieutenantLeo;27825707]I'm going to ignore you because you are a [b] HUGE [/b] idiot.[/QUOTE] :sigh: when will people learn that insulting those who are trying to help is not the way to get help? [url]http://developer.qt.nokia.com/wiki/Category:HowTo[/url]
[QUOTE=supersnail11;27825912]:sigh: when will people learn that insulting those who are trying to help is not the way to get help? [url]http://developer.qt.nokia.com/wiki/Category:HowTo[/url][/QUOTE] It wasn't an insult I was quoting your title cause I thought it was funny :| Anyways, thanks. I'll check that out. [editline]3rd February 2011[/editline] Ok, that didn't work. I've been searching for a bit now. There isn't really anything on youtube. Isn't there a simple way to get my code into something other than Console?
[QUOTE=supersnail11;27825912]:sigh: when will people learn that insulting those who are trying to help is not the way to get help? [url]http://developer.qt.nokia.com/wiki/Category:HowTo[/url][/QUOTE] Yes. You really went out of your way to tell him to google...
Just download QT Creator and you're good to go. [editline]3rd February 2011[/editline] [url]http://qt.nokia.com/downloads/downloads[/url]
personally disagree about QT creator, you should learn how to implement it manually before just having it be auto-generated(you know, so you really know how the framework works). yeah reading the documentation is the best way to learn it!!
[QUOTE=Soda;27830804]personally disagree about QT creator, you should learn how to implement it manually before just having it be auto-generated(you know, so you really know how the framework works). yeah reading the documentation is the best way to learn it!![/QUOTE] The files created by QT Designer need to be processed by the uic tool anyway. QT creator, AFAIK, does not generate files beyond the above.
[QUOTE=Soda;27830804]personally disagree about QT creator, you should learn how to implement it manually before just having it be auto-generated(you know, so you really know how the framework works). yeah reading the documentation is the best way to learn it!![/QUOTE] QT Creator makes the dialogs for you and lets you visually connect the inputs and outputs which can be a huge relief - no need to write masses of what is essentially boilerplate code. [editline]3rd February 2011[/editline] Or QT designer, whichever it was
Yeah, I already have QT Creator. I don't know how to use it.
If you're using Visual Studio there's an add-in which makes stuff really easy. But for some reason I can't find it on the site anymore...
[QUOTE=Z_guy;27832580]If you're using Visual Studio there's an add-in which makes stuff really easy. But for some reason I can't find it on the site anymore...[/QUOTE] I believe it is included in the QT SDK. It was automatically installed.
Have you learned about classes yet? If not you shouldn't really do anything with Qt. I say stick with the "dirty ol' console" until you have learned about the "advanced" stuff in C++, like classes, templates, pointers, dynamic memory, etc. Also, you should really return something from main().
Sorry, you need to Log In to post a reply to this thread.