- added example delegate in shop

- added animated darkness when the popup is open
This commit is contained in:
Dorian Zedler 2019-02-17 13:57:57 +01:00
parent f4639ba068
commit 54fff5ee84
4 changed files with 225 additions and 7 deletions

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!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>
<data>
<variable>EnvironmentId</variable>
@ -8,7 +8,7 @@
</data>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
<value type="int">0</value>
<value type="int">1</value>
</data>
<data>
<variable>ProjectExplorer.Project.EditorSettings</variable>
@ -557,7 +557,10 @@
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.AndroidDeployConfiguration2</value>
</valuemap>
<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">
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
@ -603,9 +606,9 @@
<valuelist type="QVariantList" key="Android.PreStartShellCmdListKey"/>
<value type="int" key="PE.EnvironmentAspect.Base">0</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.AndroidRunConfiguration:/home/dorian/QcookieClicker/QcookieClicker.pro</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">QcookieClicker</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">QcookieClicker</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="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>

View file

@ -1,10 +1,14 @@
import QtQuick 2.9
import QtQuick.Controls 2.4
import QtGraphicalEffects 1.0
Popup {
id: control
modal: true
dim: false
scale: 0
height: 300
@ -18,7 +22,194 @@ Popup {
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 {
@ -28,8 +219,10 @@ Popup {
bottom: contentRect.top
bottomMargin: -height * 0.22
}
source: "qrc:/graphics/shopTop.png"
fillMode: Image.PreserveAspectFit
mipmap: true
width: parent.width
}
@ -43,13 +236,19 @@ Popup {
source: "qrc:/graphics/shopBottom.png"
fillMode: Image.PreserveAspectFit
mipmap: true
width: parent.width
}
background: Rectangle {
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 }
}
}

View file

@ -12,6 +12,7 @@ Button {
background: Image {
source: control.imageSrc
mipmap: true
}
Behavior on scale {

View file

@ -1,6 +1,7 @@
import QtQuick 2.9
import QtQuick.Window 2.2
import QtQuick.Controls 2.4
import QtGraphicalEffects 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 {
id: shopPu