forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/12.0'
Conflicts: src/plugins/designer/formeditor.cpp src/plugins/git/gitplugin.cpp Change-Id: I554a844fab4c55249a00f394f9ba174c7548dbbe
This commit is contained in:
@@ -316,8 +316,10 @@ int forceIndentWithExtraText(QByteArray &buffer,
|
||||
// A comment at the end of the line appears to prevent clang-format from removing line breaks.
|
||||
if (dummyText == "/*//*/" || dummyText.isEmpty()) {
|
||||
if (block.previous().isValid()) {
|
||||
const int prevEndOffset = Utils::Text::utf8NthLineOffset(block.document(), buffer,
|
||||
block.blockNumber()) + block.previous().text().length();
|
||||
const int prevEndOffset = Utils::Text::utf8NthLineOffset(block.document(),
|
||||
buffer,
|
||||
block.blockNumber())
|
||||
+ block.previous().text().toUtf8().length();
|
||||
buffer.insert(prevEndOffset, " //");
|
||||
extraLength += 3;
|
||||
}
|
||||
|
@@ -730,4 +730,20 @@ void ClangFormatTest::testIndentCommentOnNewLine()
|
||||
}));
|
||||
}
|
||||
|
||||
void ClangFormatTest::testUtf8SymbolLine()
|
||||
{
|
||||
insertLines({"int main()",
|
||||
"{",
|
||||
" cout << \"ä\" << endl;",
|
||||
" return 0;",
|
||||
"}"});
|
||||
m_indenter->indent(*m_cursor, QChar::Null, TextEditor::TabSettings());
|
||||
QCOMPARE(documentLines(),
|
||||
(std::vector<QString>{"int main()",
|
||||
"{",
|
||||
" cout << \"ä\" << endl;",
|
||||
" return 0;",
|
||||
"}"}));
|
||||
}
|
||||
|
||||
} // namespace ClangFormat::Internal
|
||||
|
@@ -91,6 +91,7 @@ private slots:
|
||||
void testIndentInitializeVector();
|
||||
void testIndentFunctionArgumentOnNewLine();
|
||||
void testIndentCommentOnNewLine();
|
||||
void testUtf8SymbolLine();
|
||||
|
||||
private:
|
||||
void insertLines(const std::vector<QString> &lines);
|
||||
|
@@ -230,6 +230,7 @@ CMakeBuildStep::CMakeBuildStep(BuildStepList *bsl, Id id) :
|
||||
stagingDir.setSettingsKey(STAGING_DIR_KEY);
|
||||
stagingDir.setLabelText(Tr::tr("Staging directory:"));
|
||||
stagingDir.setDefaultValue(initialStagingDir(kit()));
|
||||
stagingDir.setExpectedKind(PathChooser::Kind::Directory);
|
||||
|
||||
Kit *kit = buildConfiguration()->kit();
|
||||
if (CMakeBuildConfiguration::isIos(kit)) {
|
||||
|
@@ -314,7 +314,9 @@ static void updateCMakeConfigurationWithLocalData(CMakeConfig &cmakeCache,
|
||||
return var == "CMAKE_PREFIX_PATH" || var == "CMAKE_MODULE_PATH";
|
||||
};
|
||||
|
||||
const FilePath projectDir = ProjectTree::currentBuildSystem()->projectDirectory();
|
||||
const FilePath projectDir = ProjectTree::currentBuildSystem()
|
||||
? ProjectTree::currentBuildSystem()->projectDirectory()
|
||||
: currentDir;
|
||||
auto updateDirVariables = [currentDir, projectDir, cmakeCache](QByteArray &value) {
|
||||
value.replace("${CMAKE_CURRENT_SOURCE_DIR}", currentDir.path().toUtf8());
|
||||
value.replace("${CMAKE_CURRENT_LIST_DIR}", currentDir.path().toUtf8());
|
||||
|
@@ -1653,7 +1653,10 @@ QList<ProjectPart::ConstPtr> CppModelManager::projectPart(const FilePath &fileNa
|
||||
}
|
||||
const FilePath canonicalPath = fileName.canonicalPath();
|
||||
QWriteLocker locker(&d->m_projectLock);
|
||||
auto it = d->m_fileToProjectParts.insert(fileName, d->m_fileToProjectParts.value(canonicalPath));
|
||||
const auto it = d->m_fileToProjectParts.constFind(canonicalPath);
|
||||
if (it == d->m_fileToProjectParts.constEnd())
|
||||
return {};
|
||||
d->m_fileToProjectParts.insert(fileName, it.value());
|
||||
return it.value();
|
||||
}
|
||||
|
||||
|
@@ -35,14 +35,15 @@
|
||||
|
||||
#include <aggregation/aggregate.h>
|
||||
|
||||
#include <QDesignerFormEditorPluginInterface>
|
||||
#include <QDesignerFormEditorInterface>
|
||||
#include <QDesignerComponents>
|
||||
#include <QDesignerFormWindowManagerInterface>
|
||||
#include <QDesignerWidgetBoxInterface>
|
||||
#include <abstractobjectinspector.h>
|
||||
#include <QDesignerPropertyEditorInterface>
|
||||
#include <QDesignerActionEditorInterface>
|
||||
#include <QDesignerComponents>
|
||||
#include <QDesignerFormEditorInterface>
|
||||
#include <QDesignerFormEditorPluginInterface>
|
||||
#include <QDesignerFormWindowManagerInterface>
|
||||
#include <QDesignerFormWindowToolInterface>
|
||||
#include <QDesignerPropertyEditorInterface>
|
||||
#include <QDesignerWidgetBoxInterface>
|
||||
|
||||
#include <QAction>
|
||||
#include <QActionGroup>
|
||||
@@ -131,6 +132,13 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class ToolData
|
||||
{
|
||||
public:
|
||||
int index;
|
||||
QByteArray className;
|
||||
};
|
||||
|
||||
// FormEditorData
|
||||
|
||||
class FormEditorData : public QObject
|
||||
@@ -139,8 +147,8 @@ public:
|
||||
FormEditorData();
|
||||
~FormEditorData();
|
||||
|
||||
void activateEditMode(int id);
|
||||
void toolChanged(int);
|
||||
void activateEditMode(const ToolData &toolData);
|
||||
void toolChanged(QDesignerFormWindowInterface *form, int);
|
||||
void print();
|
||||
void setPreviewMenuEnabled(bool e);
|
||||
void updateShortcut(Command *command);
|
||||
@@ -168,6 +176,7 @@ public:
|
||||
const QString &actionName,
|
||||
Id id,
|
||||
int toolNumber,
|
||||
const QByteArray &toolClassName,
|
||||
const QString &iconName = QString(),
|
||||
const QString &keySequence = QString());
|
||||
Command *addToolAction(QAction *a,
|
||||
@@ -528,30 +537,53 @@ void FormEditorData::setupActions()
|
||||
|
||||
m_actionGroupEditMode = new QActionGroup(this);
|
||||
m_actionGroupEditMode->setExclusive(true);
|
||||
QObject::connect(m_actionGroupEditMode, &QActionGroup::triggered, this,
|
||||
[this](QAction *a) { activateEditMode(a->data().toInt()); });
|
||||
QObject::connect(m_actionGroupEditMode, &QActionGroup::triggered, this, [this](QAction *a) {
|
||||
activateEditMode(a->data().value<ToolData>());
|
||||
});
|
||||
|
||||
medit->addSeparator(m_contexts, Core::Constants::G_EDIT_OTHER);
|
||||
|
||||
m_toolActionIds.push_back("FormEditor.WidgetEditor");
|
||||
createEditModeAction(m_actionGroupEditMode, m_contexts, medit,
|
||||
Tr::tr("Edit Widgets"), m_toolActionIds.back(),
|
||||
EditModeWidgetEditor, "widgettool.png", Tr::tr("F3"));
|
||||
createEditModeAction(m_actionGroupEditMode,
|
||||
m_contexts,
|
||||
medit,
|
||||
Tr::tr("Edit Widgets"),
|
||||
m_toolActionIds.back(),
|
||||
EditModeWidgetEditor,
|
||||
"qdesigner_internal::WidgetEditorTool",
|
||||
"widgettool.png",
|
||||
Tr::tr("F3"));
|
||||
|
||||
m_toolActionIds.push_back("FormEditor.SignalsSlotsEditor");
|
||||
createEditModeAction(m_actionGroupEditMode, m_contexts, medit,
|
||||
Tr::tr("Edit Signals/Slots"), m_toolActionIds.back(),
|
||||
EditModeSignalsSlotEditor, "signalslottool.png", Tr::tr("F4"));
|
||||
createEditModeAction(m_actionGroupEditMode,
|
||||
m_contexts,
|
||||
medit,
|
||||
Tr::tr("Edit Signals/Slots"),
|
||||
m_toolActionIds.back(),
|
||||
EditModeSignalsSlotEditor,
|
||||
"qdesigner_internal::SignalSlotEditorTool",
|
||||
"signalslottool.png",
|
||||
Tr::tr("F4"));
|
||||
|
||||
m_toolActionIds.push_back("FormEditor.BuddyEditor");
|
||||
createEditModeAction(m_actionGroupEditMode, m_contexts, medit,
|
||||
Tr::tr("Edit Buddies"), m_toolActionIds.back(),
|
||||
EditModeBuddyEditor, "buddytool.png");
|
||||
createEditModeAction(m_actionGroupEditMode,
|
||||
m_contexts,
|
||||
medit,
|
||||
Tr::tr("Edit Buddies"),
|
||||
m_toolActionIds.back(),
|
||||
EditModeBuddyEditor,
|
||||
"qdesigner_internal::BuddyEditorTool",
|
||||
"buddytool.png");
|
||||
|
||||
m_toolActionIds.push_back("FormEditor.TabOrderEditor");
|
||||
createEditModeAction(m_actionGroupEditMode, m_contexts, medit,
|
||||
Tr::tr("Edit Tab Order"), m_toolActionIds.back(),
|
||||
EditModeTabOrderEditor, "tabordertool.png");
|
||||
createEditModeAction(m_actionGroupEditMode,
|
||||
m_contexts,
|
||||
medit,
|
||||
Tr::tr("Edit Tab Order"),
|
||||
m_toolActionIds.back(),
|
||||
EditModeTabOrderEditor,
|
||||
"qdesigner_internal::TabOrderEditorTool",
|
||||
"tabordertool.png");
|
||||
|
||||
//tool actions
|
||||
m_toolActionIds.push_back("FormEditor.LayoutHorizontally");
|
||||
@@ -726,6 +758,7 @@ QAction *FormEditorData::createEditModeAction(QActionGroup *ag,
|
||||
const QString &actionName,
|
||||
Id id,
|
||||
int toolNumber,
|
||||
const QByteArray &toolClassName,
|
||||
const QString &iconName,
|
||||
const QString &keySequence)
|
||||
{
|
||||
@@ -739,7 +772,7 @@ QAction *FormEditorData::createEditModeAction(QActionGroup *ag,
|
||||
command->setDefaultKeySequence(QKeySequence(keySequence));
|
||||
bindShortcut(command, rc);
|
||||
medit->addAction(command, Core::Constants::G_EDIT_OTHER);
|
||||
rc->setData(toolNumber);
|
||||
rc->setData(QVariant::fromValue(ToolData{toolNumber, toolClassName}));
|
||||
ag->addAction(rc);
|
||||
return rc;
|
||||
}
|
||||
@@ -767,8 +800,9 @@ IEditor *FormEditorData::createEditor()
|
||||
QDesignerFormWindowInterface *form = m_fwm->createFormWindow(nullptr);
|
||||
QTC_ASSERT(form, return nullptr);
|
||||
form->setPalette(Theme::initialPalette());
|
||||
connect(form, &QDesignerFormWindowInterface::toolChanged,
|
||||
this, &FormEditorData::toolChanged);
|
||||
connect(form, &QDesignerFormWindowInterface::toolChanged, this, [this, form](int index) {
|
||||
toolChanged(form, index);
|
||||
});
|
||||
|
||||
auto widgetHost = new SharedTools::WidgetHost( /* parent */ nullptr, form);
|
||||
FormWindowEditor *formWindowEditor = m_xmlEditorFactory->create(form);
|
||||
@@ -820,28 +854,50 @@ void FormEditorData::updateShortcut(Command *command)
|
||||
a->setShortcut(command->action()->shortcut());
|
||||
}
|
||||
|
||||
void FormEditorData::activateEditMode(int id)
|
||||
static void setTool(QDesignerFormWindowInterface *formWindow, const ToolData &toolData)
|
||||
{
|
||||
if (const int count = m_fwm->formWindowCount())
|
||||
for (int i = 0; i < count; i++)
|
||||
m_fwm->formWindow(i)->setCurrentTool(id);
|
||||
// check for tool action with correct object name,
|
||||
// otherwise fall back to index
|
||||
if (!toolData.className.isEmpty()) {
|
||||
const int toolCount = formWindow->toolCount();
|
||||
for (int tool = 0; tool < toolCount; ++tool) {
|
||||
if (formWindow->tool(tool)->metaObject()->className() == toolData.className) {
|
||||
formWindow->setCurrentTool(tool);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
formWindow->setCurrentTool(toolData.index);
|
||||
}
|
||||
|
||||
void FormEditorData::toolChanged(int t)
|
||||
void FormEditorData::activateEditMode(const ToolData &toolData)
|
||||
{
|
||||
typedef QList<QAction *> ActionList;
|
||||
if (const QAction *currentAction = m_actionGroupEditMode->checkedAction())
|
||||
if (currentAction->data().toInt() == t)
|
||||
return;
|
||||
const ActionList actions = m_actionGroupEditMode->actions();
|
||||
const ActionList::const_iterator cend = actions.constEnd();
|
||||
for (ActionList::const_iterator it = actions.constBegin(); it != cend; ++it)
|
||||
if ( (*it)->data().toInt() == t) {
|
||||
(*it)->setChecked(true);
|
||||
break;
|
||||
if (const int count = m_fwm->formWindowCount()) {
|
||||
for (int i = 0; i < count; i++)
|
||||
setTool(m_fwm->formWindow(i), toolData);
|
||||
}
|
||||
}
|
||||
|
||||
void FormEditorData::toolChanged(QDesignerFormWindowInterface *form, int t)
|
||||
{
|
||||
// check for action with correct object name,
|
||||
// otherwise fall back to index
|
||||
QDesignerFormWindowToolInterface *tool = form->tool(t);
|
||||
const QList<QAction *> actions = m_actionGroupEditMode->actions();
|
||||
QAction *candidateByIndex = nullptr;
|
||||
for (QAction *action : actions) {
|
||||
const auto toolData = action->data().value<ToolData>();
|
||||
if (!toolData.className.isEmpty() && toolData.className == tool->metaObject()->className()) {
|
||||
action->setChecked(true);
|
||||
return;
|
||||
}
|
||||
if (toolData.index == t)
|
||||
candidateByIndex = action;
|
||||
}
|
||||
if (candidateByIndex)
|
||||
candidateByIndex->setChecked(true);
|
||||
}
|
||||
|
||||
void FormEditorData::print()
|
||||
{
|
||||
// Printing code courtesy of designer_actions.cpp
|
||||
@@ -929,3 +985,5 @@ void addPluginPath(const QString &pluginPath)
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Designer
|
||||
|
||||
Q_DECLARE_METATYPE(Designer::Internal::ToolData)
|
||||
|
@@ -519,7 +519,7 @@ void QbsBuildSystem::handleQbsParsingDone(bool success)
|
||||
m_qbsUpdateFutureInterface->reportCanceled();
|
||||
}
|
||||
|
||||
m_qbsProjectParser->deleteLater();
|
||||
m_qbsProjectParser->deleteLaterSafely();
|
||||
m_qbsProjectParser = nullptr;
|
||||
m_qbsUpdateFutureInterface->reportFinished();
|
||||
delete m_qbsUpdateFutureInterface;
|
||||
|
@@ -30,6 +30,9 @@ public:
|
||||
void cancel();
|
||||
Utils::Environment environment() const { return m_environment; }
|
||||
|
||||
// FIXME: Why on earth do we not own the FutureInterface?
|
||||
void deleteLaterSafely() { m_fi = nullptr; deleteLater(); }
|
||||
|
||||
QbsSession *session() const { return m_session; }
|
||||
QJsonObject projectData() const { return m_projectData; }
|
||||
ErrorInfo error() const { return m_error; }
|
||||
|
Submodule src/shared/qbs updated: 36e230e0ba...b1d6a0518a
@@ -45,7 +45,7 @@ def main():
|
||||
# Verify that qmljs.g is in the project even when we don't know where (QTCREATORBUG-17609)
|
||||
selectFromLocator("p qmljs.g", "qmljs.g")
|
||||
# Now check some basic lookups in the search box
|
||||
selectFromLocator(": qlist::qlist", "QList::QList")
|
||||
selectFromLocator(": qlist", "QList")
|
||||
test.compare(wordUnderCursor(waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")), "QList")
|
||||
|
||||
invokeMenuItem("File", "Exit")
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user