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