Adapt to QtGui changes that broke private API source compatibility

The public constructors in QTextCursor that were private API are no
longer public.

Task-number: QTCREATORBUG-15238
Change-Id: I3bc59670b62d4afaa645ffff1411b76029249840
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
Thiago Macieira
2015-10-29 10:08:29 -07:00
parent fea48a1e0d
commit f443c95dcc
4 changed files with 17 additions and 2 deletions

View File

@@ -37,6 +37,8 @@
#include <QPainter>
#include <QTextBlock>
#include <private/qtextcursor_p.h>
using namespace TextEditor;
using namespace TextEditor::Internal;
@@ -92,8 +94,13 @@ void TextEditorOverlay::addOverlaySelection(int begin, int end,
selection.m_fg = fg;
selection.m_bg = bg;
#if QT_VERSION >= QT_VERSION_CHECK(5,6,0)
selection.m_cursor_begin = QTextCursorPrivate::fromPosition(document->docHandle(), begin);
selection.m_cursor_end = QTextCursorPrivate::fromPosition(document->docHandle(), end);
#else
selection.m_cursor_begin = QTextCursor(document->docHandle(), begin);
selection.m_cursor_end = QTextCursor(document->docHandle(), end);
#endif
if (overlaySelectionFlags & ExpandBegin)
selection.m_cursor_begin.setKeepPositionOnInsert(true);