summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-08-27 20:23:57 +0200
committerLiang Qi <liang.qi@qt.io>2016-08-27 22:10:06 +0200
commitabe319c9cb811832bb4c9c95290564dfa7b3603a (patch)
treee93b7e554b3cd497b86f0be3bd46450a91ea088e /examples
parentefdd81ce80b018b7b5779876e94f1b722af7fb9a (diff)
parent69b3136bae16897492d27558c5909cd61a5e598e (diff)
downloadqtquickcontrols-abe319c9cb811832bb4c9c95290564dfa7b3603a.tar.gz
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts: tests/auto/qquicktreemodeladaptor/tst_qquicktreemodeladaptor.cpp Change-Id: I0b6018fdac65a5385136e4c3561fba1c52ecd32e
Diffstat (limited to 'examples')
-rw-r--r--examples/quickcontrols/controls/texteditor/src/documenthandler.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/examples/quickcontrols/controls/texteditor/src/documenthandler.cpp b/examples/quickcontrols/controls/texteditor/src/documenthandler.cpp
index bdecf5ba..69da88f0 100644
--- a/examples/quickcontrols/controls/texteditor/src/documenthandler.cpp
+++ b/examples/quickcontrols/controls/texteditor/src/documenthandler.cpp
@@ -179,6 +179,9 @@ void DocumentHandler::reset()
QTextCursor DocumentHandler::textCursor() const
{
+ if (!m_doc)
+ return QTextCursor();
+
QTextCursor cursor = QTextCursor(m_doc);
if (m_selectionStart != m_selectionEnd) {
cursor.setPosition(m_selectionStart);
@@ -209,6 +212,9 @@ void DocumentHandler::setSelectionEnd(int position)
void DocumentHandler::setAlignment(Qt::Alignment a)
{
+ if (!m_doc)
+ return;
+
QTextBlockFormat fmt;
fmt.setAlignment((Qt::Alignment) a);
QTextCursor cursor = QTextCursor(m_doc);