From e3d690912ac2696bdbb23515a725523eda563a33 Mon Sep 17 00:00:00 2001 From: nasicurious Date: Tue, 2 Nov 2021 12:04:13 +0330 Subject: [PATCH] Create Project Template --- .gitignore | 2 ++ Servo/Servo.pro | 31 +++++++++++++++++++++++++++++++ ServoApplication.pro | 7 +++++++ Test/MainWindow.cpp | 15 +++++++++++++++ Test/MainWindow.h | 21 +++++++++++++++++++++ Test/MainWindow.ui | 22 ++++++++++++++++++++++ Test/Test.pro | 34 ++++++++++++++++++++++++++++++++++ Test/main.cpp | 11 +++++++++++ 8 files changed, 143 insertions(+) create mode 100644 .gitignore create mode 100644 Servo/Servo.pro create mode 100644 ServoApplication.pro create mode 100644 Test/MainWindow.cpp create mode 100644 Test/MainWindow.h create mode 100644 Test/MainWindow.ui create mode 100644 Test/Test.pro create mode 100644 Test/main.cpp diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..444078f --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.pro.user + diff --git a/Servo/Servo.pro b/Servo/Servo.pro new file mode 100644 index 0000000..cae823f --- /dev/null +++ b/Servo/Servo.pro @@ -0,0 +1,31 @@ +QT -= gui + +TEMPLATE = lib +DEFINES += SERVO_LIBRARY + +CONFIG += staticlib +CONFIG += c++11 + +# The following define makes your compiler emit warnings if you use +# any Qt feature that has been marked 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 it uses 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 + +SOURCES += \ + Servo.cpp + +HEADERS += \ + Servo_global.h \ + Servo.h + +# Default rules for deployment. +unix { + target.path = /usr/lib +} +!isEmpty(target.path): INSTALLS += target diff --git a/ServoApplication.pro b/ServoApplication.pro new file mode 100644 index 0000000..50728cd --- /dev/null +++ b/ServoApplication.pro @@ -0,0 +1,7 @@ +TEMPLATE = subdirs + +SUBDIRS += \ + Servo \ + Test + +Test.depends += Servo diff --git a/Test/MainWindow.cpp b/Test/MainWindow.cpp new file mode 100644 index 0000000..ec12972 --- /dev/null +++ b/Test/MainWindow.cpp @@ -0,0 +1,15 @@ +#include "MainWindow.h" +#include "ui_MainWindow.h" + +MainWindow::MainWindow(QWidget *parent) + : QMainWindow(parent) + , ui(new Ui::MainWindow) +{ + ui->setupUi(this); +} + +MainWindow::~MainWindow() +{ + delete ui; +} + diff --git a/Test/MainWindow.h b/Test/MainWindow.h new file mode 100644 index 0000000..274dd1b --- /dev/null +++ b/Test/MainWindow.h @@ -0,0 +1,21 @@ +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include + +QT_BEGIN_NAMESPACE +namespace Ui { class MainWindow; } +QT_END_NAMESPACE + +class MainWindow : public QMainWindow +{ + Q_OBJECT + +public: + MainWindow(QWidget *parent = nullptr); + ~MainWindow(); + +private: + Ui::MainWindow *ui; +}; +#endif // MAINWINDOW_H diff --git a/Test/MainWindow.ui b/Test/MainWindow.ui new file mode 100644 index 0000000..b232854 --- /dev/null +++ b/Test/MainWindow.ui @@ -0,0 +1,22 @@ + + + MainWindow + + + + 0 + 0 + 800 + 600 + + + + MainWindow + + + + + + + + diff --git a/Test/Test.pro b/Test/Test.pro new file mode 100644 index 0000000..7d0737c --- /dev/null +++ b/Test/Test.pro @@ -0,0 +1,34 @@ +QT += core gui + +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets + +CONFIG += c++11 + +# The following define makes your compiler emit warnings if you use +# any Qt feature that has been marked 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 it uses 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 + +SOURCES += \ + main.cpp \ + MainWindow.cpp + +HEADERS += \ + MainWindow.h + +FORMS += \ + MainWindow.ui + +LIBS += -L$$OUT_PWD/../Servo/ -lServo +PRE_TARGETDEPS += $$OUT_PWD/../Servo/libServo.a + +# Default rules for deployment. +qnx: target.path = /tmp/$${TARGET}/bin +else: unix:!android: target.path = /opt/$${TARGET}/bin +!isEmpty(target.path): INSTALLS += target diff --git a/Test/main.cpp b/Test/main.cpp new file mode 100644 index 0000000..723a9ab --- /dev/null +++ b/Test/main.cpp @@ -0,0 +1,11 @@ +#include "MainWindow.h" + +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + MainWindow w; + w.show(); + return a.exec(); +}