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

@@ -1,5 +1,6 @@
DEFINES += CORE_LIBRARY
QT += help \
QT += gui-private \
help \
network \
printsupport \
qml \

View File

@@ -39,6 +39,8 @@
#include <QPlainTextEdit>
#include <QTextCursor>
#include <private/qtextcursor_p.h>
namespace Core {
struct BaseTextFindPrivate
@@ -392,8 +394,13 @@ void BaseTextFind::defineFindScope()
{
QTextCursor cursor = textCursor();
if (cursor.hasSelection() && cursor.block() != cursor.document()->findBlock(cursor.anchor())) {
#if QT_VERSION >= QT_VERSION_CHECK(5,6,0)
d->m_findScopeStart = QTextCursorPrivate::fromPosition(document()->docHandle(), qMax(0, cursor.selectionStart()));
d->m_findScopeEnd = QTextCursorPrivate::fromPosition(document()->docHandle(), cursor.selectionEnd());
#else
d->m_findScopeStart = QTextCursor(document()->docHandle(), qMax(0, cursor.selectionStart()));
d->m_findScopeEnd = QTextCursor(document()->docHandle(), cursor.selectionEnd());
#endif
d->m_findScopeVerticalBlockSelectionFirstColumn = -1;
d->m_findScopeVerticalBlockSelectionLastColumn = -1;

View File

@@ -1,5 +1,5 @@
DEFINES += TEXTEDITOR_LIBRARY
QT += network printsupport xml
QT += gui-private network printsupport xml
CONFIG += exceptions
CONFIG += include_source_dir # For the highlighter autotest.
include(../../qtcreatorplugin.pri)

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);