Organize project files
Put QML components into folders, remove unused ones, split __init__.py with engine.py.
This commit is contained in:
40
harmonyqml/components/base/Avatar.qml
Normal file
40
harmonyqml/components/base/Avatar.qml
Normal file
@@ -0,0 +1,40 @@
|
||||
import QtQuick 2.7
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQuick.Layouts 1.4
|
||||
|
||||
Item {
|
||||
property bool invisible: false
|
||||
property string username: "?"
|
||||
property var imageSource: null
|
||||
property int dimmension: 48
|
||||
|
||||
id: root
|
||||
width: dimmension
|
||||
height: invisible ? 1 : dimmension
|
||||
|
||||
Rectangle {
|
||||
id: letterRectangle
|
||||
anchors.fill: parent
|
||||
visible: ! invisible && imageSource === null
|
||||
color: Qt.hsla(Backend.hueFromString(username), 0.22, 0.5, 1)
|
||||
|
||||
HLabel {
|
||||
anchors.centerIn: parent
|
||||
text: username.charAt(0)
|
||||
color: "white"
|
||||
font.pixelSize: letterRectangle.height / 1.4
|
||||
}
|
||||
}
|
||||
|
||||
Image {
|
||||
id: avatarImage
|
||||
anchors.fill: parent
|
||||
visible: ! invisible && imageSource !== null
|
||||
|
||||
Component.onCompleted: if (imageSource) {source = imageSource}
|
||||
asynchronous: true
|
||||
mipmap: true
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
sourceSize.width: root.dimmension
|
||||
}
|
||||
}
|
12
harmonyqml/components/base/HLabel.qml
Normal file
12
harmonyqml/components/base/HLabel.qml
Normal file
@@ -0,0 +1,12 @@
|
||||
import QtQuick 2.7
|
||||
import QtQuick.Controls 2.0
|
||||
|
||||
Label {
|
||||
property int bigSize: 24
|
||||
property int normalSize: 16
|
||||
property int smallSize: 12
|
||||
|
||||
font.family: "Roboto"
|
||||
font.pixelSize: normalSize
|
||||
textFormat: Text.PlainText
|
||||
}
|
31
harmonyqml/components/base/HToolButton.qml
Normal file
31
harmonyqml/components/base/HToolButton.qml
Normal file
@@ -0,0 +1,31 @@
|
||||
import QtQuick 2.7
|
||||
import QtQuick.Controls 2.2
|
||||
import QtQuick.Layouts 1.4
|
||||
|
||||
ToolButton {
|
||||
property string tooltip: ""
|
||||
property string iconName: ""
|
||||
|
||||
id: "button"
|
||||
display: ToolButton.IconOnly
|
||||
icon.source: "../../icons/" + iconName + ".svg"
|
||||
background: Rectangle { color: "transparent" }
|
||||
|
||||
onClicked: toolTip.hide()
|
||||
|
||||
ToolTip {
|
||||
id: "toolTip"
|
||||
text: tooltip
|
||||
delay: Qt.styleHints.mousePressAndHoldInterval
|
||||
visible: text ? toolTipZone.containsMouse : false
|
||||
}
|
||||
MouseArea {
|
||||
id: "toolTipZone"
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
acceptedButtons: Qt.NoButton // Make button receive clicks normally
|
||||
|
||||
onEntered: button.background.color = "#656565"
|
||||
onExited: button.background.color = "transparent"
|
||||
}
|
||||
}
|
16
harmonyqml/components/base/ToolTipLabel.qml
Normal file
16
harmonyqml/components/base/ToolTipLabel.qml
Normal file
@@ -0,0 +1,16 @@
|
||||
import QtQuick 2.7
|
||||
import QtQuick.Controls 2.0
|
||||
|
||||
HLabel {
|
||||
id: text
|
||||
ToolTip {
|
||||
delay: Qt.styleHints.mousePressAndHoldInterval
|
||||
visible: text ? toolTipZone.containsMouse : false
|
||||
text: user_id
|
||||
}
|
||||
MouseArea {
|
||||
id: toolTipZone
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user