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



Hello Qt using Qt Creator under Lubuntu 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: ./CppHelloQtQtCreatorLubuntu/CppHelloQtQtCreatorLubuntu.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
./CppHelloQtQtCreatorLubuntu/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
./CppHelloQtQtCreatorLubuntu/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; }
./CppHelloQtQtCreatorLubuntu/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(); }
./CppHelloQtQtCreatorLubuntu/CppHelloQtQtCreatorLubuntu.sh
#!/bin/bash myfile="qmake" mytarget="CppHelloQtQtCreatorLubuntu" myprofile=$mytarget.pro if [ ! -e $myprofile ] then echo "Qt Creator project '$myprofile' not found" exit fi $myfile $myprofile if [ ! -e Makefile ] then echo "FAIL: $myfile $myprofile" exit fi make if [ -e $mytarget ] then echo $mytarget": SUCCESS" else echo $mytarget": FAIL" fi #Cleaning up rm *.o rm Makefile rm $mytarget rm moc_*.* rm ui_*.*