Skip to content

Instantly share code, notes, and snippets.

@jadonk
Last active June 6, 2018 14:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jadonk/db2cc4688c5277c84d19a6579e0dca86 to your computer and use it in GitHub Desktop.
Save jadonk/db2cc4688c5277c84d19a6579e0dca86 to your computer and use it in GitHub Desktop.

Qt Hello World example

sudo apt-get install -y qt5-default
qmake -project
echo "QT += widgets" >> qt_example.pro
qmake
make
#include <QtWidgets>
int main( int argc, char *argv[] )
{
QApplication myapp( argc, argv );
QLabel *mylabel = new QLabel("Hello world");
mylabel->show();
return myapp.exec();
}
#########################################################
# Automatically generated by qmake (3.1) Wed Jun 6 04:52:28 2018
######################################################################
TEMPLATE = app
TARGET = qt_example
INCLUDEPATH += .
# The following define makes your compiler warn you if you use any
# feature of Qt which has been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
# Input
SOURCES += hello_qt.cpp
QT += widgets
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment