(C++) HelloQtQtCreatorWindows
January 25, 2018 · View on GitHub
(C++) HelloQtQtCreatorWindows



Hello Qt using Qt Creator under Windows is a Hello Qt program.
Technical facts
Operating system(s) or programming environment(s)
Lubuntu 15.04 (vivid)
Qt Creator 3.1.1
- G++ 4.9.2
Libraries used:
Qt project file: ./CppHelloQtQtCreatorWindows/CppHelloQtQtCreatorWindows.pro
QT += core gui #Support both Qt4 and Qt5 greaterThan(QT_MAJOR_VERSION, 4): QT += widgets TEMPLATE = app SOURCES += main.cpp\ dialog.cpp HEADERS += dialog.h FORMS += dialog.ui
./CppHelloQtQtCreatorWindows/dialog.h
//--------------------------------------------------------------------------- /* CppHelloQtQtCreatorLubuntu, Hello World program using Qt Creator under Lubuntu Copyright 2013 Richel Bilderbeek This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program.If not, see <http://www.gnu.org/licenses/>. */ //--------------------------------------------------------------------------- //From http://www.richelbilderbeek.nl/CppHelloQtQtCreatorLubuntu.htm //--------------------------------------------------------------------------- #ifndef DIALOG_H #define DIALOG_H #include <QDialog> namespace Ui { class Dialog; } class Dialog : public QDialog { Q_OBJECT public: explicit Dialog(QWidget *parent = 0); ~Dialog(); private: Ui::Dialog *ui; }; #endif // DIALOG_H
./CppHelloQtQtCreatorWindows/dialog.cpp
//--------------------------------------------------------------------------- /* CppHelloQtQtCreatorLubuntu, Hello World program using Qt Creator under Lubuntu Copyright 2013 Richel Bilderbeek This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program.If not, see <http://www.gnu.org/licenses/>. */ //--------------------------------------------------------------------------- //From http://www.richelbilderbeek.nl/CppHelloQtQtCreatorLubuntu.htm //--------------------------------------------------------------------------- #include "dialog.h" #include "ui_dialog.h" Dialog::Dialog(QWidget *parent) : QDialog(parent), ui(new Ui::Dialog) { ui->setupUi(this); this->setWindowTitle(QApplication::applicationName()); } Dialog::~Dialog() { delete ui; }
./CppHelloQtQtCreatorWindows/main.cpp
//--------------------------------------------------------------------------- /* CppHelloQtQtCreatorLubuntu, Hello World program using Qt Creator under Lubuntu Copyright 2013 Richel Bilderbeek This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program.If not, see <http://www.gnu.org/licenses/>. */ //--------------------------------------------------------------------------- //From http://www.richelbilderbeek.nl/CppHelloQtQtCreatorLubuntu.htm //--------------------------------------------------------------------------- //Support both Qt4 and Qt5 #include <qglobal.h> #if (QT_VERSION >= QT_VERSION_CHECK(5,0,0)) #include <QApplication> #else #include <QApplication> #endif #include "dialog.h" int main(int argc, char *argv[]) { QApplication a(argc, argv); Dialog w; w.show(); return a.exec(); }
./CppHelloQtQtCreatorWindows/CppHelloQtQtCreatorWindows.sh
#!/bin/bash mymake="e:/Qt/Qt5.1.0/Tools/mingw48_32/bin/mingw32-make.exe" myqmake="e:/Qt/Qt5.1.0/5.1.0/mingw48_32/bin/qmake.exe" mytarget="CppHelloQtQtCreatorWindows" myprofile=$mytarget.pro myexe=release/$mytarget.exe if [ -e $myqmake ] then echo "Compiler '$myqmake' found" else echo "Compiler '$myqmake' not found directly" #exit fi if [ -e $myprofile ] then echo "Qt Creator project '$myprofile' found" else echo "Qt Creator project '$myprofile' not found" exit fi echo "1/2: Creating Windows makefile" $myqmake $myprofile if [ -e Makefile ] then echo "Makefile created successfully" else echo "FAIL: $myqmake $myprofile" exit fi if [ -e $mymake ] then echo "Compiler '$mymake' found" else echo "Compiler '$mymake' not found directly" #exit fi echo "2/2: making makefile" $mymake echo $myexe if [ -e $myexe ] then echo "SUCCESS" else echo "FAIL" fi #Cleaning up rm Makefile rm Makefile.* rm -r release rm -r debug rm ui_*.*