Skip to content

Commit 4fc6703

Browse files
author
Mikhail Kliuev
committed
init commit
0 parents  commit 4fc6703

40 files changed

+3630
-0
lines changed

LabCalculator.pro

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
QT += quick
2+
3+
SOURCES += \
4+
chemicalequivalentcontroller.cpp \
5+
evaluator.cpp \
6+
formulaparser.cpp \
7+
inputcontroller.cpp \
8+
main.cpp \
9+
periodictable.cpp \
10+
qmladapter.cpp
11+
12+
resources.files = \
13+
main.qml \
14+
MyTopPanel.qml \
15+
MySwip.qml \
16+
MyPageCaption.qml \
17+
MyInputItem.qml \
18+
MyRadioButtonInputItem.qml \
19+
MyInputItemVertical.qml
20+
21+
22+
resources.prefix = /$${TARGET}
23+
24+
RESOURCES += resources \
25+
res.qrc
26+
27+
# Additional import path used to resolve QML modules in Qt Creator's code model
28+
QML_IMPORT_PATH =
29+
30+
# Additional import path used to resolve QML modules just for Qt Quick Designer
31+
QML_DESIGNER_IMPORT_PATH =
32+
33+
# Default rules for deployment.
34+
qnx: target.path = /tmp/$${TARGET}/bin
35+
else: unix:!android: target.path = /opt/$${TARGET}/bin
36+
!isEmpty(target.path): INSTALLS += target
37+
38+
contains(ANDROID_TARGET_ARCH,arm64-v8a) {
39+
ANDROID_PACKAGE_SOURCE_DIR = \
40+
$$PWD/android
41+
}
42+
43+
DISTFILES +=
44+
45+
HEADERS += \
46+
chemicalequivalentcontroller.h \
47+
evaluator.h \
48+
expressionTree.h \
49+
formulaparser.h \
50+
inputcontroller.h \
51+
periodictable.h \
52+
qmladapter.h

LabCalculator.pro.user

+1,252
Large diffs are not rendered by default.

MyInputItem.qml

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import QtQuick
2+
import QtQuick.Controls 2.15
3+
import QtQuick 2.15
4+
import QtQuick.Window 2.15
5+
6+
7+
Item {
8+
id: inputItem
9+
10+
width: parent.width
11+
height: textFieldHeight
12+
13+
property color textColor: "black"
14+
property string textCaption: "Chemical formula"
15+
property alias methodHints: input.inputMethodHints
16+
property alias textInput: input.text
17+
property bool visibleState: true
18+
property bool readOnlyState: false
19+
property int leftMarginText: defaultMarginText
20+
property int textHeigth: 20
21+
readonly property int defaultMarginText: 10
22+
readonly property int textWidth: caption.width
23+
property int textFieldWidth: 160
24+
property int textFieldHeight: 35
25+
property int leftMarginInput: inputItem.leftMarginText + caption.width + inputItem.leftMarginText
26+
property RegularExpressionValidator inputValidator: RegularExpressionValidator { regularExpression: /[0-9.,]+/ }
27+
28+
Text {
29+
id: caption
30+
anchors { verticalCenter: parent.verticalCenter; left: parent.left; leftMargin: inputItem.leftMarginText }
31+
color: inputItem.textColor
32+
font.pointSize: inputItem.textHeigth
33+
text: inputItem.textCaption
34+
visible: inputItem.visibleState
35+
}
36+
37+
TextField {
38+
id: input
39+
anchors {
40+
left: parent.left
41+
leftMargin: inputItem.leftMarginInput
42+
verticalCenter: parent.verticalCenter
43+
}
44+
width: inputItem.textFieldWidth
45+
height: inputItem.textFieldHeight
46+
visible: inputItem.visibleState
47+
readOnly: inputItem.readOnlyState
48+
validator: inputItem.inputValidator
49+
50+
background: Rectangle {
51+
border.color: "black"
52+
border.width: 2
53+
radius: 10
54+
}
55+
}
56+
// }
57+
}

MyInputItemVertical.qml

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import QtQuick
2+
import QtQuick.Controls 2.15
3+
import QtQuick 2.15
4+
import QtQuick.Window 2.15
5+
6+
7+
Item {
8+
id: inputItem
9+
10+
property color textColor: "black"
11+
property string textCaption: "Equivalent"
12+
property alias textInput: input.text
13+
property alias methodHints: input.inputMethodHints
14+
property bool visibleState: true
15+
property bool readOnlyState: true
16+
property int leftMarginText: 10
17+
property int textHeigth: 20
18+
property int textFieldWidth: 80
19+
property int textFieldHeight: 35
20+
property int leftMarginInput: 10
21+
property RegularExpressionValidator inputValidator: RegularExpressionValidator { regularExpression: /[0-9.,]+/ }
22+
23+
24+
Text {
25+
id: caption
26+
anchors { left: parent.left; top: parent.top; topMargin: -4; leftMargin: inputItem.leftMarginText }
27+
color: inputItem.textColor
28+
font.pointSize: inputItem.textHeigth
29+
text: inputItem.textCaption
30+
visible: inputItem.visibleState
31+
}
32+
33+
TextField {
34+
id: input
35+
anchors {
36+
left: caption.left
37+
bottom: parent.bottom
38+
}
39+
width: inputItem.textFieldWidth
40+
height: inputItem.textFieldHeight
41+
visible: inputItem.visibleState
42+
readOnly: inputItem.readOnlyState
43+
validator: inputItem.inputValidator
44+
text: inputItem.textInput
45+
46+
background: Rectangle {
47+
border.color: "black"
48+
border.width: 2
49+
radius: 10
50+
}
51+
}
52+
53+
}

MyPageCaption.qml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import QtQuick
2+
import QtQuick.Controls 2.15
3+
import QtQuick 2.15
4+
import QtQuick.Window 2.15
5+
6+
7+
Item {
8+
id: pageCaption
9+
10+
property color colorPanel: "#009999"
11+
property color textColor: "black"
12+
property int textSize: 24
13+
property string text: ""
14+
15+
Rectangle {
16+
anchors.fill: parent
17+
color: pageCaption.colorPanel
18+
19+
Text {
20+
id: pageCaptionText
21+
anchors.verticalCenter: parent.verticalCenter
22+
color: pageCaption.textColor
23+
font.pointSize: pageCaption.textSize
24+
text: pageCaption.text
25+
}
26+
}
27+
28+
}

MyRadioButtonInputItem.qml

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import QtQuick
2+
import QtQuick.Controls 2.15
3+
import QtQuick 2.15
4+
import QtQuick.Window 2.15
5+
6+
7+
Item {
8+
id: radioButtonInputItem
9+
10+
property alias checkedState: radioButton.checked
11+
property bool visibleState: true
12+
property alias textInput: inputButton.text
13+
property alias methodHints: inputButton.inputMethodHints
14+
property int textFieldHeight: 35
15+
property int textFieldWidth: 80
16+
property int leftMargin: 10
17+
property int textSize: 20
18+
property string textButton: ""
19+
property RegularExpressionValidator inputValidator: RegularExpressionValidator { regularExpression: /[0-9.,]+/ }
20+
signal clicked()
21+
22+
RadioButton {
23+
id: radioButton
24+
anchors {
25+
top: parent.top
26+
topMargin: -radioButtonInputItem.textFieldHeight / 2
27+
left: parent.left
28+
leftMargin: radioButtonInputItem.leftMargin
29+
}
30+
text: radioButtonInputItem.textButton
31+
font.pointSize: radioButtonInputItem.textSize
32+
visible: radioButtonInputItem.visibleState
33+
34+
onClicked: {
35+
inputButton.text = ""
36+
radioButtonInputItem.clicked()
37+
}
38+
}
39+
40+
TextField {
41+
id: inputButton
42+
anchors {
43+
bottom: parent.bottom
44+
horizontalCenter: parent.horizontalCenter
45+
}
46+
width: parent.width - 20
47+
height: radioButtonInputItem.textFieldHeight
48+
visible: radioButtonInputItem.visibleState
49+
50+
validator: radioButtonInputItem.inputValidator
51+
text: radioButtonInputItem.textInput
52+
background: Rectangle {
53+
border.color: "black"
54+
border.width: 2
55+
radius: 10
56+
}
57+
readOnly: radioButton.checked
58+
}
59+
}

MySwip.qml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import QtQuick
2+
import QtQuick.Controls 2.15
3+
import QtQuick 2.15
4+
import QtQuick.Window 2.15
5+
6+
7+
Item {
8+
id: swip
9+
10+
property color colorBackGround: "#5ccccc"
11+
readonly property int count: swiper.count
12+
readonly property int currentIndex: swiper.currentIndex
13+
readonly property int firstPageNumber: 0
14+
readonly property int secondPageNumber: 1
15+
readonly property int thirdPageNumber: 2
16+
17+
SwipeView {
18+
id: swiper
19+
currentIndex: swip.firstPageNumber
20+
anchors.fill: parent
21+
22+
Repeater {
23+
id: repeater
24+
model: 3
25+
Item {
26+
Rectangle {
27+
anchors.fill: parent
28+
color: swip.colorBackGround
29+
MouseArea {
30+
anchors.fill: parent
31+
onClicked: forceActiveFocus()
32+
}
33+
}
34+
}
35+
}
36+
}
37+
}

MyTopPanel.qml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import QtQuick
2+
import QtQuick.Controls 2.15
3+
import QtQuick 2.15
4+
import QtQuick.Window 2.15
5+
6+
Item {
7+
id: topPanel
8+
9+
property color colorPanel: "white"
10+
property string imageSource: "../img/iconApp.png"
11+
property string caption: "Lab Calculator"
12+
property int pageCaptionTextHeight: 24
13+
14+
Rectangle {
15+
id: backGroundPanel
16+
anchors.fill: parent
17+
18+
color: topPanel.colorPanel
19+
Image {
20+
id: imageIcon
21+
anchors.verticalCenter: parent.verticalCenter
22+
width: parent.height
23+
height: parent.height
24+
source: topPanel.imageSource
25+
}
26+
Text {
27+
id: appName
28+
anchors.verticalCenter: imageIcon.verticalCenter
29+
anchors.left: imageIcon.right
30+
text: topPanel.caption
31+
font.pointSize: topPanel.pageCaptionTextHeight
32+
}
33+
}
34+
}

android/AndroidManifest.xml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.qtproject.example" android:installLocation="auto" android:versionCode="-- %%INSERT_VERSION_CODE%% --" android:versionName="-- %%INSERT_VERSION_NAME%% --">
3+
<!-- %%INSERT_PERMISSIONS -->
4+
<!-- %%INSERT_FEATURES -->
5+
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:smallScreens="true"/>
6+
<application android:name="org.qtproject.qt.android.bindings.QtApplication" android:hardwareAccelerated="true" android:label="-- %%INSERT_APP_NAME%% --" android:requestLegacyExternalStorage="true" android:allowNativeHeapPointerTagging="false" android:allowBackup="true" android:fullBackupOnly="false" android:icon="@drawable/icon">
7+
<activity android:name="org.qtproject.qt.android.bindings.QtActivity" android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density" android:label="-- %%INSERT_APP_NAME%% --" android:launchMode="singleTop" android:screenOrientation="unspecified" android:exported="true">
8+
<intent-filter>
9+
<action android:name="android.intent.action.MAIN"/>
10+
<category android:name="android.intent.category.LAUNCHER"/>
11+
</intent-filter>
12+
<meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --"/>
13+
<meta-data android:name="android.app.arguments" android:value="-- %%INSERT_APP_ARGUMENTS%% --"/>
14+
<meta-data android:name="android.app.extract_android_style" android:value="minimal"/>
15+
</activity>
16+
17+
<provider android:name="androidx.core.content.FileProvider" android:authorities="${applicationId}.qtprovider" android:exported="false" android:grantUriPermissions="true">
18+
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/qtprovider_paths"/>
19+
</provider>
20+
</application>
21+
</manifest>

0 commit comments

Comments
 (0)