forked from qt-creator/qt-creator
TextEditor: Fix build for Qt5.9
Do not use functions that are not supported with
the minimum supported Qt for building QC.
Partially reverts 963dc84cc5
.
Change-Id: Ife03143a7cf5a8f428754040e7004efe42d70a8a
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
committed by
Friedemann Kleint
parent
749bc50e1b
commit
6ae786bcc8
@@ -386,10 +386,14 @@ private:
|
||||
|
||||
static int widthLimit()
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
auto screen = QGuiApplication::screenAt(QCursor::pos());
|
||||
if (!screen)
|
||||
screen = QGuiApplication::primaryScreen();
|
||||
return screen->availableGeometry().width() / 2;
|
||||
#else
|
||||
return QApplication::desktop()->availableGeometry(QCursor::pos()).width() / 2;
|
||||
#endif
|
||||
}
|
||||
|
||||
private:
|
||||
|
@@ -624,11 +624,15 @@ void DebuggerToolTipWidget::computeSize()
|
||||
// Add a bit of space to account for tooltip border, and not
|
||||
// touch the border of the screen.
|
||||
QPoint pos(x(), y());
|
||||
QTC_ASSERT(QApplication::desktop(), return);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
auto screen = QGuiApplication::screenAt(pos);
|
||||
if (!screen)
|
||||
screen = QGuiApplication::primaryScreen();
|
||||
QRect desktopRect = screen->availableGeometry();
|
||||
#else
|
||||
QTC_ASSERT(QApplication::desktop(), return);
|
||||
QRect desktopRect = QApplication::desktop()->availableGeometry();
|
||||
#endif
|
||||
const int maxWidth = desktopRect.right() - pos.x() - 5 - 5;
|
||||
const int maxHeight = desktopRect.bottom() - pos.y() - 5 - 5;
|
||||
|
||||
|
@@ -8252,7 +8252,11 @@ void TextEditorWidgetPrivate::updateTabStops()
|
||||
// to be set as an int. A work around is to access directly the QTextOption.
|
||||
qreal charWidth = QFontMetricsF(q->font()).width(QLatin1Char(' '));
|
||||
QTextOption option = q->document()->defaultTextOption();
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
option.setTabStopDistance(charWidth * m_document->tabSettings().m_tabSize);
|
||||
#else
|
||||
option.setTabStop(charWidth * m_document->tabSettings().m_tabSize);
|
||||
#endif
|
||||
q->document()->setDefaultTextOption(option);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user