aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Komissarov <abbapoh@gmail.com>2021-03-02 14:47:31 +0300
committerIvan Komissarov <ABBAPOH@gmail.com>2021-03-17 09:52:41 +0000
commit1fe7701c07401241e3f0fcd78b0505e3ac6b58cd (patch)
tree4959c94857b1e47fa734373e088c4c218c31866a
parent19203dd986c494c25798e746245242b22f767643 (diff)
Remove QTextCursor API from ChangeSet
It appears that neither Qbs not QtCreator use that API. Also, remove QtGui dependency in corelib and enable project files updates by default. Change-Id: I2eb90d0a7bc74bca4f1007eb63164111f52adb1b Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
-rw-r--r--qbs-resources/modules/qbsbuildconfig/qbsbuildconfig.qbs2
-rw-r--r--src/lib/corelib/CMakeLists.txt2
-rw-r--r--src/lib/corelib/api/changeset.cpp26
-rw-r--r--src/lib/corelib/api/changeset.h4
-rw-r--r--src/lib/corelib/corelib.pro1
-rw-r--r--src/lib/corelib/corelib.qbs1
6 files changed, 4 insertions, 32 deletions
diff --git a/qbs-resources/modules/qbsbuildconfig/qbsbuildconfig.qbs b/qbs-resources/modules/qbsbuildconfig/qbsbuildconfig.qbs
index ffa61ec03..374fdfacc 100644
--- a/qbs-resources/modules/qbsbuildconfig/qbsbuildconfig.qbs
+++ b/qbs-resources/modules/qbsbuildconfig/qbsbuildconfig.qbs
@@ -11,7 +11,7 @@ Module {
property bool enableUbSanitizer: false
property bool enableThreadSanitizer: false
property bool enableUnitTests: false
- property bool enableProjectFileUpdates: false
+ property bool enableProjectFileUpdates: true
property bool enableRPath: true
property bool installApiHeaders: true
property bool enableBundledQt: false
diff --git a/src/lib/corelib/CMakeLists.txt b/src/lib/corelib/CMakeLists.txt
index a687eb0ad..224754a30 100644
--- a/src/lib/corelib/CMakeLists.txt
+++ b/src/lib/corelib/CMakeLists.txt
@@ -422,7 +422,7 @@ add_qbs_library(qbscore
PUBLIC_DEFINES
${QBS_PROJECT_FILE_UPDATES_DEFINES}
DEPENDS
- Qt5::CorePrivate Qt5::Gui Qt5::Network Qt5::Script Qt5::Xml ${EXTERNAL_DEPENDS}
+ Qt5::CorePrivate Qt5::Network Qt5::Script Qt5::Xml ${EXTERNAL_DEPENDS}
PUBLIC_DEPENDS
Qt5::Core
INCLUDES
diff --git a/src/lib/corelib/api/changeset.cpp b/src/lib/corelib/api/changeset.cpp
index 773af328d..b5419fd80 100644
--- a/src/lib/corelib/api/changeset.cpp
+++ b/src/lib/corelib/api/changeset.cpp
@@ -44,12 +44,12 @@
namespace QbsQmlJS {
ChangeSet::ChangeSet()
- : m_string(nullptr), m_cursor(nullptr), m_error(false)
+ : m_string(nullptr), m_error(false)
{
}
ChangeSet::ChangeSet(QList<EditOp> operations)
- : m_string(nullptr), m_cursor(nullptr), m_operationList(std::move(operations)), m_error(false)
+ : m_string(nullptr), m_operationList(std::move(operations)), m_error(false)
{
}
@@ -131,7 +131,6 @@ QList<ChangeSet::EditOp> ChangeSet::operationList() const
void ChangeSet::clear()
{
m_string = nullptr;
- m_cursor = nullptr;
m_operationList.clear();
m_error = false;
}
@@ -274,10 +273,6 @@ void ChangeSet::doReplace(const EditOp &replace_helper, QList<EditOp> *replaceLi
if (m_string) {
m_string->replace(replace_helper.pos1, replace_helper.length1, replace_helper.text);
- } else if (m_cursor) {
- m_cursor->setPosition(replace_helper.pos1);
- m_cursor->setPosition(replace_helper.pos1 + replace_helper.length1, QTextCursor::KeepAnchor);
- m_cursor->insertText(replace_helper.text);
}
}
@@ -348,21 +343,10 @@ void ChangeSet::apply(QString *s)
m_string = nullptr;
}
-void ChangeSet::apply(QTextCursor *textCursor)
-{
- m_cursor = textCursor;
- apply_helper();
- m_cursor = nullptr;
-}
-
QString ChangeSet::textAt(int pos, int length)
{
if (m_string) {
return m_string->mid(pos, length);
- } else if (m_cursor) {
- m_cursor->setPosition(pos);
- m_cursor->setPosition(pos + length, QTextCursor::KeepAnchor);
- return m_cursor->selectedText();
}
return {};
}
@@ -380,17 +364,11 @@ void ChangeSet::apply_helper()
}
// execute replaces
- if (m_cursor)
- m_cursor->beginEditBlock();
-
while (!replaceList.empty()) {
const EditOp cmd(replaceList.front());
replaceList.removeFirst();
doReplace(cmd, &replaceList);
}
-
- if (m_cursor)
- m_cursor->endEditBlock();
}
} // namespace QbsQmlJS
diff --git a/src/lib/corelib/api/changeset.h b/src/lib/corelib/api/changeset.h
index 23248c48e..9182cb8e4 100644
--- a/src/lib/corelib/api/changeset.h
+++ b/src/lib/corelib/api/changeset.h
@@ -43,8 +43,6 @@
#include <QtCore/qstring.h>
#include <QtCore/qlist.h>
-QT_FORWARD_DECLARE_CLASS(QTextCursor)
-
namespace QbsQmlJS {
class ChangeSet
@@ -109,7 +107,6 @@ public:
bool hadErrors();
void apply(QString *s);
- void apply(QTextCursor *textCursor);
private:
// length-based API.
@@ -129,7 +126,6 @@ private:
private:
QString *m_string;
- QTextCursor *m_cursor;
QList<EditOp> m_operationList;
bool m_error;
diff --git a/src/lib/corelib/corelib.pro b/src/lib/corelib/corelib.pro
index 002e36683..799aebda1 100644
--- a/src/lib/corelib/corelib.pro
+++ b/src/lib/corelib/corelib.pro
@@ -15,7 +15,6 @@ isEmpty(QBS_RELATIVE_LIBEXEC_PATH) {
DEFINES += QBS_RELATIVE_LIBEXEC_PATH=\\\"$${QBS_RELATIVE_LIBEXEC_PATH}\\\"
QT += core-private network
-qbs_enable_project_file_updates: QT += gui
INCLUDEPATH += $$PWD
diff --git a/src/lib/corelib/corelib.qbs b/src/lib/corelib/corelib.qbs
index 8645ea0b6..6a5b33f98 100644
--- a/src/lib/corelib/corelib.qbs
+++ b/src/lib/corelib/corelib.qbs
@@ -17,7 +17,6 @@ QbsLibrary {
name: "qbsscriptengine"
condition: qbsbuildconfig.useBundledQtScript || !Qt.script.present
}
- Depends { condition: qbsbuildconfig.enableProjectFileUpdates; name: "Qt.gui" }
name: "qbscore"
property stringList bundledQtScriptIncludes: qbsbuildconfig.useBundledQtScript
|| !Qt.script.present ? qbsscriptengine.includePaths : []