Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Q
qtquickcontrols-nemo
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
NemoMobile
qtquickcontrols-nemo
Commits
c6fc74ed
Commit
c6fc74ed
authored
Jul 26, 2018
by
Sergey Chupligin
Committed by
Sergey Chupligin
Jul 26, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PageStack] be pageStack sagety
parent
98f52ccf
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
111 additions
and
1 deletion
+111
-1
BrokenPage.qml
examples/touch/content/BrokenPage.qml
+5
-0
glacier-components.qml
examples/touch/glacier-components.qml
+4
-0
controls.pro
src/controls/controls.pro
+2
-1
ApplicationWindow.qml
src/controls/qml/ApplicationWindow.qml
+44
-0
ErrorStackPage.qml
src/controls/qml/ErrorStackPage.qml
+56
-0
No files found.
examples/touch/content/BrokenPage.qml
0 → 100644
View file @
c6fc74ed
import
QtQuick
2.6
SomeBrokenPage
{
}
examples/touch/glacier-components.qml
View file @
c6fc74ed
...
...
@@ -133,6 +133,10 @@ ApplicationWindow {
title
:
"
Notifications
"
page
:
"
content/NotificationsPage.qml
"
}
ListElement
{
title
:
"
Broken page
"
page
:
"
content/BrokenPage.qml
"
}
}
...
...
src/controls/controls.pro
View file @
c6fc74ed
...
...
@@ -27,8 +27,9 @@ QML_FILES += \
qml
/
DatePicker
.
qml
\
qml
/
TimePicker
.
qml
\
qml
/
ScrollDecorator
.
qml
\
qml
/
dialogs
/
QueryDialog
.
qml
\
qml
/
TextField
.
qml
\
qml
/
ErrorStackPage
.
qml
\
qml
/
dialogs
/
QueryDialog
.
qml
\
qml
/
dialogs
/
SelectionDialog
.
qml
\
qml
/
dialogs
/
Dialog
.
qml
...
...
src/controls/qml/ApplicationWindow.qml
View file @
c6fc74ed
...
...
@@ -66,6 +66,50 @@ NemoWindow {
}
}
//Safety version of pageStack.push - if we can't load component - show error page page with
//error message and back button
function
push
(
url
,
params
)
{
if
(
!
params
){
params
=
{}
}
console
.
log
(
"
##
"
,
url
,
params
,
pageStack
)
var
component
=
Qt
.
createComponent
(
url
)
if
(
component
.
status
===
Component
.
Ready
)
{
pageStack
.
push
(
component
.
createObject
(
pageStack
,
params
))
}
else
{
console
.
warn
(
"
Error loading component
"
,
url
,
component
.
errorString
())
pageStack
.
push
(
Qt
.
resolvedUrl
(
"
ErrorStackPage.qml
"
),
{
error
:
component
.
errorString
()})
}
}
Timer
{
id
:
_errorTimer
property
string
errorString
interval
:
50
repeat
:
false
onTriggered
:
{
pageStack
.
replace
(
Qt
.
resolvedUrl
(
"
ErrorStackPage.qml
"
),
{
error
:
errorString
})
errorString
=
""
}
}
Connections
{
target
:
pageStack
onBusyChanged
:
{
if
(
_errorTimer
.
errorString
&&
!
pageStack
.
busy
)
{
_errorTimer
.
start
()
}
}
onCurrentItemChanged
:
{
var
qmltype
=
pageStack
.
currentItem
.
toString
()
if
(
qmltype
.
slice
(
0
,
10
)
===
"
QQuickText
"
)
{
_errorTimer
.
errorString
=
pageStack
.
currentItem
.
text
}
}
}
function
orientationConstraintsChanged
()
{
//if the current orientation is not allowed anymore, fallback to an allowed one
...
...
src/controls/qml/ErrorStackPage.qml
0 → 100644
View file @
c6fc74ed
/****************************************************************************************
**
** Copyright (C) 2018 Chupligin Sergey <neochapay@gmail.com>
** All rights reserved.
**
** You may use this file under the terms of BSD license as follows:
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** * Neither the name of the author nor the
** names of its contributors may be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR
** ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**
****************************************************************************************/
import
QtQuick
2.6
import
QtQuick
.
Controls
.
Styles
.
Nemo
1.0
Page
{
id
:
root
property
alias
error
:
errorLabel
.
text
headerTools
:
HeaderToolsLayout
{
showBackButton
:
true
;
title
:
qsTr
(
"
Error
"
)
}
Column
{
spacing
:
40
width
:
parent
.
width
anchors.centerIn
:
parent
Label
{
id
:
errorLabel
width
:
parent
.
width
text
:
qsTr
(
"
We got some error
"
)
wrapMode
:
Text
.
WrapAtWordBoundaryOrAnywhere
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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