added lamp design button

This commit is contained in:
Max Grützner 2019-02-23 14:55:38 +01:00
parent 21afddb253
commit e8d886ccb3
13 changed files with 94 additions and 83 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
*.pro.user

View file

@ -15,7 +15,8 @@ DEFINES += QT_DEPRECATED_WARNINGS
SOURCES += \ SOURCES += \
main.cpp main.cpp
RESOURCES += qml.qrc RESOURCES += qml.qrc \
shared.qrc
# Additional import path used to resolve QML modules in Qt Creator's code model # Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH = QML_IMPORT_PATH =

View file

@ -1,73 +0,0 @@
# This file is used to ignore files which are generated
# ----------------------------------------------------------------------------
*~
*.autosave
*.a
*.core
*.moc
*.o
*.obj
*.orig
*.rej
*.so
*.so.*
*_pch.h.cpp
*_resource.rc
*.qm
.#*
*.*#
core
!core/
tags
.DS_Store
.directory
*.debug
Makefile*
*.prl
*.app
moc_*.cpp
ui_*.h
qrc_*.cpp
Thumbs.db
*.res
*.rc
/.qmake.cache
/.qmake.stash
# qtcreator generated files
*.pro.user*
# xemacs temporary files
*.flc
# Vim temporary files
.*.swp
# Visual Studio generated files
*.ib_pdb_index
*.idb
*.ilk
*.pdb
*.sln
*.suo
*.vcproj
*vcproj.*.*.user
*.ncb
*.sdf
*.opensdf
*.vcxproj
*vcxproj.*
# MinGW generated files
*.Debug
*.Release
# Python byte code
*.pyc
# Binaries
# --------
*.dll
*.exe

View file

@ -6,24 +6,94 @@ Window {
visible: true visible: true
width: 640 width: 640
height: 480 height: 480
title: qsTr("Hello World") title: qsTr("Das Schmalter")
Page { Page {
id: app id: app
state: "off"
anchors.fill: parent anchors.fill: parent
Button { Button {
id: onOffBt id: onOffBt
width: 400
height: width
anchors.centerIn: parent anchors.centerIn: parent
height: parent.height * 0.5 background: Item {
width: height id: lamp
Image {
text: "on/off" id: lampOn
source: "on.png"
background: Rectangle { anchors.fill: parent
color: onOffBt.pressed ? "lightgrey":"grey" scale: 0
radius: height / 2 }
Image {
id: lampOn0
source: "on0.png"
anchors.fill: parent
scale: 0
}
Image {
id: lampOn1
source: "on1.png"
anchors.fill: parent
scale: 0
}
Image {
id: lampOn2
source: "on2.png"
anchors.fill: parent
scale: 0
}
Image {
id: lampOn3
source: "on3.png"
anchors.fill: parent
scale: 0
}
Image {
id: lampOn4
source: "on4.png"
anchors.fill: parent
scale: 0
}
Image {
id: lampOn5
source: "on4.png"
anchors.fill: parent
scale: 0
}
Image {
id: lampOff
source: "off.png"
anchors.fill: parent
scale: 1
} }
} }
onClicked: {
if (app.state === "on") {
app.state = "off"
} else {
app.state = "on"
}
}
}
states: [
State {
name: "on"
PropertyChanges {
target: lampOn
scale: 1
}
PropertyChanges {
target: lampOff
scale: 0
}
},
State {
name: "off"
}
]
} }
} }

BIN
off.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

BIN
on.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

BIN
on0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

BIN
on1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
on2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
on3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
on4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
on5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

12
shared.qrc Normal file
View file

@ -0,0 +1,12 @@
<RCC>
<qresource prefix="/">
<file>off.png</file>
<file>on.png</file>
<file>on5.png</file>
<file>on4.png</file>
<file>on3.png</file>
<file>on2.png</file>
<file>on1.png</file>
<file>on0.png</file>
</qresource>
</RCC>