forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/12.0'
Conflicts: src/libs/utils/treemodel.cpp src/libs/utils/treemodel.h Change-Id: I9c5e8ef77905745c201cfc647218c9e747d268d6
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
@@ -1,4 +1,4 @@
|
||||
// Copyright (C) 2023 The Qt Company Ltd.
|
||||
// Copyright (C) 2024 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
|
||||
|
||||
/*!
|
||||
@@ -190,6 +190,16 @@
|
||||
To hide the output, select the \inlineimage icons/rightsidebaricon.png
|
||||
(\uicontrol {Hide/Show Right Sidebar}) button or press \key {Alt+Shift+0}.
|
||||
|
||||
\section1 CLICOLOR_FORCE Environment Variable
|
||||
|
||||
\QC sets the environment variable \c CLICOLOR_FORCE to \e 1 to show
|
||||
ANSI-colored output for CMake. This might affect the process output.
|
||||
|
||||
If the output looks incorrect or different from earlier \QC versions, try
|
||||
setting \c CLICOLOR_FORCE to \e 0 in \uicontrol {Use Build Environment}.
|
||||
|
||||
\image qtcreator-build-configuration-set-clicolor-force.webp {Build Environment with CLICOLOR_FORCE set}
|
||||
|
||||
\section1 CMake Build Steps
|
||||
|
||||
\QC builds CMake projects by running \c {cmake . --build}, which then runs
|
||||
|
||||
@@ -604,7 +604,7 @@ TreeItem::~TreeItem()
|
||||
{
|
||||
QTC_CHECK(m_parent == nullptr);
|
||||
QTC_CHECK(m_model == nullptr);
|
||||
removeChildren(false);
|
||||
removeChildrenSilently();
|
||||
}
|
||||
|
||||
TreeItem *TreeItem::childAt(int pos) const
|
||||
@@ -716,6 +716,13 @@ void TreeItem::removeChildren(bool emitSignals)
|
||||
}
|
||||
}
|
||||
|
||||
void TreeItem::removeChildrenSilently()
|
||||
{
|
||||
if (childCount() == 0)
|
||||
return;
|
||||
clear();
|
||||
}
|
||||
|
||||
void TreeItem::sortChildren(const std::function<bool(const TreeItem *, const TreeItem *)> &cmp)
|
||||
{
|
||||
if (m_model) {
|
||||
@@ -1081,7 +1088,7 @@ void BaseTreeModel::setRootItemInternal(TreeItem *item)
|
||||
QTC_CHECK(m_root->m_model == this);
|
||||
// needs to be done explicitly before setting the model to 0, otherwise it might lead to a
|
||||
// crash inside a view or proxy model, especially if there are selected items
|
||||
m_root->removeChildren(false);
|
||||
m_root->removeChildrenSilently();
|
||||
m_root->m_model = nullptr;
|
||||
delete m_root;
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ public:
|
||||
|
||||
void removeChildAt(int pos);
|
||||
void removeChildren(bool emitSignals = true);
|
||||
void removeChildrenSilently();
|
||||
void sortChildren(const std::function<bool(const TreeItem *, const TreeItem *)> &cmp);
|
||||
void update();
|
||||
void updateAll();
|
||||
|
||||
@@ -20,7 +20,9 @@
|
||||
#include <utils/stringutils.h>
|
||||
#include <utils/utilsicons.h>
|
||||
|
||||
#include <QDesktopServices>
|
||||
#include <QHBoxLayout>
|
||||
#include <QRegularExpression>
|
||||
#include <QScrollBar>
|
||||
#include <QTextBrowser>
|
||||
#include <QTimer>
|
||||
@@ -70,9 +72,22 @@ public:
|
||||
|
||||
// preview
|
||||
m_previewWidget = new QTextBrowser();
|
||||
m_previewWidget->setOpenExternalLinks(true);
|
||||
m_previewWidget->setOpenLinks(false); // we want to open files in QtC, not the browser
|
||||
m_previewWidget->setFrameShape(QFrame::NoFrame);
|
||||
new Utils::MarkdownHighlighter(m_previewWidget->document());
|
||||
connect(m_previewWidget, &QTextBrowser::anchorClicked, this, [this](const QUrl &link) {
|
||||
if (link.hasFragment() && link.path().isEmpty() && link.scheme().isEmpty()) {
|
||||
// local anchor
|
||||
m_previewWidget->scrollToAnchor(link.fragment(QUrl::FullyEncoded));
|
||||
} else if (link.isLocalFile() || link.scheme().isEmpty()) {
|
||||
// absolute path or relative (to the document)
|
||||
// open in Qt Creator
|
||||
EditorManager::openEditor(
|
||||
document()->filePath().parentDir().resolvePath(link.path()));
|
||||
} else {
|
||||
QDesktopServices::openUrl(link);
|
||||
}
|
||||
});
|
||||
|
||||
// editor
|
||||
m_textEditorWidget = new TextEditorWidget;
|
||||
@@ -173,6 +188,26 @@ public:
|
||||
m_previewRestoreScrollPosition.reset();
|
||||
|
||||
m_previewWidget->setMarkdown(m_document->plainText());
|
||||
// Add anchors to headings. This should actually be done by Qt QTBUG-120518
|
||||
for (QTextBlock block = m_previewWidget->document()->begin(); block.isValid();
|
||||
block = block.next()) {
|
||||
QTextBlockFormat fmt = block.blockFormat();
|
||||
if (fmt.hasProperty(QTextFormat::HeadingLevel)) {
|
||||
QTextCharFormat cFormat = block.charFormat();
|
||||
QString anchor;
|
||||
const QString text = block.text();
|
||||
for (const QChar &c : text) {
|
||||
if (c == ' ')
|
||||
anchor.append('-');
|
||||
else if (c == '_' || c == '-' || c.isDigit() || c.isLetter())
|
||||
anchor.append(c.toLower());
|
||||
}
|
||||
cFormat.setAnchor(true);
|
||||
cFormat.setAnchorNames({anchor});
|
||||
QTextCursor cursor(block);
|
||||
cursor.setBlockCharFormat(cFormat);
|
||||
}
|
||||
}
|
||||
|
||||
m_previewWidget->horizontalScrollBar()->setValue(positions.x());
|
||||
m_previewWidget->verticalScrollBar()->setValue(positions.y());
|
||||
|
||||
@@ -8782,7 +8782,7 @@ QAction * TextEditorWidget::insertExtraToolBarWidget(TextEditorWidget::Side side
|
||||
findLeftMostAction);
|
||||
return d->m_toolBar->insertWidget(before, widget);
|
||||
} else {
|
||||
return d->m_toolBar->insertWidget(d->m_fileEncodingLabelAction, widget);
|
||||
return d->m_toolBar->insertWidget(d->m_fileLineEndingAction, widget);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,13 @@ macro(qtc_auto_setup_compiler_standard toolchainFile)
|
||||
endif()
|
||||
endforeach()
|
||||
endforeach()
|
||||
|
||||
foreach(osx_var CMAKE_SYSROOT CMAKE_OSX_SYSROOT CMAKE_OSX_ARCHITECTURES)
|
||||
if (${osx_var})
|
||||
file(APPEND "${toolchainFile}"
|
||||
"set(${osx_var} ${${osx_var}})\n")
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
#
|
||||
@@ -113,11 +120,18 @@ macro(qtc_auto_setup_conan)
|
||||
conan_profile_detect_default()
|
||||
detect_host_profile(\"${CMAKE_BINARY_DIR}/conan-dependencies/conan_host_profile\")
|
||||
|
||||
set(build_types \${CMAKE_BUILD_TYPE})
|
||||
if (CMAKE_CONFIGURATION_TYPES)
|
||||
set(build_types \${CMAKE_CONFIGURATION_TYPES})
|
||||
endif()
|
||||
|
||||
foreach(type \${build_types})
|
||||
conan_install(
|
||||
-pr \"${CMAKE_BINARY_DIR}/conan-dependencies/conan_host_profile\"
|
||||
--build=${QT_CREATOR_CONAN_BUILD_POLICY}
|
||||
-s build_type=${CMAKE_BUILD_TYPE}
|
||||
-s build_type=\${type}
|
||||
-g CMakeDeps)
|
||||
endforeach()
|
||||
|
||||
get_property(CONAN_INSTALL_SUCCESS GLOBAL PROPERTY CONAN_INSTALL_SUCCESS)
|
||||
if (CONAN_INSTALL_SUCCESS)
|
||||
@@ -125,10 +139,13 @@ macro(qtc_auto_setup_conan)
|
||||
file(WRITE \"${CMAKE_BINARY_DIR}/conan-dependencies/conan_paths.cmake\" \"
|
||||
list(PREPEND CMAKE_PREFIX_PATH \\\"\${CONAN_GENERATORS_FOLDER}\\\")
|
||||
list(PREPEND CMAKE_MODULE_PATH \\\"\${CONAN_GENERATORS_FOLDER}\\\")
|
||||
list(PREPEND CMAKE_FIND_ROOT_PATH \\\"\${CONAN_GENERATORS_FOLDER}\\\")
|
||||
list(REMOVE_DUPLICATES CMAKE_PREFIX_PATH)
|
||||
list(REMOVE_DUPLICATES CMAKE_MODULE_PATH)
|
||||
list(REMOVE_DUPLICATES CMAKE_FIND_ROOT_PATH)
|
||||
set(CMAKE_PREFIX_PATH \\\"\\\${CMAKE_PREFIX_PATH}\\\" CACHE STRING \\\"\\\" FORCE)
|
||||
set(CMAKE_MODULE_PATH \\\"\\\${CMAKE_MODULE_PATH}\\\" CACHE STRING \\\"\\\" FORCE)
|
||||
set(CMAKE_FIND_ROOT_PATH \\\"\\\${CMAKE_FIND_ROOT_PATH}\\\" CACHE STRING \\\"\\\" FORCE)
|
||||
\")
|
||||
endif()
|
||||
else()
|
||||
@@ -143,6 +160,10 @@ macro(qtc_auto_setup_conan)
|
||||
endif()
|
||||
")
|
||||
|
||||
if (NOT DEFINED CMAKE_BUILD_TYPE AND NOT DEFINED CMAKE_CONFIGURATION_TYPES)
|
||||
set(CMAKE_CONFIGURATION_TYPES "Debug;Release")
|
||||
endif()
|
||||
|
||||
execute_process(COMMAND ${CMAKE_COMMAND}
|
||||
-S "${CMAKE_BINARY_DIR}/conan-dependencies/"
|
||||
-B "${CMAKE_BINARY_DIR}/conan-dependencies/build"
|
||||
@@ -150,6 +171,7 @@ macro(qtc_auto_setup_conan)
|
||||
-D "CMAKE_TOOLCHAIN_FILE=${CMAKE_BINARY_DIR}/conan-dependencies/toolchain.cmake"
|
||||
-G ${CMAKE_GENERATOR}
|
||||
-D CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
||||
-D "CMAKE_CONFIGURATION_TYPES=${CMAKE_CONFIGURATION_TYPES}"
|
||||
RESULT_VARIABLE result
|
||||
)
|
||||
if (result EQUAL 0)
|
||||
|
||||
Reference in New Issue
Block a user