aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/texteditor
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2022-08-26 10:30:00 +0200
committerEike Ziller <eike.ziller@qt.io>2022-09-01 06:58:04 +0000
commit04e50438eb85c1b2be6d4dcdfd5319cdb55ae576 (patch)
tree4a3e9f078730bb538e2ca2751d189ff14a89901e /src/plugins/texteditor
parent34a9491a08639f8df0b55d74d51f4dadaa1cc2fd (diff)
Utils: Remove Utils::optional
Since we are now requiring macOS 10.14 we can remove our local implementation of optional and use std::optional for macOS too. Change-Id: I2bd018261b68da64f7f031a812045dd7784697e1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Diffstat (limited to 'src/plugins/texteditor')
-rw-r--r--src/plugins/texteditor/indenter.h7
-rw-r--r--src/plugins/texteditor/texteditor.cpp6
-rw-r--r--src/plugins/texteditor/textindenter.cpp4
-rw-r--r--src/plugins/texteditor/textindenter.h2
-rw-r--r--src/plugins/texteditor/textmark.cpp2
-rw-r--r--src/plugins/texteditor/textmark.h7
6 files changed, 15 insertions, 13 deletions
diff --git a/src/plugins/texteditor/indenter.h b/src/plugins/texteditor/indenter.h
index 73ef022051d..ccaae3e2e8f 100644
--- a/src/plugins/texteditor/indenter.h
+++ b/src/plugins/texteditor/indenter.h
@@ -4,11 +4,12 @@
#pragma once
#include <utils/fileutils.h>
-#include <utils/optional.h>
#include <utils/textutils.h>
#include <QMap>
#include <QTextBlock>
+
+#include <optional>
#include <vector>
namespace Utils {
@@ -75,7 +76,7 @@ public:
const TabSettings &tabSettings,
int cursorPositionInEditor = -1)
= 0;
- virtual Utils::optional<TabSettings> tabSettings() const = 0;
+ virtual std::optional<TabSettings> tabSettings() const = 0;
// Indent a text block based on previous line. Default does nothing
virtual void indentBlock(const QTextBlock &block,
@@ -98,7 +99,7 @@ public:
int cursorPositionInEditor = -1)
= 0;
- virtual Utils::optional<int> margin() const { return Utils::nullopt; }
+ virtual std::optional<int> margin() const { return std::nullopt; }
protected:
QTextDocument *m_doc;
diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp
index def49c05edb..064ea1ceead 100644
--- a/src/plugins/texteditor/texteditor.cpp
+++ b/src/plugins/texteditor/texteditor.cpp
@@ -583,7 +583,7 @@ public:
void transformSelectedLines(ListTransformationMethod method);
- void slotUpdateExtraAreaWidth(Utils::optional<int> width = {});
+ void slotUpdateExtraAreaWidth(std::optional<int> width = {});
void slotUpdateRequest(const QRect &r, int dy);
void slotUpdateBlockNotify(const QTextBlock &);
void updateTabStops();
@@ -4840,7 +4840,7 @@ int TextEditorWidget::extraAreaWidth(int *markWidthPtr) const
return space;
}
-void TextEditorWidgetPrivate::slotUpdateExtraAreaWidth(optional<int> width)
+void TextEditorWidgetPrivate::slotUpdateExtraAreaWidth(std::optional<int> width)
{
if (!width.has_value())
width = q->extraAreaWidth();
@@ -5389,7 +5389,7 @@ void TextEditorWidget::mouseMoveEvent(QMouseEvent *e)
}
}
- static Utils::optional<MultiTextCursor> startMouseMoveCursor;
+ static std::optional<MultiTextCursor> startMouseMoveCursor;
if (e->buttons() == Qt::LeftButton && e->modifiers() & Qt::AltModifier) {
if (!startMouseMoveCursor.has_value()) {
startMouseMoveCursor = multiTextCursor();
diff --git a/src/plugins/texteditor/textindenter.cpp b/src/plugins/texteditor/textindenter.cpp
index fbe08bdde9a..0927bec357f 100644
--- a/src/plugins/texteditor/textindenter.cpp
+++ b/src/plugins/texteditor/textindenter.cpp
@@ -122,7 +122,7 @@ void TextIndenter::reindent(const QTextCursor &cursor,
}
}
-Utils::optional<TabSettings> TextIndenter::tabSettings() const
+std::optional<TabSettings> TextIndenter::tabSettings() const
{
- return Utils::optional<TabSettings>();
+ return std::optional<TabSettings>();
}
diff --git a/src/plugins/texteditor/textindenter.h b/src/plugins/texteditor/textindenter.h
index b929794bf0a..66c8eff7b53 100644
--- a/src/plugins/texteditor/textindenter.h
+++ b/src/plugins/texteditor/textindenter.h
@@ -42,7 +42,7 @@ public:
void reindent(const QTextCursor &cursor,
const TabSettings &tabSettings,
int cursorPositionInEditor = -1) override;
- Utils::optional<TabSettings> tabSettings() const override;
+ std::optional<TabSettings> tabSettings() const override;
};
} // namespace TextEditor
diff --git a/src/plugins/texteditor/textmark.cpp b/src/plugins/texteditor/textmark.cpp
index 495c44463de..1ca67b597bd 100644
--- a/src/plugins/texteditor/textmark.cpp
+++ b/src/plugins/texteditor/textmark.cpp
@@ -354,7 +354,7 @@ const QIcon TextMark::icon() const
return m_iconProvider ? m_iconProvider() : m_icon;
}
-Utils::optional<Theme::Color> TextMark::color() const
+std::optional<Theme::Color> TextMark::color() const
{
return m_color;
}
diff --git a/src/plugins/texteditor/textmark.h b/src/plugins/texteditor/textmark.h
index c6bfbc45a85..ed0816224bc 100644
--- a/src/plugins/texteditor/textmark.h
+++ b/src/plugins/texteditor/textmark.h
@@ -7,13 +7,14 @@
#include <utils/fileutils.h>
#include <utils/id.h>
-#include <utils/optional.h>
#include <utils/theme/theme.h>
#include <QCoreApplication>
#include <QIcon>
#include <QVector>
+#include <optional>
+
QT_BEGIN_NAMESPACE
class QAction;
class QGridLayout;
@@ -90,7 +91,7 @@ public:
void setVisible(bool isVisible);
Utils::Id category() const { return m_category; }
- Utils::optional<Utils::Theme::Color> color() const;
+ std::optional<Utils::Theme::Color> color() const;
void setColor(const Utils::Theme::Color &color);
QString defaultToolTip() const { return m_defaultToolTip; }
@@ -122,7 +123,7 @@ private:
Priority m_priority = LowPriority;
QIcon m_icon;
std::function<QIcon()> m_iconProvider;
- Utils::optional<Utils::Theme::Color> m_color;
+ std::optional<Utils::Theme::Color> m_color;
bool m_visible = false;
Utils::Id m_category;
QString m_lineAnnotation;