Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Leander Schulten
Lichtsteuerung
Commits
088eee8a
Commit
088eee8a
authored
Oct 04, 2019
by
Leander Schulten
Browse files
ModuleView: Fix Bug where code was not visible. Replaced System Dialogs by QtQuick Popups
parent
f49e117a
Pipeline
#190396
passed with stage
in 5 minutes and 2 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/qml/ModuleView.qml
View file @
088eee8a
import
QtQuick
2.1
1
import
QtQuick
.
Controls
2.2
import
QtQuick
.
Layouts
1.
0
import
QtQuick
2.1
2
import
QtQuick
.
Controls
2.
1
2
import
QtQuick
.
Layouts
1.
12
import
custom
.
licht
1.0
import
QtQuick
.
Controls
.
Material
2.2
import
QtQuick
.
Dialogs
1.2
import
QtQuick
.
Controls
.
Material
2.12
import
QtQml
2.12
import
QtQuick
.
Window
2.12
import
"
components
"
Item
{
...
...
@@ -347,6 +347,7 @@ Item{
onHoveredChanged
:
if
(
!
hovered
&&
listView
.
currentModelData
)
listView
.
currentModelData
.
code
=
codeEditor
.
text
clip
:
true
TextArea
{
z
:
2
property
real
lineHeight
:
contentHeight
/
lineCount
font.family
:
"
Liberation Mono
"
font.pointSize
:
10
...
...
@@ -516,7 +517,13 @@ Item{
}
onInformation
:{
informationDialog
.
text
=
text
if
(
text
.
indexOf
(
"
error
"
)
>=
0
){
informationDialog
.
title
=
"
Error while compiling
"
;
informationDialog
.
text
=
text
;
}
else
{
informationDialog
.
title
=
text
;
informationDialog
.
text
=
""
;
}
informationDialog
.
visible
=
true
;
}
}
...
...
@@ -537,7 +544,7 @@ Item{
}
}
// TextArea
// Must be behind TextArea because of https://bugreports.qt.io/browse/QTBUG-62292
Rectangle
{
Item
{
anchors.fill
:
codeEditor
anchors.topMargin
:
codeEditor
.
topPadding
TextMetrics
{
...
...
@@ -589,110 +596,143 @@ Item{
}
}
Message
Dialog
{
Dialog
{
id
:
informationDialog
modal
:
true
standardButtons
:
Dialog
.
Ok
width
:
600
margins
:
50
leftPadding
:
header
.
leftPadding
rightPadding
:
footer
.
rightPadding
bottomPadding
:
0
x
:
(
Window
.
window
.
width
-
width
)
/
2
;
y
:
(
root
.
height
-
height
)
/
2
;
property
alias
text
:
dialogText
.
text
onAboutToShow
:
{
contentItem
.
ScrollBar
.
vertical
.
position
=
0
;
contentItem
.
ScrollBar
.
horizontal
.
position
=
0
;
}
contentItem
:
ScrollView
{
clip
:
true
;
ScrollBar.vertical.policy
:
ScrollBar
.
vertical
.
visualSize
===
1
?
ScrollBar
.
AlwaysOff
:
ScrollBar
.
AlwaysOn
Text
{
font.family
:
"
Courier New
"
font.bold
:
true
onContentWidthChanged
:
console
.
log
(
"
contentWidth
"
,
contentWidth
)
id
:
dialogText
}
}
}
Dialog
{
property
var
prop
;
onPropChanged
:
print
(
prop
.
typ
)
modality
:
Qt
.
WindowModal
title
:
"
Add/Change Property
"
width
:
300
modal
:
true
closePolicy
:
Popup
.
CloseOnEscape
width
:
300
margins
:
50
padding
:
10
x
:
(
root
.
width
-
width
)
/
2
;
id
:
dialog
contentItem
:
Pane
{
GridLayout
{
anchors.fill
:
parent
columns
:
2
Label
{
text
:
"
Name
"
}
TextInputField
{
id
:
name
Layout.fillWidth
:
true
text
:
dialog
.
prop
.
name
validator
:
RegExpValidator
{
regExp
:
/
[
a-z
][
a-z_0-9
]
*$/i
}
}
Label
{
text
:
"
Beschreibung
"
}
TextInputField
{
id
:
besch
Layout.fillWidth
:
true
text
:
dialog
.
prop
.
description
}
Label
{
text
:
"
Typ
"
}
ComboBox
{
currentIndex
:
dialog
.
prop
.
type
id
:
type
model
:
modolePropertyTypeList
Layout.fillWidth
:
true
onCurrentIndexChanged
:
{
// "Int" << "Long" << "Float" << "Double" << "Bool" << "String";
minVal
.
enabled
=
currentIndex
>=
0
&&
currentIndex
<=
3
;
maxVal
.
enabled
=
currentIndex
>=
0
&&
currentIndex
<=
3
;
defaultVal
.
enabled
=
currentIndex
>=
0
&&
currentIndex
<=
4
;
}
}
Label
{
text
:
"
min value
"
header
:
Label
{
topPadding
:
15
text
:
"
Add/Change Property
"
font.pointSize
:
14
font.bold
:
true
verticalAlignment
:
"
AlignVCenter
"
horizontalAlignment
:
"
AlignHCenter
"
}
contentItem
:
GridLayout
{
columns
:
2
Label
{
text
:
"
Name
"
}
TextInputField
{
id
:
name
Layout.fillWidth
:
true
text
:
dialog
.
prop
.
name
validator
:
RegExpValidator
{
regExp
:
/
[
a-z
][
a-z_0-9
]
*$/i
}
TextInputField
{
Layout.fillWidth
:
true
id
:
minVal
validator
:
IntValidator
{}
text
:
type
.
currentIndex
===
4
?
"
0
"
:
type
.
currentIndex
===
5
?
""
:
dialog
.
prop
.
minValue
}
Label
{
text
:
"
Beschreibung
"
}
TextInputField
{
id
:
besch
Layout.fillWidth
:
true
text
:
dialog
.
prop
.
description
}
Label
{
text
:
"
Typ
"
}
ComboBox
{
currentIndex
:
dialog
.
prop
.
type
id
:
type
model
:
modolePropertyTypeList
Layout.fillWidth
:
true
onCurrentIndexChanged
:
{
// "Int" << "Long" << "Float" << "Double" << "Bool" << "String";
minVal
.
enabled
=
currentIndex
>=
0
&&
currentIndex
<=
3
;
maxVal
.
enabled
=
currentIndex
>=
0
&&
currentIndex
<=
3
;
defaultVal
.
enabled
=
currentIndex
>=
0
&&
currentIndex
<=
4
;
}
}
Label
{
text
:
"
min value
"
}
TextInputField
{
Layout.fillWidth
:
true
id
:
minVal
validator
:
IntValidator
{}
text
:
type
.
currentIndex
===
4
?
"
0
"
:
type
.
currentIndex
===
5
?
""
:
dialog
.
prop
.
minValue
}
Label
{
text
:
"
max value
"
}
TextInputField
{
Layout.fillWidth
:
true
id
:
maxVal
validator
:
IntValidator
{}
text
:
type
.
currentIndex
===
4
?
"
1
"
:
type
.
currentIndex
===
5
?
""
:
dialog
.
prop
.
maxValue
}
Label
{
text
:
"
default value
"
Label
{
text
:
"
max value
"
}
TextInputField
{
Layout.fillWidth
:
true
id
:
maxVal
validator
:
IntValidator
{}
text
:
type
.
currentIndex
===
4
?
"
1
"
:
type
.
currentIndex
===
5
?
""
:
dialog
.
prop
.
maxValue
}
Label
{
text
:
"
default value
"
}
TextInputField
{
text
:
type
.
currentIndex
!==
5
?
dialog
.
prop
.
defaultValue
:
""
Layout.fillWidth
:
true
id
:
defaultVal
enabled
:
type
.
currentIndex
!==
5
validator
:
IntValidator
{
top
:
Number
(
maxVal
.
text
)
bottom
:
Number
(
minVal
.
text
)
}
TextInputField
{
text
:
type
.
currentIndex
!==
5
?
dialog
.
prop
.
defaultValue
:
""
Layout.fillWidth
:
true
id
:
defaultVal
enabled
:
type
.
currentIndex
!==
5
validator
:
IntValidator
{
top
:
Number
(
maxVal
.
text
)
bottom
:
Number
(
minVal
.
text
)
}
}
RowLayout
{
Layout.columnSpan
:
2
Button
{
Layout.fillWidth
:
true
text
:
"
Abbrechen
"
onClicked
:
dialog
.
visible
=
false
}
RowLayout
{
Layout.columnSpan
:
2
Button
{
Layout.fillWidth
:
true
text
:
"
Abbrechen
"
onClicked
:
dialog
.
visible
=
false
}
Button
{
Layout.fillWidth
:
true
text
:
"
Übernehmen
"
onClicked
:
{
dialog
.
visible
=
false
dialog
.
prop
.
name
=
name
.
text
;
dialog
.
prop
.
description
=
besch
.
text
;
dialog
.
prop
.
type
=
type
.
currentIndex
;
if
(
minVal
.
text
.
length
!==
0
)
dialog
.
prop
.
minValue
=
minVal
.
text
if
(
maxVal
.
text
.
length
!==
0
)
dialog
.
prop
.
maxValue
=
maxVal
.
text
if
(
defaultVal
.
text
.
length
!==
0
)
dialog
.
prop
.
defaultValue
=
defaultVal
.
text
}
Button
{
Layout.fillWidth
:
true
text
:
"
Übernehmen
"
onClicked
:
{
dialog
.
visible
=
false
dialog
.
prop
.
name
=
name
.
text
;
dialog
.
prop
.
description
=
besch
.
text
;
dialog
.
prop
.
type
=
type
.
currentIndex
;
if
(
minVal
.
text
.
length
!==
0
)
dialog
.
prop
.
minValue
=
minVal
.
text
if
(
maxVal
.
text
.
length
!==
0
)
dialog
.
prop
.
maxValue
=
maxVal
.
text
if
(
defaultVal
.
text
.
length
!==
0
)
dialog
.
prop
.
defaultValue
=
defaultVal
.
text
}
}
}
}
}
}
// contentItem: GridLayout
}
// Dialog
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment