(C++) HelloQtQtCreatorUbuntu
August 30, 2019 · View on GitHub
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: ./CppHelloQtQtCreatorUbuntu/CppHelloQtQtCreatorUbuntu.pro
QT += core gui sql greaterThan(QT_MAJOR_VERSION, 4): QT += widgets TEMPLATE = app SOURCES += main.cpp\ dialog.cpp HEADERS += dialog.h FORMS += dialog.ui
./CppHelloQtQtCreatorUbuntu/dialog.h
//--------------------------------------------------------------------------- /* CppHelloQtQtCreatorUbuntu, Hello World program using Qt Creator under Ubuntu Copyright 2011 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/CppHelloQtQtCreatorUbuntu.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(); protected: void changeEvent(QEvent *e); private: Ui::Dialog *ui; private slots: void on_pushButton_clicked(); }; //--------------------------------------------------------------------------- #endif // DIALOG_H
./CppHelloQtQtCreatorUbuntu/dialog.cpp
//--------------------------------------------------------------------------- /* CppHelloQtQtCreatorUbuntu, Hello World program using Qt Creator under Ubuntu Copyright 2011 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/CppHelloQtQtCreatorUbuntu.htm //--------------------------------------------------------------------------- #include "dialog.h" #include "ui_dialog.h" Dialog::Dialog(QWidget *parent) : QDialog(parent), ui(new Ui::Dialog) { ui->setupUi(this); } //--------------------------------------------------------------------------- Dialog::~Dialog() { delete ui; } //--------------------------------------------------------------------------- void Dialog::changeEvent(QEvent *e) { QDialog::changeEvent(e); switch (e->type()) { case QEvent::LanguageChange: ui->retranslateUi(this); break; default: break; } } //--------------------------------------------------------------------------- void Dialog::on_pushButton_clicked() { ui->pushButton->setText("Hello World"); } //---------------------------------------------------------------------------
./CppHelloQtQtCreatorUbuntu/main.cpp
//--------------------------------------------------------------------------- /* CppHelloQtQtCreatorUbuntu, Hello Qt program using Qt Creator under Ubuntu Copyright 2011 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/CppHelloQtQtCreatorUbuntu.htm //--------------------------------------------------------------------------- #include <QApplication> #include "dialog.h" //--------------------------------------------------------------------------- int main(int argc, char *argv[]) { QApplication a(argc, argv); Dialog w; w.show(); return a.exec(); } //---------------------------------------------------------------------------