mirror of
https://github.com/QuasarApp/ViewSolutions.git
synced 2025-05-05 14:09:46 +00:00
simple fixes
This commit is contained in:
parent
549142fba0
commit
c4595d05b8
Examples/src
ViewSolutions/src/ViewSolutionsModule
@ -13,7 +13,6 @@ Page {
|
||||
anchors.fill: parent
|
||||
delegate: Component {
|
||||
ViewPortPage {
|
||||
viewPortDelegatH: 500
|
||||
scrollPos: viewPort.globalPos
|
||||
source: modelData
|
||||
viewground: root
|
||||
|
@ -10,6 +10,7 @@ Item {
|
||||
property string text: ""
|
||||
property bool hover: false
|
||||
property bool presed: false
|
||||
|
||||
property string toolTip: ""
|
||||
|
||||
property color textColor: Material.color(Material.Grey)
|
||||
@ -73,6 +74,7 @@ Item {
|
||||
|
||||
Label {
|
||||
text: root.text
|
||||
visible: text.length
|
||||
Layout.preferredHeight: root.height * 0.1
|
||||
Layout.fillWidth: true
|
||||
color: textColor
|
||||
|
@ -61,29 +61,54 @@ Item {
|
||||
|
||||
function updateLayout() {
|
||||
|
||||
if (background) {
|
||||
|
||||
if (background !== flickable.backgroundOld) {
|
||||
if (flickable.backgroundOld) {
|
||||
flickable.backgroundOld.destroy()
|
||||
}
|
||||
|
||||
background.parent = this;
|
||||
background.anchors.fill = this;
|
||||
background.z = 0;
|
||||
flickable.backgroundOld = background
|
||||
}
|
||||
|
||||
flickable.z = 1;
|
||||
|
||||
if (bloor) {
|
||||
if (bloor !== flickable.bloorOld) {
|
||||
if (flickable.bloorOld) {
|
||||
flickable.bloorOld.destroy()
|
||||
}
|
||||
bloor.parent = this;
|
||||
bloor.anchors.fill = this;
|
||||
bloor.z = 2;
|
||||
flickable.bloorOld = bloor
|
||||
|
||||
}
|
||||
|
||||
if (content) {
|
||||
if (content !== flickable.contentOld) {
|
||||
if (flickable.contentOld) {
|
||||
flickable.contentOld.destroy()
|
||||
}
|
||||
content.parent = this;
|
||||
content.anchors.fill = this;
|
||||
content.z = 3;
|
||||
flickable.contentOld = content
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Flickable {
|
||||
id: flickable
|
||||
|
||||
property var backgroundOld: Item {
|
||||
}
|
||||
property var bloorOld: Item {
|
||||
}
|
||||
property var contentOld: Item {
|
||||
}
|
||||
|
||||
|
||||
contentWidth: viewground.width
|
||||
contentHeight: viewground.height
|
||||
clip: true
|
||||
|
@ -3,48 +3,67 @@ import QtQuick.Layouts 1.14
|
||||
import QtQuick.Controls 2.14
|
||||
import QtQuick.Controls.Material 2.14
|
||||
import QtQuick.Controls.Universal 2.14
|
||||
import QtGraphicalEffects 1.14
|
||||
|
||||
|
||||
ViewPortDelegatBase {
|
||||
id: root
|
||||
property string title: ""
|
||||
property string text: ""
|
||||
property int textMargins: 10
|
||||
property int additionalHeight: getBrCount(text) * sourceText.fontInfo.pixelSize
|
||||
|
||||
function getBrCount(text) {
|
||||
return (text.match(/<br>/g) || []).length;
|
||||
}
|
||||
|
||||
viewPortDelegatH: header.height + sourceText.paintedHeight + additionalHeight
|
||||
|
||||
background: Rectangle {
|
||||
color: "#00ffffff"
|
||||
border.color: "#a7777777"
|
||||
border.width: 4
|
||||
radius: height * 0.01
|
||||
radius: height * 0.05
|
||||
}
|
||||
|
||||
bloor: Rectangle {
|
||||
color: "#55ffffff"
|
||||
color: (Material.theme == Material.Dark)? "#55000000": "#55cdcdcd"
|
||||
border.color: "#a7777777"
|
||||
border.width: 4
|
||||
radius: height * 0.01
|
||||
border.width: 0
|
||||
radius: height * 0.05
|
||||
}
|
||||
|
||||
content: Item {
|
||||
id: privatePage
|
||||
|
||||
clip: true
|
||||
Label {
|
||||
id: header
|
||||
font.bold: true
|
||||
font.pixelSize: height * 0.5
|
||||
font.pointSize: 32
|
||||
text: title;
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
wrapMode: Text.WordWrap
|
||||
|
||||
height: parent.height * 0.2
|
||||
clip: true
|
||||
height: paintedHeight
|
||||
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
||||
layer.effect: DropShadow {
|
||||
verticalOffset: 2
|
||||
color: "#80000000"
|
||||
radius: 1
|
||||
samples: 3
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
id: sourceText
|
||||
font.bold: false
|
||||
font.pixelSize: header.font.pixelSize * 0.5
|
||||
font.pointSize: 20
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: root.text
|
||||
@ -54,6 +73,17 @@ ViewPortDelegatBase {
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.horizontalCenter: parent.Center
|
||||
anchors.margins: textMargins
|
||||
|
||||
layer.enabled: true
|
||||
layer.effect: DropShadow {
|
||||
verticalOffset: 2
|
||||
color: "#80000000"
|
||||
radius: 1
|
||||
samples: 3
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user