Skip to content

Commit e420573

Browse files
committedApr 23, 2023
Initial Commit
Project Graphical User Interface Calculator Application Using Qt C++ Framework, Build with Cmake
0 parents  commit e420573

9 files changed

+1405
-0
lines changed
 

‎.gitignore

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/build
2+
3+
# WINDOW
4+
5+
# MACOS General
6+
.DS_Store
7+
.AppleDouble
8+
.LSOverride
9+

‎CMakeLists.txt

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
cmake_minimum_required(VERSION 3.5)
2+
3+
project(QtCalculator VERSION 0.1 LANGUAGES CXX)
4+
5+
set(CMAKE_AUTOUIC ON)
6+
set(CMAKE_AUTOMOC ON)
7+
set(CMAKE_AUTORCC ON)
8+
9+
set(CMAKE_CXX_STANDARD 17)
10+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
11+
12+
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets)
13+
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)
14+
15+
set(PROJECT_SOURCES
16+
main.cpp
17+
mainwindow.cpp
18+
mainwindow.h
19+
mainwindow.ui
20+
)
21+
22+
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
23+
qt_add_executable(QtCalculator
24+
MANUAL_FINALIZATION
25+
${PROJECT_SOURCES}
26+
)
27+
# Define target properties for Android with Qt 6 as:
28+
# set_property(TARGET QtCalculator APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR
29+
# ${CMAKE_CURRENT_SOURCE_DIR}/android)
30+
# For more information, see https://doc.qt.io/qt-6/qt-add-executable.html#target-creation
31+
else()
32+
if(ANDROID)
33+
add_library(QtCalculator SHARED
34+
${PROJECT_SOURCES}
35+
)
36+
# Define properties for Android with Qt 5 after find_package() calls as:
37+
# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
38+
else()
39+
add_executable(QtCalculator
40+
${PROJECT_SOURCES}
41+
)
42+
endif()
43+
endif()
44+
45+
target_link_libraries(QtCalculator PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)
46+
47+
set_target_properties(QtCalculator PROPERTIES
48+
MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com
49+
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
50+
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
51+
MACOSX_BUNDLE TRUE
52+
WIN32_EXECUTABLE TRUE
53+
)
54+
55+
install(TARGETS QtCalculator
56+
BUNDLE DESTINATION .
57+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
58+
59+
if(QT_VERSION_MAJOR EQUAL 6)
60+
qt_finalize_executable(QtCalculator)
61+
endif()

‎CMakeLists.txt.user

+406
Large diffs are not rendered by default.

‎LICENSE.GPLV3.md

+686
Large diffs are not rendered by default.

‎LICENSE.LGPLV3.md

+174
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
GNU LESSER GENERAL PUBLIC LICENSE
2+
3+
The Qt Toolkit is Copyright (C) 2015 The Qt Company Ltd.
4+
Contact: http://www.qt.io/licensing/
5+
6+
You may use, distribute and copy the Qt Toolkit under the terms of
7+
GNU Lesser General Public License version 3, which is displayed below.
8+
This license makes reference to the version 3 of the GNU General
9+
Public License, which you can find in the LICENSE.GPLv3 file.
10+
11+
-------------------------------------------------------------------------
12+
13+
GNU LESSER GENERAL PUBLIC LICENSE
14+
Version 3, 29 June 2007
15+
16+
Copyright © 2007 Free Software Foundation, Inc. <http://fsf.org/>
17+
Everyone is permitted to copy and distribute verbatim copies of this
18+
licensedocument, but changing it is not allowed.
19+
20+
This version of the GNU Lesser General Public License incorporates
21+
the terms and conditions of version 3 of the GNU General Public
22+
License, supplemented by the additional permissions listed below.
23+
24+
0. Additional Definitions.
25+
26+
As used herein, “this License” refers to version 3 of the GNU Lesser
27+
General Public License, and the “GNU GPL” refers to version 3 of the
28+
GNU General Public License.
29+
30+
“The Library” refers to a covered work governed by this License,
31+
other than an Application or a Combined Work as defined below.
32+
33+
An “Application” is any work that makes use of an interface provided
34+
by the Library, but which is not otherwise based on the Library.
35+
Defining a subclass of a class defined by the Library is deemed a mode
36+
of using an interface provided by the Library.
37+
38+
A “Combined Work” is a work produced by combining or linking an
39+
Application with the Library. The particular version of the Library
40+
with which the Combined Work was made is also called the “Linked
41+
Version”.
42+
43+
The “Minimal Corresponding Source” for a Combined Work means the
44+
Corresponding Source for the Combined Work, excluding any source code
45+
for portions of the Combined Work that, considered in isolation, are
46+
based on the Application, and not on the Linked Version.
47+
48+
The “Corresponding Application Code” for a Combined Work means the
49+
object code and/or source code for the Application, including any data
50+
and utility programs needed for reproducing the Combined Work from the
51+
Application, but excluding the System Libraries of the Combined Work.
52+
53+
1. Exception to Section 3 of the GNU GPL.
54+
55+
You may convey a covered work under sections 3 and 4 of this License
56+
without being bound by section 3 of the GNU GPL.
57+
58+
2. Conveying Modified Versions.
59+
60+
If you modify a copy of the Library, and, in your modifications, a
61+
facility refers to a function or data to be supplied by an Application
62+
that uses the facility (other than as an argument passed when the
63+
facility is invoked), then you may convey a copy of the modified
64+
version:
65+
66+
a) under this License, provided that you make a good faith effort
67+
to ensure that, in the event an Application does not supply the
68+
function or data, the facility still operates, and performs
69+
whatever part of its purpose remains meaningful, or
70+
71+
b) under the GNU GPL, with none of the additional permissions of
72+
this License applicable to that copy.
73+
74+
3. Object Code Incorporating Material from Library Header Files.
75+
76+
The object code form of an Application may incorporate material from
77+
a header file that is part of the Library. You may convey such object
78+
code under terms of your choice, provided that, if the incorporated
79+
material is not limited to numerical parameters, data structure
80+
layouts and accessors, or small macros, inline functions and templates
81+
(ten or fewer lines in length), you do both of the following:
82+
83+
a) Give prominent notice with each copy of the object code that
84+
the Library is used in it and that the Library and its use are
85+
covered by this License.
86+
87+
b) Accompany the object code with a copy of the GNU GPL and this
88+
license document.
89+
90+
4. Combined Works.
91+
92+
You may convey a Combined Work under terms of your choice that, taken
93+
together, effectively do not restrict modification of the portions of
94+
the Library contained in the Combined Work and reverse engineering for
95+
debugging such modifications, if you also do each of the following:
96+
97+
a) Give prominent notice with each copy of the Combined Work that
98+
the Library is used in it and that the Library and its use are
99+
covered by this License.
100+
101+
b) Accompany the Combined Work with a copy of the GNU GPL and this
102+
license document.
103+
104+
c) For a Combined Work that displays copyright notices during
105+
execution, include the copyright notice for the Library among
106+
these notices, as well as a reference directing the user to the
107+
copies of the GNU GPL and this license document.
108+
109+
d) Do one of the following:
110+
111+
0) Convey the Minimal Corresponding Source under the terms of
112+
this License, and the Corresponding Application Code in a form
113+
suitable for, and under terms that permit, the user to
114+
recombine or relink the Application with a modified version of
115+
the Linked Version to produce a modified Combined Work, in the
116+
manner specified by section 6 of the GNU GPL for conveying
117+
Corresponding Source.
118+
119+
1) Use a suitable shared library mechanism for linking with
120+
the Library. A suitable mechanism is one that (a) uses at run
121+
time a copy of the Library already present on the user's
122+
computer system, and (b) will operate properly with a modified
123+
version of the Library that is interface-compatible with the
124+
Linked Version.
125+
126+
e) Provide Installation Information, but only if you would
127+
otherwise be required to provide such information under section 6
128+
of the GNU GPL, and only to the extent that such information is
129+
necessary to install and execute a modified version of the
130+
Combined Work produced by recombining or relinking the Application
131+
with a modified version of the Linked Version. (If you use option
132+
4d0, the Installation Information must accompany the Minimal
133+
Corresponding Source and Corresponding Application Code. If you
134+
use option 4d1, you must provide the Installation Information in
135+
the manner specified by section 6 of the GNU GPL for conveying
136+
Corresponding Source.)
137+
138+
5. Combined Libraries.
139+
140+
You may place library facilities that are a work based on the Library
141+
side by side in a single library together with other library
142+
facilities that are not Applications and are not covered by this
143+
License, and convey such a combined library under terms of your
144+
choice, if you do both of the following:
145+
146+
a) Accompany the combined library with a copy of the same work
147+
based on the Library, uncombined with any other library
148+
facilities, conveyed under the terms of this License.
149+
150+
b) Give prominent notice with the combined library that part of
151+
it is a work based on the Library, and explaining where to find
152+
the accompanying uncombined form of the same work.
153+
154+
6. Revised Versions of the GNU Lesser General Public License.
155+
156+
The Free Software Foundation may publish revised and/or new versions
157+
of the GNU Lesser General Public License from time to time. Such new
158+
versions will be similar in spirit to the present version, but may
159+
differ in detail to address new problems or concerns.
160+
161+
Each version is given a distinguishing version number. If the Library
162+
as you received it specifies that a certain numbered version of the
163+
GNU Lesser General Public License “or any later version” applies to
164+
it, you have the option of following the terms and conditions either
165+
of that published version or of any later version published by the
166+
Free Software Foundation. If the Library as you received it does not
167+
specify a version number of the GNU Lesser General Public License,
168+
you may choose any version of the GNU Lesser General Public License
169+
ever published by the Free Software Foundation.
170+
171+
If the Library as you received it specifies that a proxy can decide
172+
whether future versions of the GNU Lesser General Public License shall
173+
apply, that proxy's public statement of acceptance of any version is
174+
permanent authorization for you to choose that version for the Library.

‎main.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#include "mainwindow.h"
2+
3+
#include <QApplication>
4+
5+
int main(int argc, char *argv[])
6+
{
7+
QApplication a(argc, argv);
8+
MainWindow w;
9+
w.show();
10+
return a.exec();
11+
}

‎mainwindow.cpp

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#include "mainwindow.h"
2+
#include "./ui_mainwindow.h"
3+
4+
MainWindow::MainWindow(QWidget *parent)
5+
: QMainWindow(parent)
6+
, ui(new Ui::MainWindow)
7+
{
8+
ui->setupUi(this);
9+
}
10+
11+
MainWindow::~MainWindow()
12+
{
13+
delete ui;
14+
}
15+

‎mainwindow.h

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#ifndef MAINWINDOW_H
2+
#define MAINWINDOW_H
3+
4+
#include <QMainWindow>
5+
6+
QT_BEGIN_NAMESPACE
7+
namespace Ui { class MainWindow; }
8+
QT_END_NAMESPACE
9+
10+
class MainWindow : public QMainWindow
11+
{
12+
Q_OBJECT
13+
14+
public:
15+
MainWindow(QWidget *parent = nullptr);
16+
~MainWindow();
17+
18+
private:
19+
Ui::MainWindow *ui;
20+
};
21+
#endif // MAINWINDOW_H

‎mainwindow.ui

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ui version="4.0">
3+
<class>MainWindow</class>
4+
<widget class="QMainWindow" name="MainWindow">
5+
<property name="geometry">
6+
<rect>
7+
<x>0</x>
8+
<y>0</y>
9+
<width>800</width>
10+
<height>600</height>
11+
</rect>
12+
</property>
13+
<property name="windowTitle">
14+
<string>MainWindow</string>
15+
</property>
16+
<widget class="QWidget" name="centralwidget"/>
17+
<widget class="QMenuBar" name="menubar"/>
18+
<widget class="QStatusBar" name="statusbar"/>
19+
</widget>
20+
<resources/>
21+
<connections/>
22+
</ui>

0 commit comments

Comments
 (0)
Please sign in to comment.