0

I am student just finished an introductory class on C++. Can any one help me build a GUI for my programs? Maybe a template? Example? Any and all help would be greatly appreciated. Thanks.

Edited by MisterGlow

2
Contributors
1
Reply
15
Views
3 Years
Discussion Span
Last Post by firstPerson
1

C++ doesn't have an interface to allow you to create any GUI code, but you can use external libraries to draw the GUI stuff and control it with C++.

For example here is a gui application in C++ using the QT library:

#include <qapplication.h>
#include <qpushbutton.h>


int main( int argc, char **argv )
{
    QApplication a( argc, argv ); //create a window object

    //create a button object with the text 'hello world'        
    QPushButton hello( "Hello world!", 0 ); 
    //set the size of the button
    hello.resize( 100, 30 );
    //add it to the window
    a.setMainWidget( &hello );
    //enable our button to be shown, by default it is hidden      
    hello.show();
    //show our whole window
    return a.exec();
}

There are many tutorials out there for this, I just stole the above from here: http://web.njit.edu/all_topics/Prog_Lang_Docs/html/qt/tutorial1-01.html ,

But judging from your post, I do not suspect that you have grasped most of the concepts in C++, so I would suggest to start doing more projects and not worry about gui stuff until you have a solid grasp of C++. How much of its concepts do you know, for example arrays/if-else/classes/structs/templates?

Votes + Comments
good advice
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.