- added example delegate in shop
- added animated darkness when the popup is open
This commit is contained in:
parent
f4639ba068
commit
54fff5ee84
4 changed files with 225 additions and 7 deletions
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE QtCreatorProject>
|
<!DOCTYPE QtCreatorProject>
|
||||||
<!-- Written by QtCreator 4.8.1, 2019-02-15T15:46:43. -->
|
<!-- Written by QtCreator 4.8.1, 2019-02-17T10:01:39. -->
|
||||||
<qtcreator>
|
<qtcreator>
|
||||||
<data>
|
<data>
|
||||||
<variable>EnvironmentId</variable>
|
<variable>EnvironmentId</variable>
|
||||||
|
@ -8,7 +8,7 @@
|
||||||
</data>
|
</data>
|
||||||
<data>
|
<data>
|
||||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||||
<value type="int">0</value>
|
<value type="int">1</value>
|
||||||
</data>
|
</data>
|
||||||
<data>
|
<data>
|
||||||
<variable>ProjectExplorer.Project.EditorSettings</variable>
|
<variable>ProjectExplorer.Project.EditorSettings</variable>
|
||||||
|
@ -557,7 +557,10 @@
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.AndroidDeployConfiguration2</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.AndroidDeployConfiguration2</value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
|
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings">
|
||||||
|
<value type="QString" key="AndroidDeviceSerialNumber">MWS0216A15001488</value>
|
||||||
|
<value type="int" key="AndroidVersion.ApiLevel">24</value>
|
||||||
|
</valuemap>
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
|
||||||
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
|
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
|
||||||
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
|
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
|
||||||
|
@ -603,9 +606,9 @@
|
||||||
<valuelist type="QVariantList" key="Android.PreStartShellCmdListKey"/>
|
<valuelist type="QVariantList" key="Android.PreStartShellCmdListKey"/>
|
||||||
<value type="int" key="PE.EnvironmentAspect.Base">0</value>
|
<value type="int" key="PE.EnvironmentAspect.Base">0</value>
|
||||||
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName"></value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">QcookieClicker</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">QcookieClicker</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.AndroidRunConfiguration:/home/dorian/QcookieClicker/QcookieClicker.pro</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.AndroidRunConfiguration:/home/dorian/Documents/git/qcookieclicker/QcookieClicker.pro</value>
|
||||||
<value type="QString" key="RunConfiguration.Arguments"></value>
|
<value type="QString" key="RunConfiguration.Arguments"></value>
|
||||||
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
|
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
|
||||||
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
||||||
|
|
|
@ -1,10 +1,14 @@
|
||||||
import QtQuick 2.9
|
import QtQuick 2.9
|
||||||
import QtQuick.Controls 2.4
|
import QtQuick.Controls 2.4
|
||||||
|
import QtGraphicalEffects 1.0
|
||||||
|
|
||||||
Popup {
|
Popup {
|
||||||
id: control
|
id: control
|
||||||
|
|
||||||
modal: true
|
modal: true
|
||||||
|
dim: false
|
||||||
|
|
||||||
|
scale: 0
|
||||||
|
|
||||||
height: 300
|
height: 300
|
||||||
|
|
||||||
|
@ -18,7 +22,194 @@ Popup {
|
||||||
|
|
||||||
color: "white"
|
color: "white"
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: contentItm
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
fill: parent
|
||||||
|
topMargin: -topImg.anchors.bottomMargin
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
ItemDelegate {
|
||||||
|
id: itemDelegate
|
||||||
|
width: parent.width
|
||||||
|
height: 40
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: leftSectionItm
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
top: parent.top
|
||||||
|
bottom: parent.bottom
|
||||||
|
left: parent.left
|
||||||
|
right: parent.right
|
||||||
|
rightMargin: parent.width * 0.8
|
||||||
|
margins: 5
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: iconRect
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
fill: parent
|
||||||
|
}
|
||||||
|
|
||||||
|
width: height
|
||||||
|
|
||||||
|
color: "red"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: middleSectionItm
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
top: parent.top
|
||||||
|
bottom: parent.bottom
|
||||||
|
left: parent.left
|
||||||
|
leftMargin: parent.width * 0.2
|
||||||
|
right: parent.right
|
||||||
|
rightMargin: parent.width * 0.3
|
||||||
|
margins: 5
|
||||||
|
}
|
||||||
|
|
||||||
|
Label {
|
||||||
|
id: titleLab
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
top: parent.top
|
||||||
|
left: iconRect.right
|
||||||
|
}
|
||||||
|
|
||||||
|
font.bold: true
|
||||||
|
|
||||||
|
text: "title"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: costItm
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
top: titleLab.bottom
|
||||||
|
bottom: parent.bottom
|
||||||
|
left: iconRect.right
|
||||||
|
}
|
||||||
|
|
||||||
|
Image {
|
||||||
|
id: costCookieImg
|
||||||
|
source: "qrc:/icons/cookie.png"
|
||||||
|
mipmap: true
|
||||||
|
height: parent.height
|
||||||
|
width: height
|
||||||
|
}
|
||||||
|
|
||||||
|
Label {
|
||||||
|
id: costLa
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
left: costCookieImg.right
|
||||||
|
verticalCenter: costCookieImg.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
text: "10"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: rightsectionItm
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
top: parent.top
|
||||||
|
bottom: parent.bottom
|
||||||
|
left: parent.left
|
||||||
|
leftMargin: parent.width * 0.75
|
||||||
|
right: parent.right
|
||||||
|
margins: 5
|
||||||
|
}
|
||||||
|
|
||||||
|
Label {
|
||||||
|
id: levelLableLa
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
top: parent.top
|
||||||
|
left: parent.left
|
||||||
|
}
|
||||||
|
|
||||||
|
font.pixelSize: parent.height * 0.45
|
||||||
|
|
||||||
|
text: "Level:"
|
||||||
|
}
|
||||||
|
|
||||||
|
Label {
|
||||||
|
id: levelTextLa
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
verticalCenterOffset: -parent.height * 0.24
|
||||||
|
left: levelLableLa.right
|
||||||
|
right: parent.right
|
||||||
|
}
|
||||||
|
|
||||||
|
font.pixelSize: parent.height * 0.45 * 1/text.length * 5 > parent.height * 0.45 ? parent.height * 0.45:parent.height * 0.45 * 1/text.length * 5
|
||||||
|
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
|
||||||
|
text: "10"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Label {
|
||||||
|
id: useLableLa
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
bottom: parent.bottom
|
||||||
|
left: parent.left
|
||||||
|
}
|
||||||
|
|
||||||
|
font.pixelSize: parent.height * 0.45
|
||||||
|
|
||||||
|
text: "Click:"
|
||||||
|
}
|
||||||
|
|
||||||
|
Label {
|
||||||
|
id: useTextLa
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
verticalCenterOffset: parent.height * 0.24
|
||||||
|
left: useLableLa.right
|
||||||
|
right: parent.right
|
||||||
|
}
|
||||||
|
|
||||||
|
font.pixelSize: parent.height * 0.45 * 1/text.length * 5 > parent.height * 0.45 ? parent.height * 0.45:parent.height * 0.45 * 1/text.length * 5
|
||||||
|
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
|
||||||
|
text: "10"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
background: Rectangle {
|
||||||
|
color: parent.pressed ? "lightgrey":"white"
|
||||||
|
border.color: "grey"
|
||||||
|
border.width: 2
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
|
@ -28,8 +219,10 @@ Popup {
|
||||||
bottom: contentRect.top
|
bottom: contentRect.top
|
||||||
bottomMargin: -height * 0.22
|
bottomMargin: -height * 0.22
|
||||||
}
|
}
|
||||||
|
|
||||||
source: "qrc:/graphics/shopTop.png"
|
source: "qrc:/graphics/shopTop.png"
|
||||||
fillMode: Image.PreserveAspectFit
|
fillMode: Image.PreserveAspectFit
|
||||||
|
mipmap: true
|
||||||
width: parent.width
|
width: parent.width
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,13 +236,19 @@ Popup {
|
||||||
|
|
||||||
source: "qrc:/graphics/shopBottom.png"
|
source: "qrc:/graphics/shopBottom.png"
|
||||||
fillMode: Image.PreserveAspectFit
|
fillMode: Image.PreserveAspectFit
|
||||||
|
mipmap: true
|
||||||
width: parent.width
|
width: parent.width
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enter: Transition {
|
||||||
|
NumberAnimation { properties: "scale"; to: 1; duration: 300; easing.type: Easing.Linear }
|
||||||
|
}
|
||||||
|
|
||||||
|
exit: Transition {
|
||||||
|
NumberAnimation { properties: "scale"; to: 0; duration: 300; easing.type: Easing.Linear }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ Button {
|
||||||
|
|
||||||
background: Image {
|
background: Image {
|
||||||
source: control.imageSrc
|
source: control.imageSrc
|
||||||
|
mipmap: true
|
||||||
}
|
}
|
||||||
|
|
||||||
Behavior on scale {
|
Behavior on scale {
|
||||||
|
|
15
qml/main.qml
15
qml/main.qml
|
@ -1,6 +1,7 @@
|
||||||
import QtQuick 2.9
|
import QtQuick 2.9
|
||||||
import QtQuick.Window 2.2
|
import QtQuick.Window 2.2
|
||||||
import QtQuick.Controls 2.4
|
import QtQuick.Controls 2.4
|
||||||
|
import QtGraphicalEffects 1.0
|
||||||
|
|
||||||
import com.itsblue.qcookieclicker 1.0
|
import com.itsblue.qcookieclicker 1.0
|
||||||
|
|
||||||
|
@ -76,6 +77,20 @@ Window {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Rectangle
|
||||||
|
{
|
||||||
|
id: popupModal
|
||||||
|
anchors.fill: parent
|
||||||
|
opacity: shopPu.opened ? 0.5:0
|
||||||
|
color: "black"
|
||||||
|
|
||||||
|
Behavior on opacity {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: 200
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ShopPopup {
|
ShopPopup {
|
||||||
id: shopPu
|
id: shopPu
|
||||||
|
|
||||||
|
|
Reference in a new issue