Merge remote-tracking branch 'origin/11.0'

Change-Id: Ib798dc9922c01b7667388ca03d3a248610f73028
This commit is contained in:
Eike Ziller
2023-06-20 10:36:06 +02:00
118 changed files with 504 additions and 2188 deletions

View File

@@ -33,12 +33,13 @@ function(_extract_ts_data_from_targets outprefix)
# exclude various funny source files, and anything generated
# like *metatypes.json.gen, moc_*.cpp, qrc_*.cpp, */qmlcache/*.cpp,
# *qmltyperegistrations.cpp
string(REGEX REPLACE "(\\^|\\$|\\.|\\[|\\]|\\*|\\+|\\?|\\(|\\)|\\|)" "\\\\\\1" binary_dir_regex "${PROJECT_BINARY_DIR}")
set(_exclude_patterns
.*[.]json[.]in
.*[.]svg
.*[.]pro
.*[.]css
"${PROJECT_BINARY_DIR}/.*"
"${binary_dir_regex}/.*"
)
list(JOIN _exclude_patterns "|" _exclude_pattern)
list(FILTER _source_files EXCLUDE REGEX "${_exclude_pattern}")

View File

@@ -13,6 +13,7 @@ Product {
property string fileName: FileInfo.fileName(sourceDirectory) + ".qbs"
property bool useNonGuiPchFile: false
property bool useGuiPchFile: false
property bool useQt: true
property string pathToSharedSources: FileInfo.joinPaths(path,
FileInfo.relativePath(FileInfo.joinPaths('/', qtc.ide_qbs_imports_path),
FileInfo.joinPaths('/', qtc.ide_shared_sources_path)))
@@ -28,8 +29,12 @@ Product {
enableFallback: false
}
}
Depends { name: "Qt.core"; versionAtLeast: "6.2.0" }
Depends { name: "Qt.core5compat" }
Depends {
name: "Qt"
condition: useQt
submodules: ["core", "core5compat"]
versionAtLeast: "6.2.0"
}
// TODO: Should fall back to what came from Qt.core for Qt < 5.7, but we cannot express that
// atm. Conditionally pulling in a module that sets the property is also not possible,
@@ -75,7 +80,7 @@ Product {
cpp.cxxLanguageVersion: "c++17"
cpp.defines: qtc.generalDefines
cpp.minimumWindowsVersion: "6.1"
cpp.useCxxPrecompiledHeader: useNonGuiPchFile || useGuiPchFile
cpp.useCxxPrecompiledHeader: useQt && (useNonGuiPchFile || useGuiPchFile)
cpp.visibility: "minimal"
Group {

View File

@@ -147,11 +147,12 @@ class Dumper(DumperBase):
code = nativeType.code()
if code == TypeCode.Pointer:
if not nativeType.name().startswith('<function>'):
targetType = self.lookupType(nativeType.targetName(), nativeType.moduleId())
if targetType is not None:
return self.createPointerType(targetType)
if nativeType.name().startswith('<function>'):
code = TypeCode.Function
elif nativeType.targetName() != nativeType.name():
targetType = self.lookupType(nativeType.targetName(), nativeType.moduleId())
if targetType is not None and targetType is not nativeType:
return self.createPointerType(targetType)
if code == TypeCode.Array:
# cdb reports virtual function tables as arrays those ar handled separetly by

View File

@@ -163,7 +163,123 @@ def qdump__std____1__stack(d, value):
d.putBetterType(value.type)
def std_1_string_dumper(d, value):
def GetChildMemberWithName(value: DumperBase.Value, name: str) -> DumperBase.Value:
members: list[DumperBase.Value] = value.members(True)
for member in members:
if member.name == name:
return member
return None
def GetIndexOfChildWithName(value: DumperBase.Value, name: str) -> int:
members: list[DumperBase.Value] = value.members(True)
for i, member in enumerate(members):
if member.name == name:
return i
return None
class StringLayout:
CSD = 0
DSC = 1
def std_1_string_dumper_v2(d, value):
charType = value['__l']['__data_'].dereference().type
R = GetChildMemberWithName(value, "__r_")
if not R:
raise Exception("Could not find __r_")
# __r_ is a compressed_pair of the actual data and the allocator. The data we
# want is in the first base class.
R_Base_SP = R[0]
if not R_Base_SP:
raise Exception("Could not find R_Base_SP")
Rep_Sp = GetChildMemberWithName(R_Base_SP, "__value_")
if not Rep_Sp:
raise Exception("Could not find __value_")
# Our layout seems a little different
Rep_Sp = Rep_Sp[0]
if not Rep_Sp:
raise Exception("Could not find Rep_Sp")
L = GetChildMemberWithName(Rep_Sp, "__l")
if not L:
raise Exception("Could not find __l")
layout = StringLayout.CSD
if GetIndexOfChildWithName(L, "__data_") == 0:
layout = StringLayout.DSC
short_mode = False
using_bitmasks = True
size = 0
size_mode_value = 0
Short_Sp = GetChildMemberWithName(Rep_Sp, "__s")
if not Short_Sp:
raise Exception("Could not find __s")
Is_Long: DumperBase.Value = GetChildMemberWithName(Short_Sp, "__is_long_")
Size_Sp: DumperBase.Value = GetChildMemberWithName(Short_Sp, "__size_")
if not Size_Sp:
raise Exception("Could not find __size_")
if Is_Long:
using_bitmasks = False
short_mode = Is_Long.integer() == 0
size = Size_Sp.integer()
else:
size_mode_value = Size_Sp.integer()
mode_mask = 1
if layout == StringLayout.DSC:
mode_mask = 0x80
short_mode = (size_mode_value & mode_mask) == 0
if short_mode:
Location_Sp = GetChildMemberWithName(Short_Sp, "__data_")
if using_bitmasks:
size = ((size_mode_value >> 1) % 256)
if layout == StringLayout.DSC:
size = size_mode_value
# The string is most likely not initialized yet
if size > 100 or not Location_Sp:
raise Exception("Probably not initialized yet")
d.putCharArrayHelper(d.extractPointer(Location_Sp), size,
charType, d.currentItemFormat())
return
Location_Sp = GetChildMemberWithName(L, "__data_")
Size_Vo = GetChildMemberWithName(L, "__size_")
Capacity_Vo = GetChildMemberWithName(L, "__cap_")
if not Location_Sp or not Size_Vo or not Capacity_Vo:
raise Exception("Could not find Location_Sp, Size_Vo or Capacity_Vo")
size = Size_Vo.integer()
capacity = Capacity_Vo.integer()
if not using_bitmasks and layout == StringLayout.CSD:
capacity *= 2
if capacity < size:
raise Exception("Capacity is less than size")
d.putCharArrayHelper(d.extractPointer(Location_Sp), size,
charType, d.currentItemFormat())
def std_1_string_dumper_v1(d, value):
charType = value['__l']['__data_'].dereference().type
D = None
@@ -245,13 +361,24 @@ def std_1_string_dumper(d, value):
return
def qdump__std____1__string(d, value):
std_1_string_dumper(d, value)
try:
std_1_string_dumper_v2(d, value)
except Exception as eV2:
try:
std_1_string_dumper_v1(d, value)
except Exception as eV1:
d.putValue("Could not parse: %s, %s" % (eV1, eV2))
def qdump__std____1__wstring(d, value):
std_1_string_dumper(d, value)
try:
std_1_string_dumper_v2(d, value)
except Exception as eV2:
try:
std_1_string_dumper_v1(d, value)
except Exception as eV1:
d.putValue("Could not parse: %s, %s" % (eV1, eV2))
def qdump__std____1__basic_string(d, value):

View File

@@ -56,8 +56,7 @@ Project {
Depends { name: "winpty_genversion_header" }
Depends { name: "cpp" }
useNonGuiPchFile: false
useGuiPchFile: false
useQt: false
cpp.includePaths: base.concat([sourceDirectory + "/include", buildDirectory])
cpp.defines: base.concat(["WINPTY_AGENT_ASSERT",

View File

@@ -839,7 +839,7 @@ expected_str<void> DockManager::reloadActiveWorkspace()
if (!workspaces().contains(*wrk))
return make_unexpected(
Tr::tr("Cannot reload \"%1\", it is not contained in the list of workspaces")
Tr::tr("Cannot reload \"%1\". It is not in the list of workspaces.")
.arg(wrk->filePath().toUserOutput()));
const expected_str<QByteArray> data = loadWorkspace(*wrk);
@@ -903,7 +903,7 @@ expected_str<QString> DockManager::cloneWorkspace(const QString &originalFileNam
const expected_str<void> copyResult = originalPath.copyFile(clonePath);
if (!copyResult)
return make_unexpected(Tr::tr("Could not clone '%1' due to: %2")
return make_unexpected(Tr::tr("Could not clone \"%1\" due to: %2")
.arg(originalPath.toUserOutput(), copyResult.error()));
writeDisplayName(clonePath, cloneName);
@@ -1023,7 +1023,7 @@ expected_str<QString> DockManager::exportWorkspace(const QString &targetFilePath
const FilePath workspaceFile = userDirectory().pathAppended(sourceFileName);
if (!workspaceFile.exists())
return make_unexpected(
Tr::tr("Workspace does not exist '%1'").arg(workspaceFile.toUserOutput()));
Tr::tr("Workspace does not exist \"%1\"").arg(workspaceFile.toUserOutput()));
// Finally copy the workspace to the target
const expected_str<void> copyResult = workspaceFile.copyFile(targetFile);

View File

@@ -514,6 +514,9 @@ QString ProcessArgs::quoteArgUnix(const QString &arg)
QString ret(arg);
if (hasSpecialCharsUnix(ret)) {
if (arg == "&&" || arg == "||" || arg == "&" || arg == ';')
return ret;
ret.replace(QLatin1Char('\''), QLatin1String("'\\''"));
ret.prepend(QLatin1Char('\''));
ret.append(QLatin1Char('\''));
@@ -550,6 +553,9 @@ static QString quoteArgWin(const QString &arg)
QString ret(arg);
if (hasSpecialCharsWin(ret)) {
if (arg == "&&" || arg == "||" || arg == "&" || arg == ';')
return ret;
// Quotes are escaped and their preceding backslashes are doubled.
// It's impossible to escape anything inside a quoted string on cmd
// level, so the outer quoting must be "suspended".

View File

@@ -346,9 +346,9 @@ void Slice::flush()
formLayout->addRow(f0.widget, f1.widget);
} else {
if (f1.layout)
formLayout->addRow(f0.text, f1.layout);
formLayout->addRow(createLabel(f0.text), f1.layout);
else if (f1.widget)
formLayout->addRow(f0.text, f1.widget);
formLayout->addRow(createLabel(f0.text), f1.widget);
}
} else {
QTC_CHECK(false);
@@ -962,6 +962,9 @@ void createItem(LayoutItem *item, const std::function<void(QObject *target)> &t)
void createItem(LayoutItem *item, QWidget *t)
{
if (auto l = qobject_cast<QLabel *>(t))
l->setTextInteractionFlags(l->textInteractionFlags() | Qt::TextSelectableByMouse);
item->onAdd = [t](LayoutBuilder &builder) { doAddWidget(builder, t); };
}

View File

@@ -4,7 +4,7 @@ QtcTool {
name: "qtcreator_ctrlc_stub"
consoleApplication: true
condition: qbs.targetOS.contains("windows")
useQt: false
files: [ "process_ctrlc_stub.cpp" ]

View File

@@ -195,7 +195,7 @@ void AutotestPluginPrivate::initializeMenuEntries()
QAction *action = new QAction(Tr::tr("Run &All Tests"), this);
action->setIcon(Utils::Icons::RUN_SMALL.icon());
action->setToolTip(Tr::tr("Run all tests"));
action->setToolTip(Tr::tr("Run All Tests"));
Command *command = ActionManager::registerAction(action, Constants::ACTION_RUN_ALL_ID);
command->setDefaultKeySequence(
QKeySequence(useMacShortcuts ? Tr::tr("Ctrl+Meta+T, Ctrl+Meta+A") : Tr::tr("Alt+Shift+T,Alt+A")));
@@ -206,7 +206,7 @@ void AutotestPluginPrivate::initializeMenuEntries()
action = new QAction(Tr::tr("Run All Tests Without Deployment"), this);
action->setIcon(Utils::Icons::RUN_SMALL.icon());
action->setToolTip(Tr::tr("Run all tests without deployment"));
action->setToolTip(Tr::tr("Run All Tests Without Deployment"));
command = ActionManager::registerAction(action, Constants::ACTION_RUN_ALL_NODEPLOY_ID);
command->setDefaultKeySequence(
QKeySequence(useMacShortcuts ? Tr::tr("Ctrl+Meta+T, Ctrl+Meta+E") : Tr::tr("Alt+Shift+T,Alt+E")));
@@ -217,7 +217,7 @@ void AutotestPluginPrivate::initializeMenuEntries()
action = new QAction(Tr::tr("&Run Selected Tests"), this);
action->setIcon(Utils::Icons::RUN_SELECTED.icon());
action->setToolTip(Tr::tr("Run selected tests"));
action->setToolTip(Tr::tr("Run Selected Tests"));
command = ActionManager::registerAction(action, Constants::ACTION_RUN_SELECTED_ID);
command->setDefaultKeySequence(
QKeySequence(useMacShortcuts ? Tr::tr("Ctrl+Meta+T, Ctrl+Meta+R") : Tr::tr("Alt+Shift+T,Alt+R")));
@@ -228,7 +228,7 @@ void AutotestPluginPrivate::initializeMenuEntries()
action = new QAction(Tr::tr("&Run Selected Tests Without Deployment"), this);
action->setIcon(Utils::Icons::RUN_SELECTED.icon());
action->setToolTip(Tr::tr("Run selected tests"));
action->setToolTip(Tr::tr("Run Selected Tests Without Deployment"));
command = ActionManager::registerAction(action, Constants::ACTION_RUN_SELECTED_NODEPLOY_ID);
command->setDefaultKeySequence(
QKeySequence(useMacShortcuts ? Tr::tr("Ctrl+Meta+T, Ctrl+Meta+W") : Tr::tr("Alt+Shift+T,Alt+W")));
@@ -239,7 +239,7 @@ void AutotestPluginPrivate::initializeMenuEntries()
action = new QAction(Tr::tr("Run &Failed Tests"), this);
action->setIcon(Icons::RUN_FAILED.icon());
action->setToolTip(Tr::tr("Run failed tests"));
action->setToolTip(Tr::tr("Run Failed Tests"));
command = ActionManager::registerAction(action, Constants::ACTION_RUN_FAILED_ID);
command->setDefaultKeySequence(
useMacShortcuts ? Tr::tr("Ctrl+Meta+T, Ctrl+Meta+F") : Tr::tr("Alt+Shift+T,Alt+F"));
@@ -249,7 +249,7 @@ void AutotestPluginPrivate::initializeMenuEntries()
action = new QAction(Tr::tr("Run Tests for &Current File"), this);
action->setIcon(Utils::Icons::RUN_FILE.icon());
action->setToolTip(Tr::tr("Run tests for current file"));
action->setToolTip(Tr::tr("Run Tests for Current File"));
command = ActionManager::registerAction(action, Constants::ACTION_RUN_FILE_ID);
command->setDefaultKeySequence(
QKeySequence(useMacShortcuts ? Tr::tr("Ctrl+Meta+T, Ctrl+Meta+C") : Tr::tr("Alt+Shift+T,Alt+C")));

View File

@@ -240,17 +240,17 @@ void CatchOutputReader::sendResult(const ResultType result)
catchResult.setResult(result);
if (result == ResultType::TestStart && m_testCaseInfo.size() > 0) {
catchResult.setDescription(Tr::tr("Executing %1 \"%2\"")
catchResult.setDescription(Tr::tr("Executing %1 \"%2\"...")
.arg(testOutputNodeToString().toLower(), catchResult.description()));
} else if (result == ResultType::Pass || result == ResultType::UnexpectedPass) {
if (result == ResultType::UnexpectedPass)
++m_xpassCount;
if (m_currentExpression.isEmpty()) {
catchResult.setDescription(Tr::tr("%1 \"%2\" passed")
catchResult.setDescription(Tr::tr("%1 \"%2\" passed.")
.arg(testOutputNodeToString(), catchResult.description()));
} else {
catchResult.setDescription(Tr::tr("Expression passed")
catchResult.setDescription(Tr::tr("Expression passed.")
.append('\n').append(m_currentExpression));
}
m_reportedSectionResult = true;
@@ -262,7 +262,7 @@ void CatchOutputReader::sendResult(const ResultType result)
m_reportedSectionResult = true;
m_reportedResult = true;
} else if (result == ResultType::TestEnd) {
catchResult.setDescription(Tr::tr("Finished executing %1 \"%2\"")
catchResult.setDescription(Tr::tr("Finished executing %1 \"%2\".")
.arg(testOutputNodeToString().toLower(), catchResult.description()));
} else if (result == ResultType::Benchmark || result == ResultType::MessageFatal) {
catchResult.setDescription(m_currentExpression);

View File

@@ -40,7 +40,7 @@ DashboardWidget::DashboardWidget(QWidget *parent)
m_project = new QLabel(this);
projectLayout->addRow(Tr::tr("Project:"), m_project);
m_loc = new QLabel(this);
projectLayout->addRow(Tr::tr("Lines of Code:"), m_loc);
projectLayout->addRow(Tr::tr("Lines of code:"), m_loc);
layout->addLayout(projectLayout);
m_formLayout = new QFormLayout;
layout->addLayout(m_formLayout);

View File

@@ -326,8 +326,10 @@ void doSemanticHighlighting(
styles.mainStyle = C_PARAMETER;
} else if (token.type == "macro") {
styles.mainStyle = C_MACRO;
} else if (token.type == "type" || token.type == "concept") {
} else if (token.type == "type") {
styles.mainStyle = C_TYPE;
} else if (token.type == "concept") {
styles.mainStyle = C_CONCEPT;
} else if (token.type == "modifier") {
styles.mainStyle = C_KEYWORD;
} else if (token.type == "label") {

View File

@@ -1302,8 +1302,8 @@ void ClangdTestHighlighting::test_data()
QTest::newRow("fake operator method call") << 1050 << 8 << 1050 << 22
<< QList<int>{C_FUNCTION} << 0;
QTest::newRow("concept definition") << 1053 << 30 << 1053 << 42
<< QList<int>{C_TYPE, C_DECLARATION} << 0;
QTest::newRow("concept use") << 1054 << 29 << 1054 << 41 << QList<int>{C_TYPE} << 0;
<< QList<int>{C_CONCEPT, C_DECLARATION} << 0;
QTest::newRow("concept use") << 1054 << 29 << 1054 << 41 << QList<int>{C_CONCEPT} << 0;
QTest::newRow("label declaration") << 242 << 1 << 242 << 11
<< QList<int>{C_LABEL, C_DECLARATION} << 0;
QTest::newRow("label use") << 244 << 10 << 244 << 20 << QList<int>{C_LABEL} << 0;

View File

@@ -677,16 +677,6 @@ void ClangTool::startTool(ClangTool::FileSelection fileSelection,
ProjectExplorerPlugin::startRunControl(m_runControl);
}
Diagnostics ClangTool::read(const FilePath &logFilePath,
const QSet<FilePath> &projectFiles,
QString *errorMessage) const
{
const auto acceptFromFilePath = [projectFiles](const FilePath &filePath) {
return projectFiles.contains(filePath);
};
return readExportedDiagnostics(logFilePath, acceptFromFilePath, errorMessage);
}
FileInfos ClangTool::collectFileInfos(Project *project, FileSelection fileSelection)
{
FileSelectionType *selectionType = std::get_if<FileSelectionType>(&fileSelection);
@@ -763,21 +753,17 @@ void ClangTool::loadDiagnosticsFromFiles()
// Load files
Diagnostics diagnostics;
QString errors;
QStringList errors;
for (const FilePath &filePath : filePaths) {
QString currentError;
diagnostics << readExportedDiagnostics(filePath, {}, &currentError);
if (!currentError.isEmpty()) {
if (!errors.isEmpty())
errors.append("\n");
errors.append(currentError);
}
if (expected_str<Diagnostics> expectedDiagnostics = readExportedDiagnostics(filePath))
diagnostics << *expectedDiagnostics;
else
errors.append(expectedDiagnostics.error());
}
// Show errors
if (!errors.isEmpty()) {
AsynchronousMessageBox::critical(Tr::tr("Error Loading Diagnostics"), errors);
AsynchronousMessageBox::critical(Tr::tr("Error Loading Diagnostics"), errors.join('\n'));
return;
}

View File

@@ -65,10 +65,6 @@ public:
const RunSettings &runSettings,
const CppEditor::ClangDiagnosticConfig &diagnosticConfig);
Diagnostics read(const Utils::FilePath &logFilePath,
const QSet<Utils::FilePath> &projectFiles,
QString *errorMessage) const;
FileInfos collectFileInfos(ProjectExplorer::Project *project,
FileSelection fileSelection);

View File

@@ -242,18 +242,8 @@ void ClangToolRunWorker::onDone(const AnalyzeOutputData &output)
qCDebug(LOG) << "onRunnerFinishedWithSuccess:" << output.outputFilePath;
QString errorMessage;
const Diagnostics diagnostics = m_tool->read(output.outputFilePath, m_projectFiles,
&errorMessage);
const Diagnostics diagnostics = output.diagnostics;
if (!errorMessage.isEmpty()) {
m_filesAnalyzed.remove(output.fileToAnalyze);
m_filesNotAnalyzed.insert(output.fileToAnalyze);
qCDebug(LOG) << "onRunnerFinishedWithSuccess: Error reading log file:" << errorMessage;
appendMessage(Tr::tr("Failed to analyze \"%1\": %2")
.arg(output.fileToAnalyze.toUserOutput(), errorMessage),
Utils::StdErrFormat);
} else {
if (!m_filesNotAnalyzed.contains(output.fileToAnalyze))
m_filesAnalyzed.insert(output.fileToAnalyze);
if (!diagnostics.isEmpty()) {
@@ -263,7 +253,6 @@ void ClangToolRunWorker::onDone(const AnalyzeOutputData &output)
m_tool->onNewDiagnosticsAvailable(diagnostics, generateMarks);
}
}
}
void ClangToolRunWorker::finalize()
{

View File

@@ -3,6 +3,7 @@
#include "clangtoolrunner.h"
#include "clangtoolslogfilereader.h"
#include "clangtoolstr.h"
#include "clangtoolsutils.h"
@@ -11,6 +12,9 @@
#include <cppeditor/clangdiagnosticconfigsmodel.h>
#include <cppeditor/cpptoolsreuse.h>
#include <extensionsystem/pluginmanager.h>
#include <utils/async.h>
#include <utils/process.h>
#include <utils/qtcassert.h>
#include <utils/temporaryfile.h>
@@ -20,6 +24,7 @@
#include <QFileInfo>
#include <QLoggingCategory>
static Q_LOGGING_CATEGORY(LOG, "qtc.clangtools.runner", QtWarningMsg)
using namespace CppEditor;
@@ -160,9 +165,6 @@ GroupItem clangToolTask(const AnalyzeInputData &input,
};
const auto onProcessDone = [=](const Process &process) {
qCDebug(LOG).noquote() << "Output:\n" << process.cleanedStdOut();
if (!outputHandler)
return;
outputHandler({true, input.unit.file, storage->outputFilePath, input.tool});
};
const auto onProcessError = [=](const Process &process) {
if (!outputHandler)
@@ -179,15 +181,50 @@ GroupItem clangToolTask(const AnalyzeInputData &input,
message = Tr::tr("%1 finished with exit code: %2.").arg(data.name).arg(process.exitCode());
else
message = Tr::tr("%1 crashed.").arg(data.name);
outputHandler({false, input.unit.file, data.outputFilePath, input.tool, message, details});
outputHandler(
{false, input.unit.file, data.outputFilePath, {}, input.tool, message, details});
};
const auto onReadSetup = [=](Async<expected_str<Diagnostics>> &data) {
data.setConcurrentCallData(&parseDiagnostics,
storage->outputFilePath,
input.diagnosticsFilter);
data.setFutureSynchronizer(ExtensionSystem::PluginManager::futureSynchronizer());
};
const auto onReadDone = [=](const Async<expected_str<Diagnostics>> &data) {
if (!outputHandler)
return;
const expected_str<Diagnostics> result = data.result();
const bool success = result.has_value();
Diagnostics diagnostics;
QString error;
if (success)
diagnostics = *result;
else
error = result.error();
outputHandler({success,
input.unit.file,
storage->outputFilePath,
diagnostics,
input.tool,
error});
};
const auto onReadError = [=](const Async<expected_str<Diagnostics>> &data) {
if (!outputHandler)
return;
const expected_str<Diagnostics> result = data.result();
outputHandler(
{false, input.unit.file, storage->outputFilePath, {}, input.tool, result.error()});
};
const Group group {
Storage(storage),
onGroupSetup(onSetup),
Group {
sequential,
finishAllAndDone,
ProcessTask(onProcessSetup, onProcessDone, onProcessError)
ProcessTask(onProcessSetup, onProcessDone, onProcessError),
AsyncTask<expected_str<Diagnostics>>(onReadSetup, onReadDone, onReadError)
}
};
return group;

View File

@@ -4,6 +4,8 @@
#pragma once
#include "clangfileinfo.h"
#include "clangtoolsdiagnostic.h"
#include "clangtoolslogfilereader.h"
#include "clangtoolssettings.h"
#include <cppeditor/clangdiagnosticconfig.h>
@@ -35,6 +37,7 @@ struct AnalyzeInputData
Utils::Environment environment;
AnalyzeUnit unit;
QString overlayFilePath = {};
AcceptDiagsFromFilePath diagnosticsFilter = {};
};
struct AnalyzeOutputData
@@ -42,6 +45,7 @@ struct AnalyzeOutputData
bool success = true;
Utils::FilePath fileToAnalyze;
Utils::FilePath outputFilePath;
Diagnostics diagnostics;
CppEditor::ClangToolType toolType;
QString errorMessage = {};
QString errorDetails = {};

View File

@@ -11,26 +11,13 @@
#include <utils/fileutils.h>
#include <utils/textutils.h>
#include <QFuture>
#include <yaml-cpp/yaml.h>
namespace ClangTools {
namespace Internal {
static bool checkFilePath(const Utils::FilePath &filePath, QString *errorMessage)
{
QFileInfo fi(filePath.toFileInfo());
if (!fi.exists() || !fi.isReadable()) {
if (errorMessage) {
*errorMessage
= QString(QT_TRANSLATE_NOOP("QtC::ClangTools",
"File \"%1\" does not exist or is not readable."))
.arg(filePath.toUserOutput());
}
return false;
}
return true;
}
std::optional<LineColumnInfo> byteOffsetInUtf8TextToLineColumn(const char *text,
int offset,
int startLine)
@@ -190,19 +177,25 @@ private:
} // namespace
Diagnostics readExportedDiagnostics(const Utils::FilePath &logFilePath,
const AcceptDiagsFromFilePath &acceptFromFilePath,
QString *errorMessage)
void parseDiagnostics(QPromise<Utils::expected_str<Diagnostics>> &promise,
const Utils::FilePath &logFilePath,
const AcceptDiagsFromFilePath &acceptFromFilePath)
{
if (!checkFilePath(logFilePath, errorMessage))
return {};
const Utils::expected_str<QByteArray> localFileContents = logFilePath.fileContents();
if (!localFileContents.has_value()) {
promise.addResult(Utils::make_unexpected(localFileContents.error()));
promise.future().cancel();
return;
}
FileCache fileCache;
Diagnostics diagnostics;
try {
YAML::Node document = YAML::LoadFile(logFilePath.toString().toStdString());
YAML::Node document = YAML::Load(*localFileContents);
for (const auto &diagNode : document["Diagnostics"]) {
if (promise.isCanceled())
return;
// Since llvm/clang 9.0 the diagnostic items are wrapped in a "DiagnosticMessage" node.
const auto msgNode = diagNode["DiagnosticMessage"];
const YAML::Node &node = msgNode ? msgNode : diagNode;
@@ -252,16 +245,24 @@ Diagnostics readExportedDiagnostics(const Utils::FilePath &logFilePath,
diagnostics.append(diag);
}
promise.addResult(diagnostics);
} catch (std::exception &e) {
if (errorMessage) {
*errorMessage = QString(
QT_TRANSLATE_NOOP("QtC::ClangTools",
const QString errorMessage
= QString(QT_TRANSLATE_NOOP("QtC::ClangTools",
"Error: Failed to parse YAML file \"%1\": %2."))
.arg(logFilePath.toUserOutput(), QString::fromUtf8(e.what()));
promise.addResult(Utils::make_unexpected(errorMessage));
promise.future().cancel();
}
}
return diagnostics;
Utils::expected_str<Diagnostics> readExportedDiagnostics(
const Utils::FilePath &logFilePath, const AcceptDiagsFromFilePath &acceptFromFilePath)
{
QPromise<Utils::expected_str<Diagnostics>> promise;
promise.start();
parseDiagnostics(promise, logFilePath, acceptFromFilePath);
return promise.future().result();
}
} // namespace Internal

View File

@@ -6,6 +6,7 @@
#include "clangtoolsdiagnostic.h"
#include <QPromise>
#include <optional>
namespace Utils { class FilePath; }
@@ -16,9 +17,13 @@ namespace Internal {
using AcceptDiagsFromFilePath = std::function<bool(const Utils::FilePath &)>;
// Reads diagnostics generated by "clang-tidy/clazy-standalone -export-fixes=path/to/file"
Diagnostics readExportedDiagnostics(const Utils::FilePath &logFilePath,
const AcceptDiagsFromFilePath &acceptFromFilePath,
QString *errorMessage = nullptr);
void parseDiagnostics(QPromise<Utils::expected_str<Diagnostics>> &promise,
const Utils::FilePath &logFilePath,
const AcceptDiagsFromFilePath &acceptFromFilePath = {});
Utils::expected_str<Diagnostics> readExportedDiagnostics(
const Utils::FilePath &logFilePath,
const AcceptDiagsFromFilePath &acceptFromFilePath = {});
// Exposed for tests
struct LineColumnInfo {

View File

@@ -8,16 +8,19 @@
#include "clangtoolsutils.h"
#include "diagnosticconfigswidget.h"
#include <texteditor/textdocument.h>
#include <utils/utilsicons.h>
#include <utils/stringutils.h>
#include <QAction>
using namespace TextEditor;
namespace ClangTools {
namespace Internal {
DiagnosticMark::DiagnosticMark(const Diagnostic &diagnostic)
: TextEditor::TextMark(diagnostic.location.filePath,
DiagnosticMark::DiagnosticMark(const Diagnostic &diagnostic, TextDocument *document)
: TextMark(document,
diagnostic.location.line,
{Tr::tr("Clang Tools"), Utils::Id(Constants::DIAGNOSTIC_MARK_ID)})
, m_diagnostic(diagnostic)
@@ -57,6 +60,10 @@ DiagnosticMark::DiagnosticMark(const Diagnostic &diagnostic)
});
}
DiagnosticMark::DiagnosticMark(const Diagnostic &diagnostic)
: DiagnosticMark(diagnostic, TextDocument::textDocumentForFilePath(diagnostic.location.filePath))
{}
void DiagnosticMark::disable()
{
if (!m_enabled)

View File

@@ -14,6 +14,7 @@ namespace Internal {
class DiagnosticMark : public TextEditor::TextMark
{
public:
DiagnosticMark(const Diagnostic &diagnostic, TextEditor::TextDocument *document);
explicit DiagnosticMark(const Diagnostic &diagnostic);
void disable();

View File

@@ -201,8 +201,16 @@ void DocumentClangToolRunner::run()
if (includeDir.isEmpty() || clangVersion.isEmpty())
return;
const AnalyzeUnit unit(m_fileInfo, includeDir, clangVersion);
const AnalyzeInputData input{tool, runSettings, config, m_temporaryDir.path(), env, unit,
vfso().overlayFilePath().toString()};
auto diagnosticFilter = [mappedPath = vfso().autoSavedFilePath(m_document)](
const FilePath &path) { return path == mappedPath; };
const AnalyzeInputData input{tool,
runSettings,
config,
m_temporaryDir.path(),
env,
unit,
vfso().overlayFilePath().toString(),
diagnosticFilter};
const auto setupHandler = [this, executable] {
return !m_document->isModified() || isVFSOverlaySupported(executable);
};
@@ -234,11 +242,7 @@ void DocumentClangToolRunner::onDone(const AnalyzeOutputData &output)
return;
}
const FilePath mappedPath = vfso().autoSavedFilePath(m_document);
Diagnostics diagnostics = readExportedDiagnostics(
output.outputFilePath,
[&](const FilePath &path) { return path == mappedPath; });
Diagnostics diagnostics = output.diagnostics;
for (Diagnostic &diag : diagnostics) {
updateLocation(diag.location);
for (ExplainingStep &explainingStep : diag.explainingSteps) {
@@ -264,7 +268,7 @@ void DocumentClangToolRunner::onDone(const AnalyzeOutputData &output)
if (isSuppressed(diagnostic))
continue;
auto mark = new DiagnosticMark(diagnostic);
auto mark = new DiagnosticMark(diagnostic, doc);
mark->toolType = toolType;
if (doc && Utils::anyOf(diagnostic.explainingSteps, &ExplainingStep::isFixIt)) {

View File

@@ -31,41 +31,40 @@ ReadExportedDiagnosticsTest::ReadExportedDiagnosticsTest()
ReadExportedDiagnosticsTest::~ReadExportedDiagnosticsTest() { delete m_baseDir; }
void ReadExportedDiagnosticsTest::initTestCase() { QVERIFY(m_baseDir->isValid()); }
void ReadExportedDiagnosticsTest::init() { m_message.clear(); }
void ReadExportedDiagnosticsTest::init() { }
void ReadExportedDiagnosticsTest::testNonExistingFile()
{
const Diagnostics diags = readExportedDiagnostics("nonExistingFile.yaml", {}, &m_message);
QVERIFY(diags.isEmpty());
QVERIFY(!m_message.isEmpty());
const expected_str<Diagnostics> diags = readExportedDiagnostics("nonExistingFile.yaml");
QVERIFY(!diags.has_value());
QVERIFY(!diags.error().isEmpty());
}
void ReadExportedDiagnosticsTest::testEmptyFile()
{
const Diagnostics diags = readExportedDiagnostics(filePath("empty.yaml"), {}, &m_message);
QVERIFY(diags.isEmpty());
QVERIFY2(m_message.isEmpty(), qPrintable(m_message));
const expected_str<Diagnostics> diags = readExportedDiagnostics(filePath("empty.yaml"));
QVERIFY(diags.has_value());
QVERIFY(diags->isEmpty());
}
void ReadExportedDiagnosticsTest::testUnexpectedFileContents()
{
const Diagnostics diags = readExportedDiagnostics(filePath("tidy.modernize-use-nullptr.cpp"),
{}, &m_message);
QVERIFY(!m_message.isEmpty());
QVERIFY(diags.isEmpty());
const expected_str<Diagnostics> diags = readExportedDiagnostics(
filePath("tidy.modernize-use-nullptr.cpp"));
QVERIFY(!diags.has_value());
QVERIFY(!diags.error().isEmpty());
}
static QString appendYamlSuffix(const char *filePathFragment)
{
const QString yamlSuffix = QLatin1String(Utils::HostOsInfo::isWindowsHost()
? "_win.yaml" : ".yaml");
const QString yamlSuffix = QLatin1String(HostOsInfo::isWindowsHost() ? "_win.yaml" : ".yaml");
return filePathFragment + yamlSuffix;
}
void ReadExportedDiagnosticsTest::testTidy()
{
const FilePath sourceFile = filePath("tidy.modernize-use-nullptr.cpp");
const QString exportedFile = createFile(
const FilePath exportedFile = createFile(
filePath(appendYamlSuffix("tidy.modernize-use-nullptr")).toString(),
sourceFile.toString());
Diagnostic expectedDiag;
@@ -79,31 +78,30 @@ void ReadExportedDiagnosticsTest::testTidy()
expectedDiag.location,
{expectedDiag.location, {sourceFile, 2, 26}},
true}};
const Diagnostics diags = readExportedDiagnostics(Utils::FilePath::fromString(exportedFile),
{}, &m_message);
const expected_str<Diagnostics> diags = readExportedDiagnostics(exportedFile);
QVERIFY2(m_message.isEmpty(), qPrintable(m_message));
QCOMPARE(diags, {expectedDiag});
QVERIFY(diags.has_value());
QCOMPARE(*diags, {expectedDiag});
}
void ReadExportedDiagnosticsTest::testAcceptDiagsFromFilePaths_None()
{
const QString sourceFile = filePath("tidy.modernize-use-nullptr.cpp").toString();
const QString exportedFile = createFile(filePath("tidy.modernize-use-nullptr.yaml").toString(),
const FilePath exportedFile = createFile(filePath("tidy.modernize-use-nullptr.yaml").toString(),
sourceFile);
const auto acceptNone = [](const Utils::FilePath &) { return false; };
const Diagnostics diags = readExportedDiagnostics(FilePath::fromString(exportedFile),
acceptNone, &m_message);
QVERIFY2(m_message.isEmpty(), qPrintable(m_message));
QVERIFY(diags.isEmpty());
const auto acceptNone = [](const FilePath &) { return false; };
const expected_str<Diagnostics> diags
= readExportedDiagnostics(exportedFile, acceptNone);
QVERIFY(diags.has_value());
QVERIFY(diags->isEmpty());
}
// Diagnostics from clang (static) analyzer passed through via clang-tidy
void ReadExportedDiagnosticsTest::testTidy_ClangAnalyzer()
{
const FilePath sourceFile = filePath("clang-analyzer.dividezero.cpp");
const QString exportedFile = createFile(
filePath(appendYamlSuffix("clang-analyzer.dividezero")).toString(),
const FilePath exportedFile
= createFile(filePath(appendYamlSuffix("clang-analyzer.dividezero")).toString(),
sourceFile.toString());
Diagnostic expectedDiag;
expectedDiag.name = "clang-analyzer-core.DivideZero";
@@ -128,16 +126,15 @@ void ReadExportedDiagnosticsTest::testTidy_ClangAnalyzer()
false,
},
};
const Diagnostics diags = readExportedDiagnostics(Utils::FilePath::fromString(exportedFile),
{}, &m_message);
QVERIFY2(m_message.isEmpty(), qPrintable(m_message));
QCOMPARE(diags, {expectedDiag});
const expected_str<Diagnostics> diags = readExportedDiagnostics(exportedFile);
QVERIFY(diags.has_value());
QCOMPARE(*diags, {expectedDiag});
}
void ReadExportedDiagnosticsTest::testClazy()
{
const FilePath sourceFile = filePath("clazy.qgetenv.cpp");
const QString exportedFile = createFile(filePath(appendYamlSuffix("clazy.qgetenv")).toString(),
const FilePath exportedFile = createFile(filePath(appendYamlSuffix("clazy.qgetenv")).toString(),
sourceFile.toString());
Diagnostic expectedDiag;
expectedDiag.name = "clazy-qgetenv";
@@ -156,10 +153,9 @@ void ReadExportedDiagnosticsTest::testClazy()
{{sourceFile, 7, 18}, {sourceFile, 7, 29}},
true},
};
const Diagnostics diags = readExportedDiagnostics(Utils::FilePath::fromString(exportedFile),
{}, &m_message);
QVERIFY2(m_message.isEmpty(), qPrintable(m_message));
QCOMPARE(diags, {expectedDiag});
const expected_str<Diagnostics> diags = readExportedDiagnostics(exportedFile);
QVERIFY(diags.has_value());
QCOMPARE(*diags, {expectedDiag});
}
void ReadExportedDiagnosticsTest::testOffsetInvalidText()
@@ -263,25 +259,24 @@ void ReadExportedDiagnosticsTest::testOffsetMultiByteCodePoint2()
}
// Replace FILE_PATH with a real absolute file path in the *.yaml files.
QString ReadExportedDiagnosticsTest::createFile(const QString &yamlFilePath,
FilePath ReadExportedDiagnosticsTest::createFile(const QString &yamlFilePath,
const QString &filePathToInject) const
{
QTC_ASSERT(QDir::isAbsolutePath(filePathToInject), return QString());
const Utils::FilePath newFileName = m_baseDir->absolutePath(
QFileInfo(yamlFilePath).fileName());
QTC_ASSERT(QDir::isAbsolutePath(filePathToInject), return {});
const FilePath newFileName = m_baseDir->absolutePath(QFileInfo(yamlFilePath).fileName());
Utils::FileReader reader;
if (QTC_GUARD(reader.fetch(Utils::FilePath::fromString(yamlFilePath),
FileReader reader;
if (QTC_GUARD(reader.fetch(FilePath::fromString(yamlFilePath),
QIODevice::ReadOnly | QIODevice::Text))) {
QByteArray contents = reader.data();
contents.replace("FILE_PATH", filePathToInject.toLocal8Bit());
Utils::FileSaver fileSaver(newFileName, QIODevice::WriteOnly | QIODevice::Text);
FileSaver fileSaver(newFileName, QIODevice::WriteOnly | QIODevice::Text);
QTC_CHECK(fileSaver.write(contents));
QTC_CHECK(fileSaver.finalize());
}
return newFileName.toString();
return newFileName;
}
FilePath ReadExportedDiagnosticsTest::filePath(const QString &fileName) const

View File

@@ -44,11 +44,10 @@ private slots:
void testOffsetMultiByteCodePoint2();
private:
QString createFile(const QString &yamlFilePath, const QString &filePathToInject) const;
Utils::FilePath createFile(const QString &yamlFilePath, const QString &filePathToInject) const;
Utils::FilePath filePath(const QString &fileName) const;
CppEditor::Tests::TemporaryCopiedDir * const m_baseDir;
QString m_message;
};
} // namespace ClangTools::Internal

View File

@@ -1462,10 +1462,18 @@ CMakeBuildConfiguration::CMakeBuildConfiguration(Target *target, Id id)
// Android magic:
if (DeviceTypeKitAspect::deviceTypeId(k) == Android::Constants::ANDROID_DEVICE_TYPE) {
auto addUniqueKeyToCmd = [&cmd] (const QString &prefix, const QString &value) -> bool {
const bool isUnique =
!Utils::contains(cmd.splitArguments(), [&prefix] (const QString &arg) {
return arg.startsWith(prefix); });
if (isUnique)
cmd.addArg(prefix + value);
return isUnique;
};
buildSteps()->appendStep(Android::Constants::ANDROID_BUILD_APK_ID);
const auto bs = buildSteps()->steps().constLast();
cmd.addArg("-DANDROID_PLATFORM:STRING="
+ bs->data(Android::Constants::AndroidNdkPlatform).toString());
addUniqueKeyToCmd("-DANDROID_PLATFORM:STRING=",
bs->data(Android::Constants::AndroidNdkPlatform).toString());
auto ndkLocation = bs->data(Android::Constants::NdkLocation).value<FilePath>();
cmd.addArg("-DANDROID_NDK:PATH=" + ndkLocation.path());

View File

@@ -159,7 +159,7 @@ Qt::ItemFlags CMakeTargetItem::flags(int) const
// CMakeBuildStep
static QString initialStagingDir()
static QString initialStagingDir(Kit *kit)
{
// Avoid actual file accesses.
auto rg = QRandomGenerator::global();
@@ -167,6 +167,9 @@ static QString initialStagingDir()
char buf[sizeof(rand)];
memcpy(&buf, &rand, sizeof(rand));
const QByteArray ba = QByteArray(buf, sizeof(buf)).toHex();
IDeviceConstPtr buildDevice = BuildDeviceKitAspect::device(kit);
if (buildDevice && buildDevice->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE)
return TemporaryDirectory::masterDirectoryPath() + "/staging-" + ba;
return QString::fromUtf8("/tmp/Qt-Creator-staging-" + ba);
}
@@ -200,7 +203,7 @@ CMakeBuildStep::CMakeBuildStep(BuildStepList *bsl, Id id) :
m_stagingDir = addAspect<FilePathAspect>();
m_stagingDir->setSettingsKey(STAGING_DIR_KEY);
m_stagingDir->setLabelText(Tr::tr("Staging directory:"));
m_stagingDir->setDefaultValue(initialStagingDir());
m_stagingDir->setDefaultValue(initialStagingDir(kit()));
Kit *kit = buildConfiguration()->kit();
if (CMakeBuildConfiguration::isIos(kit)) {

View File

@@ -24,7 +24,7 @@ AuthWidget::AuthWidget(QWidget *parent)
{
using namespace Layouting;
m_button = new QPushButton(Tr::tr("Sign in"));
m_button = new QPushButton(Tr::tr("Sign In"));
m_button->setEnabled(false);
m_progressIndicator = new Utils::ProgressIndicator(Utils::ProgressIndicatorSize::Small);
m_progressIndicator->setVisible(false);
@@ -91,13 +91,13 @@ void AuthWidget::updateClient(const Utils::FilePath &nodeJs, const Utils::FilePa
{
LanguageClientManager::shutdownClient(m_client);
m_client = nullptr;
setState(Tr::tr("Sign in"), false);
setState(Tr::tr("Sign In"), false);
m_button->setEnabled(false);
if (!nodeJs.isExecutableFile() || !agent.exists()) {
return;
}
setState(Tr::tr("Sign in"), true);
setState(Tr::tr("Sign In"), true);
m_client = new CopilotClient(nodeJs, agent);
connect(m_client, &Client::initialized, this, &AuthWidget::checkStatus);
@@ -117,7 +117,7 @@ void AuthWidget::signIn()
QDesktopServices::openUrl(QUrl(response.result()->verificationUri()));
m_statusLabel->setText(Tr::tr("A browser window will open, enter the code %1 when "
m_statusLabel->setText(Tr::tr("A browser window will open. Enter the code %1 when "
"asked.\nThe code has been copied to your clipboard.")
.arg(response.result()->userCode()));
m_statusLabel->setVisible(true);
@@ -129,7 +129,7 @@ void AuthWidget::signIn()
if (response.error()) {
QMessageBox::critical(this,
Tr::tr("Login failed"),
Tr::tr("Login Failed"),
Tr::tr(
"The login request failed: ")
+ response.error()->message());

View File

@@ -13,6 +13,8 @@
#include <utils/layoutbuilder.h>
#include <utils/pathchooser.h>
#include <QToolTip>
using namespace Utils;
using namespace LanguageClient;
@@ -31,8 +33,12 @@ public:
helpLabel->setTextFormat(Qt::MarkdownText);
helpLabel->setWordWrap(true);
helpLabel->setTextInteractionFlags(Qt::LinksAccessibleByMouse
| Qt::LinksAccessibleByKeyboard);
| Qt::LinksAccessibleByKeyboard
| Qt::TextSelectableByMouse);
helpLabel->setOpenExternalLinks(true);
connect(helpLabel, &QLabel::linkHovered, [](const QString &link) {
QToolTip::showText(QCursor::pos(), link);
});
// clang-format off
helpLabel->setText(Tr::tr(R"(

View File

@@ -37,6 +37,8 @@
#include <QTextDocument>
#include <QIcon>
#include <set>
using namespace CPlusPlus;
using namespace CppEditor;
using namespace TextEditor;
@@ -847,14 +849,18 @@ bool InternalCppCompletionAssistProcessor::accepts() const
IAssistProposal *InternalCppCompletionAssistProcessor::createContentProposal()
{
// Duplicates are kept only if they are snippets.
QSet<QString> processed;
auto it = m_completions.begin();
while (it != m_completions.end()) {
auto item = static_cast<CppAssistProposalItem *>(*it);
if (!processed.contains(item->text()) || item->isSnippet()) {
std::set<QString> processed;
for (auto it = m_completions.begin(); it != m_completions.end();) {
if ((*it)->isSnippet()) {
++it;
if (!item->isSnippet()) {
processed.insert(item->text());
continue;
}
if (!processed.insert((*it)->text()).second) {
delete *it;
it = m_completions.erase(it);
continue;
}
auto item = static_cast<CppAssistProposalItem *>(*it);
if (!item->isOverloaded()) {
if (auto symbol = qvariant_cast<Symbol *>(item->data())) {
if (Function *funTy = symbol->type()->asFunctionType()) {
@@ -863,11 +869,7 @@ IAssistProposal *InternalCppCompletionAssistProcessor::createContentProposal()
}
}
}
}
} else {
delete *it;
it = m_completions.erase(it);
}
++it;
}
m_model->loadContent(m_completions);

View File

@@ -749,7 +749,7 @@ bool DockerDevicePrivate::startContainer()
DockerApi::recheckDockerDaemon();
MessageManager::writeFlashing(Tr::tr("Docker daemon appears to be not running. "
"Verify daemon is up and running and reset the "
"docker daemon on the docker device settings page "
"Docker daemon in Docker device preferences "
"or restart Qt Creator."));
});

View File

@@ -80,9 +80,9 @@ DockerDeviceWidget::DockerDeviceWidget(const IDevice::Ptr &device)
});
m_enableLldbFlags = new QCheckBox(Tr::tr("Enable flags needed for LLDB"));
m_enableLldbFlags->setToolTip(Tr::tr("Adds the following flags to the container: "
"--cap-add=SYS_PTRACE --security-opt seccomp=unconfined, "
"this is necessary to allow lldb to run"));
m_enableLldbFlags->setToolTip(Tr::tr("Adds the following flags to the container "
"to allow LLDB to run: "
"--cap-add=SYS_PTRACE --security-opt seccomp=unconfined"));
m_enableLldbFlags->setChecked(m_data.enableLldbFlags);
m_enableLldbFlags->setEnabled(true);
@@ -159,7 +159,7 @@ DockerDeviceWidget::DockerDeviceWidget(const IDevice::Ptr &device)
searchDirsLineEdit->setPlaceholderText(Tr::tr("Semicolon-separated list of directories"));
searchDirsLineEdit->setToolTip(
Tr::tr("Select the paths in the docker image that should be scanned for kit entries."));
Tr::tr("Select the paths in the Docker image that should be scanned for kit entries."));
searchDirsLineEdit->setHistoryCompleter("DockerMounts", true);
auto searchPaths = [searchDirsComboBox, searchDirsLineEdit, dockerDevice] {
@@ -195,7 +195,7 @@ DockerDeviceWidget::DockerDeviceWidget(const IDevice::Ptr &device)
m_kitItemDetector.autoDetect(dockerDevice->id().toString(), searchPaths());
if (DockerApi::instance()->dockerDaemonAvailable().value_or(false) == false)
logView->append(Tr::tr("Docker daemon appears to be not running."));
logView->append(Tr::tr("Docker daemon appears to be stopped."));
else
logView->append(Tr::tr("Docker daemon appears to be running."));

View File

@@ -2856,7 +2856,7 @@ bool GitClient::addAndCommit(const FilePath &repositoryDirectory,
GitPlugin::updateCurrentBranch();
return true;
}
VcsOutputWindow::appendError(Tr::tr("Cannot commit %n file(s)", nullptr, commitCount) + "\n");
VcsOutputWindow::appendError(Tr::tr("Cannot commit %n file(s).", nullptr, commitCount) + "\n");
return false;
}

View File

@@ -229,7 +229,7 @@ void McuSupportOptionsWidget::updateStatus()
: Tr::tr("A kit for the selected target can be created."));
} else {
m_kitCreationInfoLabel->setType(Utils::InfoLabel::NotOk);
m_kitCreationInfoLabel->setText(Tr::tr("Provide the package paths in order to create a kit "
m_kitCreationInfoLabel->setText(Tr::tr("Provide the package paths to create a kit "
"for your target."));
}
}
@@ -243,7 +243,7 @@ void McuSupportOptionsWidget::updateStatus()
if (m_statusInfoLabel->isVisible()) {
m_statusInfoLabel->setType(Utils::InfoLabel::NotOk);
m_statusInfoLabel->setText(Tr::tr("No CMake tool was detected. Add a CMake tool in the "
"<a href=\"cmake\">CMake options</a> and press Apply."));
"<a href=\"cmake\">CMake options</a> and select Apply."));
}
}
}

View File

@@ -168,7 +168,7 @@ void McuSupportPlugin::askUserAboutMcuSupportKitsUpgrade(const SettingsHandler::
return;
Utils::InfoBarEntry info(upgradeMcuSupportKits,
Tr::tr("New version of Qt for MCUs detected. Upgrade existing Kits?"),
Tr::tr("New version of Qt for MCUs detected. Upgrade existing kits?"),
Utils::InfoBarEntry::GlobalSuppression::Enabled);
using McuKitManager::UpgradeOption;
static UpgradeOption selectedOption = UpgradeOption::Keep;

View File

@@ -64,7 +64,7 @@ bool PythonWizardPageFactory::validateData(Id typeId, const QVariant &data, QStr
if (items.isEmpty()) {
if (errorMessage) {
*errorMessage = Tr::tr("'data' of a Python wizard page expects a map with 'items' "
*errorMessage = Tr::tr("\"data\" of a Python wizard page expects a map with \"items\" "
"containing a list of objects.");
}
return false;
@@ -73,9 +73,9 @@ bool PythonWizardPageFactory::validateData(Id typeId, const QVariant &data, QStr
if (!Utils::allOf(items, &validItem)) {
if (errorMessage) {
*errorMessage = Tr::tr(
"An item of Python wizard page data expects a 'trKey' field containing the ui "
"visible string for that python version and an field 'value' containing an object "
"with a 'PySideVersion' field used for import statements in the python files.");
"An item of Python wizard page data expects a \"trKey\" field containing the UI "
"visible string for that Python version and a \"value\" field containing an object "
"with a \"PySideVersion\" field used for import statements in the Python files.");
}
return false;
}

View File

@@ -79,10 +79,10 @@ TerminalPane::TerminalPane(QObject *parent)
.toString(QKeySequence::NativeText);
if (TerminalSettings::instance().sendEscapeToTerminal.value()) {
m_escSettingButton->setText(escKey);
m_escSettingButton->setToolTip(Tr::tr("Sending Esc to terminal instead of Qt Creator"));
m_escSettingButton->setToolTip(Tr::tr("Sends Esc to terminal instead of Qt Creator."));
} else {
m_escSettingButton->setText(shiftEsc);
m_escSettingButton->setToolTip(Tr::tr("Press %1 to send Esc to terminal").arg(shiftEsc));
m_escSettingButton->setToolTip(Tr::tr("Press %1 to send Esc to terminal.").arg(shiftEsc));
}
};
@@ -252,10 +252,10 @@ void TerminalPane::initActions()
TerminalSettings::instance().lockKeyboard.setValue(locked);
if (locked) {
lockKeyboard.setIcon(LOCK_KEYBOARD_ICON.icon());
lockKeyboard.setToolTip(Tr::tr("Keyboard shortcuts will be sent to the Terminal"));
lockKeyboard.setToolTip(Tr::tr("Sends keyboard shortcuts to Terminal."));
} else {
lockKeyboard.setIcon(UNLOCK_KEYBOARD_ICON.icon());
lockKeyboard.setToolTip(Tr::tr("Keyboard shortcuts will be sent to Qt Creator"));
lockKeyboard.setToolTip(Tr::tr("Sends keyboard shortcuts to Qt Creator."));
}
};

View File

@@ -110,7 +110,7 @@ static expected_str<void> loadItermColors(const FilePath &path)
QFile f(path.toFSPathString());
const bool opened = f.open(QIODevice::ReadOnly);
if (!opened)
return make_unexpected(Tr::tr("Failed to open file"));
return make_unexpected(Tr::tr("Failed to open file."));
QXmlStreamReader reader(&f);
while (!reader.atEnd() && reader.readNextStartElement()) {
@@ -191,7 +191,7 @@ static expected_str<void> loadVsCodeColors(const FilePath &path)
const QJsonObject root = doc.object();
const auto itColors = root.find("colors");
if (itColors == root.end())
return make_unexpected(Tr::tr("No colors found"));
return make_unexpected(Tr::tr("No colors found."));
const QJsonObject colors = itColors->toObject();
@@ -252,7 +252,7 @@ static expected_str<void> loadKonsoleColorScheme(const FilePath &path)
auto parseColor = [](const QStringList &parts) -> expected_str<QColor> {
if (parts.size() != 3 && parts.size() != 4)
return make_unexpected(Tr::tr("Invalid color format"));
return make_unexpected(Tr::tr("Invalid color format."));
int alpha = parts.size() == 4 ? parts[3].toInt() : 255;
return QColor(parts[0].toInt(), parts[1].toInt(), parts[2].toInt(), alpha);
};
@@ -351,7 +351,7 @@ static expected_str<void> loadColorScheme(const FilePath &path)
else if (path.suffix() == "theme" || path.completeSuffix() == "theme.txt")
return loadXFCE4ColorScheme(path);
return make_unexpected(Tr::tr("Unknown color scheme format"));
return make_unexpected(Tr::tr("Unknown color scheme format."));
}
static TerminalSettings *s_instance;
@@ -375,7 +375,7 @@ TerminalSettings::TerminalSettings()
enableTerminal.setSettingsKey("EnableTerminal");
enableTerminal.setLabelText(Tr::tr("Use internal terminal"));
enableTerminal.setToolTip(
Tr::tr("If enabled, use the internal terminal when \"Run In Terminal\" is "
Tr::tr("Uses the internal terminal when \"Run In Terminal\" is "
"enabled and for \"Open Terminal here\"."));
enableTerminal.setDefaultValue(true);
@@ -387,7 +387,7 @@ TerminalSettings::TerminalSettings()
fontSize.setSettingsKey("FontSize");
fontSize.setLabelText(Tr::tr("Size:"));
fontSize.setToolTip(Tr::tr("The font size used in the terminal. (in points)"));
fontSize.setToolTip(Tr::tr("The font size used in the terminal (in points)."));
fontSize.setDefaultValue(defaultFontSize());
fontSize.setRange(1, 100);
@@ -414,13 +414,13 @@ TerminalSettings::TerminalSettings()
sendEscapeToTerminal.setSettingsKey("SendEscapeToTerminal");
sendEscapeToTerminal.setLabelText(Tr::tr("Send escape key to terminal"));
sendEscapeToTerminal.setToolTip(
Tr::tr("If enabled, pressing the escape key will send it to the terminal "
Tr::tr("Sends the escape key to the terminal when pressed"
"instead of closing the terminal."));
sendEscapeToTerminal.setDefaultValue(false);
audibleBell.setSettingsKey("AudibleBell");
audibleBell.setLabelText(Tr::tr("Audible bell"));
audibleBell.setToolTip(Tr::tr("If enabled, the terminal will beep when a bell "
audibleBell.setToolTip(Tr::tr("Makes the terminal beep when a bell "
"character is received."));
audibleBell.setDefaultValue(true);

View File

@@ -420,8 +420,8 @@ bool FontSettings::loadColorScheme(const Utils::FilePath &filePath,
for (const FormatDescription &desc : descriptions) {
const TextStyle id = desc.id();
if (!m_scheme.contains(id)) {
if (id == C_NAMESPACE && m_scheme.contains(C_TYPE)) {
m_scheme.setFormatFor(C_NAMESPACE, m_scheme.formatFor(C_TYPE));
if ((id == C_NAMESPACE || id == C_CONCEPT) && m_scheme.contains(C_TYPE)) {
m_scheme.setFormatFor(id, m_scheme.formatFor(C_TYPE));
continue;
}
if (id == C_MACRO && m_scheme.contains(C_FUNCTION)) {

View File

@@ -33,6 +33,7 @@ const char *nameForStyle(TextStyle style)
case C_NUMBER: return "Number";
case C_STRING: return "String";
case C_TYPE: return "Type";
case C_CONCEPT: return "Concept";
case C_NAMESPACE: return "Namespace";
case C_LOCAL: return "Local";
case C_PARAMETER: return "Parameter";

View File

@@ -33,6 +33,7 @@ enum TextStyle : quint8 {
C_NUMBER,
C_STRING,
C_TYPE,
C_CONCEPT,
C_NAMESPACE,
C_LOCAL,
C_PARAMETER,

View File

@@ -141,6 +141,8 @@ FormatDescriptions TextEditorSettingsPrivate::initialFormats()
Tr::tr("Name of a primitive data type."), Qt::darkYellow);
formatDescr.emplace_back(C_TYPE, Tr::tr("Type"), Tr::tr("Name of a type."),
Qt::darkMagenta);
formatDescr.emplace_back(C_CONCEPT, Tr::tr("Concept"), Tr::tr("Name of a concept."),
Qt::darkMagenta);
formatDescr.emplace_back(C_NAMESPACE, Tr::tr("Namespace"), Tr::tr("Name of a namespace."),
Qt::darkGreen);
formatDescr.emplace_back(C_LOCAL, Tr::tr("Local"),

View File

@@ -61,7 +61,7 @@ void ValgrindToolRunner::start()
if (!found.isExecutableFile()) {
reportFailure(Tr::tr("Valgrind executable \"%1\" not found or not executable.\n"
"Check settings or ensure valgrind is installed and available in PATH.")
"Check settings or ensure Valgrind is installed and available in PATH.")
.arg(valgrindExecutable.toUserOutput()));
return;
}

View File

@@ -3,6 +3,7 @@ import qbs 1.0
QtcTool {
name: "disclaim"
condition: qbs.targetOS.contains("macos")
useQt: false
files: [
"disclaim.mm"

View File

@@ -4,7 +4,7 @@ QtcTool {
name: "qtcreator_process_stub"
consoleApplication: true
Depends { name: "Qt"; submodules: ["core", "network"]; }
Depends { name: "Qt.network" }
files: [ "main.cpp" ]
files: "main.cpp"
}

View File

@@ -3,7 +3,5 @@ import qbs 1.0
QtcTool {
name: "qtpromaker"
Depends { name: "Qt.core" }
files: [ "main.cpp" ]
files: "main.cpp"
}

View File

@@ -188,17 +188,95 @@ private slots:
QCOMPARE(cmd.arguments(), "and args");
}
void testFromInputWithMacro_data()
{
QTest::addColumn<QString>("input");
QTest::addColumn<QString>("expectedExecutable");
QTest::addColumn<QString>("expectedArguments");
QTest::newRow("simple") << "command %{hello}"
<< "command"
<< (HostOsInfo::isWindowsHost() ? "\"hello world\""
: "'hello world'");
QTest::newRow("simple-quoted")
<< "command \"%{hello}\""
<< "command" << (HostOsInfo::isWindowsHost() ? "\"hello world\"" : "'hello world'");
QTest::newRow("quoted-with-extra")
<< "command \"%{hello}, he said\""
<< "command"
<< (HostOsInfo::isWindowsHost() ? "\"hello world, he said\"" : "'hello world, he said'");
QTest::newRow("convert-to-quote-win")
<< "command 'this is a test'"
<< "command"
<< (HostOsInfo::isWindowsHost() ? "\"this is a test\"" : "'this is a test'");
}
void testFromInputWithMacro()
{
QFETCH(QString, input);
QFETCH(QString, expectedExecutable);
QFETCH(QString, expectedArguments);
MacroExpander expander;
expander.registerVariable("hello", "world var", [] { return "hello world"; });
CommandLine cmd = CommandLine::fromUserInput("command macroarg: %{hello}", &expander);
QCOMPARE(cmd.executable(), "command");
CommandLine cmd = CommandLine::fromUserInput(input, &expander);
QCOMPARE(cmd.executable().toUserOutput(), expectedExecutable);
// TODO: Fix (macro) escaping on windows
if (HostOsInfo::isWindowsHost())
QEXPECT_FAIL("", "Windows does not correctly quote macro arguments", Continue);
QEXPECT_FAIL("simple", "Windows does not correctly quote macro arguments", Continue);
if (HostOsInfo::isWindowsHost())
QEXPECT_FAIL("simple-quoted", "Windows removes quotes from macro arguments", Continue);
if (HostOsInfo::isWindowsHost())
QEXPECT_FAIL("convert-to-quote-win",
"Windows should convert single to double quotes",
Continue);
QCOMPARE(cmd.arguments(), "macroarg: 'hello world'");
QCOMPARE(cmd.arguments(), expectedArguments);
}
void testMultiCommand_data()
{
QTest::addColumn<QString>("input");
QTest::addColumn<QString>("executable");
QTest::addColumn<QString>("arguments");
QTest::newRow("command-and-command") << "command1 && command2"
<< "command1"
<< "&& command2";
QTest::newRow("command-and-command-nospace") << "command1&&command2"
<< "command1"
<< "&&command2";
QTest::newRow("command-semicolon-command") << "command1 ; command2"
<< "command1"
<< "; command2";
QTest::newRow("command-or-command") << "command1 || command2"
<< "command1"
<< "|| command2";
}
void testMultiCommand()
{
QFETCH(QString, input);
QFETCH(QString, executable);
QFETCH(QString, arguments);
CommandLine cmdLine = CommandLine::fromUserInput(input);
QEXPECT_FAIL(
"command-and-command-nospace",
"CommandLine::fromUserInput does not handle multi-command without space correctly",
Abort);
QCOMPARE(cmdLine.executable().path(), executable);
QCOMPARE(cmdLine.arguments(), arguments);
}
};

View File

@@ -1,82 +0,0 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick 2.2
import QtQuick.Controls 1.2
import QtQuick.Layouts 1.0
ColumnLayout {
property alias rowBox_1: rowBox_1
property alias rowLayout_1: rowLayout_1
property alias textField_1: textField_1
property alias button_1: button_1
property alias gridBox_1: gridBox_1
property alias gridLayout_1: gridLayout_1
property alias label_1: label_1
property alias label_2: label_2
property alias label_3: label_3
property alias textField_2: textField_2
property alias textField_3: textField_3
property alias textField_4: textField_4
property alias textField_5: textField_5
property alias textArea_1: textArea_1
anchors.fill: parent
GroupBox {
id: rowBox_1
title: "Row layout"
Layout.fillWidth: true
RowLayout {
id: rowLayout_1
anchors.fill: parent
TextField {
id: textField_1
placeholderText: "This wants to grow horizontally"
Layout.fillWidth: true
}
Button {
id: button_1
text: "Button"
}
}
}
GroupBox {
id: gridBox_1
title: "Grid layout"
Layout.fillWidth: true
GridLayout {
id: gridLayout_1
rows: 3
flow: GridLayout.TopToBottom
anchors.fill: parent
Label { id: label_1; text: "Line 1" }
Label { id: label_2; text: "Line 2" }
Label { id: label_3; text: "Line 3" }
TextField { id: textField_2 }
TextField { id: textField_3 }
TextField { id: textField_4 }
TextArea {
id: textField_5
text: "This widget spans over three rows in the GridLayout.\n"
+ "All items in the GridLayout are implicitly positioned from top to bottom."
Layout.rowSpan: 3
Layout.fillHeight: true
Layout.fillWidth: true
}
}
}
TextArea {
id: textArea_1
text: "This fills the whole cell"
Layout.minimumHeight: 30
Layout.fillHeight: true
Layout.fillWidth: true
}
}

View File

@@ -1,13 +0,0 @@
QT += qml quick
TARGET = basiclayouts
!no_desktop: QT += widgets
include(src/src.pri)
include(../shared/shared.pri)
OTHER_FILES += \
main.qml \
MainForm.qml \
RESOURCES += \
resources.qrc

View File

@@ -1,16 +0,0 @@
import QmlProject 1.1
Project {
mainFile: "main.qml"
/* Include .qml, .js, and image files from current directory and subdirectories */
QmlFiles {
directory: "."
}
JavaScriptFiles {
directory: "."
}
ImageFiles {
directory: "."
}
}

View File

@@ -1,22 +0,0 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick 2.2
import QtQuick.Controls 1.2
import QtQuick.Layouts 1.0
ApplicationWindow {
visible: true
title: "Basic layouts"
property int margin: 11
width: mainForm.implicitWidth + 2 * margin
height: mainForm.implicitHeight + 2 * margin
minimumWidth: mainForm.Layout.minimumWidth + 2 * margin
minimumHeight: mainForm.Layout.minimumHeight + 2 * margin
MainForm {
id: mainForm
anchors.margins: margin
}
}

View File

@@ -1,47 +0,0 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick 2.2
import QtQuick.Controls 1.2
import QtQuick.Layouts 1.0
import QtQuick.Dialogs 1.0
import "content"
TabView {
id: tabView
tabPosition: controlPage.item ? controlPage.item.tabPosition : Qt.TopEdge
width: 640
height: 420
Tab {
id: controlPage
title: "Controls"
Controls {
anchors.fill: parent
enabled: tabView.enabled
}
}
Tab {
title: "Itemviews"
ModelView {
anchors.fill: parent
anchors.margins: Qt.platform.os === "osx" ? 12 : 6
}
}
Tab {
title: "Styles"
Styles {
anchors.fill: parent
}
}
Tab {
title: "Layouts"
Layouts {
anchors.fill:parent
anchors.margins: 8
}
}
}

View File

@@ -1,12 +0,0 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick 2.2
import QtQuick.Dialogs 1.1
MessageDialog {
icon: StandardIcon.Information
text: "QtQuick.Controls gallery example"
detailedText: "This example demonstrates most of the available Qt Quick Controls."
title: "About Gallery"
}

View File

@@ -1,81 +0,0 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick 2.2
import QtQuick.Window 2.1
import QtQuick.Controls 1.2
Window {
id: window1
width: 400
height: 400
title: "child window"
flags: Qt.Dialog
Rectangle {
color: syspal.window
anchors.fill: parent
Label {
id: dimensionsText
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
width: parent.width
horizontalAlignment: Text.AlignHCenter
}
Label {
id: availableDimensionsText
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: dimensionsText.bottom
width: parent.width
horizontalAlignment: Text.AlignHCenter
}
Label {
id: closeText
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: availableDimensionsText.bottom
text: "This is a new Window, press the\nbutton below to close it again."
}
Button {
anchors.horizontalCenter: closeText.horizontalCenter
anchors.top: closeText.bottom
id: closeWindowButton
text:"Close"
width: 98
tooltip:"Press me, to close this window again"
onClicked: window1.visible = false
}
Button {
anchors.horizontalCenter: closeText.horizontalCenter
anchors.top: closeWindowButton.bottom
id: maximizeWindowButton
text:"Maximize"
width: 98
tooltip:"Press me, to maximize this window again"
onClicked: window1.visibility = Window.Maximized;
}
Button {
anchors.horizontalCenter: closeText.horizontalCenter
anchors.top: maximizeWindowButton.bottom
id: normalizeWindowButton
text:"Normalize"
width: 98
tooltip:"Press me, to normalize this window again"
onClicked: window1.visibility = Window.Windowed;
}
Button {
anchors.horizontalCenter: closeText.horizontalCenter
anchors.top: normalizeWindowButton.bottom
id: minimizeWindowButton
text:"Minimize"
width: 98
tooltip:"Press me, to minimize this window again"
onClicked: window1.visibility = Window.Minimized;
}
}
}

View File

@@ -1,27 +0,0 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick 2.2
import QtQuick.Controls 1.2
import QtQuick.Layouts 1.1
import QtQuick.Controls.Styles 1.1
ControlsForm {
id: flickable
button2.menu: Menu {
MenuItem { text: "This Button" }
MenuItem { text: "Happens To Have" }
MenuItem { text: "A Menu Assigned" }
}
editableCombo.onAccepted: {
if (editableCombo.find(currentText) === -1) {
choices.append({text: editText})
currentIndex = editableCombo.find(editText)
}
}
fontComboBox.model: Qt.fontFamilies()
rowLayout1.data: [ ExclusiveGroup { id: tabPositionGroup } ]
}

View File

@@ -1,180 +0,0 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick 2.2
import QtQuick.Controls 1.2
import QtQuick.Layouts 1.1
import QtQuick.Controls.Styles 1.1
Item {
id: flickable
width: 640
height: 420
property alias fontComboBox: fontComboBox
property alias rowLayout1: rowLayout1
property alias button2: button2
property alias editableCombo: editableCombo
property int tabPosition: tabPositionGroup.current === r2 ? Qt.BottomEdge : Qt.TopEdge
RowLayout {
id: contentRow
anchors.fill:parent
anchors.margins: 8
spacing: 16
ColumnLayout {
id: firstColumn
Layout.minimumWidth: implicitWidth
Layout.fillWidth: false
RowLayout {
id: buttonrow
Button {
id: button1
text: "Button 1"
tooltip:"This is an interesting tool tip"
Layout.fillWidth: true
}
Button {
id:button2
text:"Button 2"
Layout.fillWidth: true
}
}
ComboBox {
id: combo
model: choices
currentIndex: 2
Layout.fillWidth: true
}
ComboBox {
id: fontComboBox
Layout.fillWidth: true
currentIndex: 47
}
ComboBox {
id: editableCombo
editable: true
model: choices
Layout.fillWidth: true
currentIndex: 2
}
RowLayout {
SpinBox {
id: t1
Layout.fillWidth: true
minimumValue: -50
value: -20
}
SpinBox {
id: t2
Layout.fillWidth: true
}
}
TextField {
id: t3
placeholderText: "This is a placeholder for a TextField"
Layout.fillWidth: true
}
ProgressBar {
// normalize value [0.0 .. 1.0]
value: (slider.value - slider.minimumValue) / (slider.maximumValue - slider.minimumValue)
Layout.fillWidth: true
}
ProgressBar {
indeterminate: true
Layout.fillWidth: true
}
Slider {
id: slider
value: 0.5
Layout.fillWidth: true
tickmarksEnabled: tickmarkCheck.checked
stepSize: tickmarksEnabled ? 0.1 : 0
}
MouseArea {
id: busyCheck
Layout.fillWidth: true
Layout.fillHeight: true
hoverEnabled:true
Layout.preferredHeight: busyIndicator.height
BusyIndicator {
id: busyIndicator
running: busyCheck.containsMouse
anchors.horizontalCenter: parent.horizontalCenter
}
}
}
ColumnLayout {
id: rightcol
Layout.fillWidth: true
anchors {
top: parent.top
bottom: parent.bottom
}
GroupBox {
id: group1
title: "CheckBox"
Layout.fillWidth: true
RowLayout {
Layout.fillWidth: true
CheckBox {
id: frameCheckbox
text: "Text frame"
checked: true
Layout.minimumWidth: 100
}
CheckBox {
id: tickmarkCheck
text: "Tickmarks"
checked: false
Layout.minimumWidth: 100
}
CheckBox {
id: wrapCheck
text: "Word wrap"
checked: true
Layout.minimumWidth: 100
}
}
}
GroupBox {
id: group2
title:"Tab Position"
Layout.fillWidth: true
RowLayout {
id: rowLayout1
RadioButton {
id: r1
text: "Top"
checked: true
exclusiveGroup: tabPositionGroup
Layout.minimumWidth: 100
}
RadioButton {
id: r2
text: "Bottom"
exclusiveGroup: tabPositionGroup
Layout.minimumWidth: 100
}
}
}
TextArea {
id: area
frameVisible: frameCheckbox.checked
text: loremIpsum + loremIpsum
textFormat: Qt.RichText
wrapMode: wrapCheck.checked ? TextEdit.WordWrap : TextEdit.NoWrap
Layout.fillWidth: true
Layout.fillHeight: true
//menu: editmenu
}
}
}
}

View File

@@ -1,14 +0,0 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick 2.2
import QtQuick.Controls 1.2
ListModel {
id: dummyModel
Component.onCompleted: {
for (var i = 0 ; i < 100 ; ++i) {
append({"index": i, "title": "A title " + i, "imagesource" :"http://someurl.com", "credit" : "N/A"})
}
}
}

View File

@@ -1,22 +0,0 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick 2.2
import QtQuick.Window 2.1
Window {
id: imageViewer
minimumWidth: viewerImage.width
minimumHeight: viewerImage.height
function open(source) {
viewerImage.source = source
width = viewerImage.implicitWidth + 20
height = viewerImage.implicitHeight + 20
title = source
visible = true
}
Image {
id: viewerImage
anchors.centerIn: parent
}
}

View File

@@ -1,71 +0,0 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick 2.2
import QtQuick.Controls 1.2
import QtQuick.Layouts 1.0
Item {
id:root
width: 600
height: 300
ColumnLayout {
id: mainLayout
anchors.fill: parent
spacing: 4
GroupBox {
id: rowBox
title: "Row layout"
Layout.fillWidth: true
RowLayout {
id: rowLayout
anchors.fill: parent
TextField {
placeholderText: "This wants to grow horizontally"
Layout.fillWidth: true
}
Button {
text: "Button"
}
}
}
GroupBox {
id: gridBox
title: "Grid layout"
Layout.fillWidth: true
GridLayout {
id: gridLayout
anchors.fill: parent
rows: 3
flow: GridLayout.TopToBottom
Label { text: "Line 1" }
Label { text: "Line 2" }
Label { text: "Line 3" }
TextField { }
TextField { }
TextField { }
TextArea {
text: "This widget spans over three rows in the GridLayout.\n"
+ "All items in the GridLayout are implicitly positioned from top to bottom."
Layout.rowSpan: 3
Layout.fillHeight: true
Layout.fillWidth: true
}
}
}
TextArea {
id: t3
text: "This fills the whole cell"
Layout.minimumHeight: 30
Layout.fillHeight: true
Layout.fillWidth: true
}
}
}

View File

@@ -1,55 +0,0 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick 2.2
import QtQuick.Controls 1.2
//import QtQuick.XmlListModel 2.1
Item {
id: root
width: 600
height: 300
// XmlListModel {
// id: flickerModel
// source: "http://api.flickr.com/services/feeds/photos_public.gne?format=rss2&tags=" + "Cat"
// query: "/rss/channel/item"
// namespaceDeclarations: "declare namespace media=\"http://search.yahoo.com/mrss/\";"
// XmlRole { name: "title"; query: "title/string()" }
// XmlRole { name: "imagesource"; query: "media:thumbnail/@url/string()" }
// XmlRole { name: "credit"; query: "media:credit/string()" }
// }
TableView{
model: DummyModel {
}
anchors.fill: parent
TableViewColumn {
role: "index"
title: "#"
width: 36
resizable: false
movable: false
}
TableViewColumn {
role: "title"
title: "Title"
width: 120
}
TableViewColumn {
role: "credit"
title: "Credit"
width: 120
}
TableViewColumn {
role: "imagesource"
title: "Image source"
width: 200
visible: true
}
}
}

View File

@@ -1,146 +0,0 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick 2.2
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.1
import QtQuick.Particles 2.0
import QtQuick.Layouts 1.0
import "styles"
Item {
id: root
width: 600
height: 300
property int columnWidth: 120
GridLayout {
rowSpacing: 12
columnSpacing: 30
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
anchors.margins: 30
Button {
text: "Push me"
style: ButtonStyle { }
implicitWidth: columnWidth
}
Button {
text: "Push me"
style: MyButtonStyle1 {
}
implicitWidth: columnWidth
}
Button {
text: "Push me"
style: MyButtonStyle2 {
}
implicitWidth: columnWidth
}
TextField {
Layout.row: 1
style: TextFieldStyle { }
implicitWidth: columnWidth
}
TextField {
style: MyTextFieldStyle1 {
}
implicitWidth: columnWidth
}
TextField {
style: MyTextFieldStyle2 {
}
implicitWidth: columnWidth
}
Slider {
id: slider1
Layout.row: 2
value: 0.5
implicitWidth: columnWidth
style: SliderStyle { }
}
Slider {
id: slider2
value: 0.5
implicitWidth: columnWidth
style: MySliderStyle1 {
}
}
Slider {
id: slider3
value: 0.5
implicitWidth: columnWidth
style: MySliderStyle2 {
}
}
ProgressBar {
Layout.row: 3
value: slider1.value
implicitWidth: columnWidth
style: ProgressBarStyle { }
}
ProgressBar {
value: slider2.value
implicitWidth: columnWidth
style: MyProgressBarStyle1 { }
}
ProgressBar {
value: slider3.value
implicitWidth: columnWidth
style: MyProgressBarStyle2 { }
}
CheckBox {
text: "CheckBox"
style: CheckBoxStyle{}
Layout.row: 4
implicitWidth: columnWidth
}
RadioButton {
style: RadioButtonStyle{}
text: "RadioButton"
implicitWidth: columnWidth
}
ComboBox {
model: ["Paris", "Oslo", "New York"]
style: ComboBoxStyle{}
implicitWidth: columnWidth
}
TabView {
Layout.row: 5
Layout.columnSpan: 3
Layout.fillWidth: true
implicitHeight: 30
Tab { title: "One" ; Item {}}
Tab { title: "Two" ; Item {}}
Tab { title: "Three" ; Item {}}
Tab { title: "Four" ; Item {}}
style: TabViewStyle {}
}
TabView {
Layout.row: 6
Layout.columnSpan: 3
Layout.fillWidth: true
implicitHeight: 30
Tab { title: "One" ; Item {}}
Tab { title: "Two" ; Item {}}
Tab { title: "Three" ; Item {}}
Tab { title: "Four" ; Item {}}
style: MyTabViewStyle {
}
}
}
}

View File

@@ -1,13 +0,0 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick 2.2
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.1
ButtonStyle {
background: BorderImage {
source: control.pressed ? "../../images/button-pressed.png" : "../../images/button.png"
border.left: 4 ; border.right: 4 ; border.top: 4 ; border.bottom: 4
}
}

View File

@@ -1,26 +0,0 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick 2.2
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.1
ButtonStyle {
background: Rectangle {
implicitHeight: 22
implicitWidth: columnWidth
color: control.pressed ? "darkGray" : control.activeFocus ? "#cdd" : "#ccc"
antialiasing: true
border.color: "gray"
radius: height/2
Rectangle {
anchors.fill: parent
anchors.margins: 1
color: "transparent"
antialiasing: true
visible: !control.pressed
border.color: "#aaffffff"
radius: height/2
}
}
}

View File

@@ -1,54 +0,0 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick 2.2
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.1
import QtQuick.Particles 2.0
ProgressBarStyle {
background: BorderImage {
source: "../../images/progress-background.png"
border.left: 2 ; border.right: 2 ; border.top: 2 ; border.bottom: 2
}
progress: Item {
clip: true
BorderImage {
anchors.fill: parent
anchors.rightMargin: (control.value < control.maximumValue) ? -4 : 0
source: "../../images/progress-fill.png"
border.left: 10 ; border.right: 10
Rectangle {
width: 1
color: "#a70"
opacity: 0.8
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.bottomMargin: 1
anchors.right: parent.right
visible: control.value < control.maximumValue
anchors.rightMargin: -parent.anchors.rightMargin
}
}
ParticleSystem{ id: bubbles; running: visible }
ImageParticle{
id: fireball
system: bubbles
source: "../../images/bubble.png"
opacity: 0.7
}
Emitter{
system: bubbles
anchors.bottom: parent.bottom
anchors.margins: 4
anchors.bottomMargin: -4
anchors.left: parent.left
anchors.right: parent.right
size: 4
sizeVariation: 4
acceleration: PointDirection{ y: -6; xVariation: 3 }
emitRate: 6 * control.value
lifeSpan: 3000
}
}
}

View File

@@ -1,25 +0,0 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick 2.2
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.1
ProgressBarStyle {
background: Rectangle {
implicitWidth: columnWidth
implicitHeight: 24
color: "#f0f0f0"
border.color: "gray"
}
progress: Rectangle {
color: "#ccc"
border.color: "gray"
Rectangle {
color: "transparent"
border.color: "#44ffffff"
anchors.fill: parent
anchors.margins: 1
}
}
}

View File

@@ -1,35 +0,0 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick 2.2
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.1
import QtQuick.Particles 2.0
import QtQuick.Layouts 1.0
SliderStyle {
groove: BorderImage {
height: 6
border.top: 1
border.bottom: 1
source: "../../images/progress-background.png"
border.left: 6
border.right: 6
BorderImage {
anchors.verticalCenter: parent.verticalCenter
source: "../../images/progress-fill.png"
border.left: 5 ; border.top: 1
border.right: 5 ; border.bottom: 1
width: styleData.handlePosition
height: parent.height
}
}
handle: Item {
width: 13
height: 13
Image {
anchors.centerIn: parent
source: "../../images/slider-handle.png"
}
}
}

View File

@@ -1,44 +0,0 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick 2.2
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.1
SliderStyle {
handle: Rectangle {
width: 18
height: 18
color: control.pressed ? "darkGray" : "lightGray"
border.color: "gray"
antialiasing: true
radius: height/2
Rectangle {
anchors.fill: parent
anchors.margins: 1
color: "transparent"
antialiasing: true
border.color: "#eee"
radius: height/2
}
}
groove: Rectangle {
height: 8
implicitWidth: columnWidth
implicitHeight: 22
antialiasing: true
color: "#ccc"
border.color: "#777"
radius: height/2
Rectangle {
anchors.fill: parent
anchors.margins: 1
color: "transparent"
antialiasing: true
border.color: "#66ffffff"
radius: height/2
}
}
}

View File

@@ -1,41 +0,0 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick 2.2
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.1
Component {
TabViewStyle {
tabOverlap: 16
frameOverlap: 4
tabsMovable: true
frame: Rectangle {
gradient: Gradient{
GradientStop { color: "#e5e5e5" ; position: 0 }
GradientStop { color: "#e0e0e0" ; position: 1 }
}
border.color: "#898989"
Rectangle { anchors.fill: parent ; anchors.margins: 1 ; border.color: "white" ; color: "transparent" }
}
tab: Item {
property int totalOverlap: tabOverlap * (control.count - 1)
implicitWidth: Math.min ((styleData.availableWidth + totalOverlap)/control.count - 4, image.sourceSize.width)
implicitHeight: image.sourceSize.height
BorderImage {
id: image
anchors.fill: parent
source: styleData.selected ? "../../images/tab_selected.png" : "../../images/tab.png"
border.left: 30
smooth: false
border.right: 30
}
Text {
text: styleData.title
anchors.centerIn: parent
}
}
leftCorner: Item { implicitWidth: 12 }
}
}

View File

@@ -1,13 +0,0 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick 2.2
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.1
TextFieldStyle {
background: BorderImage {
source: "../../images/textfield.png"
border.left: 4 ; border.right: 4 ; border.top: 4 ; border.bottom: 4
}
}

View File

@@ -1,25 +0,0 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick 2.2
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.1
TextFieldStyle {
background: Rectangle {
implicitWidth: columnWidth
implicitHeight: 22
color: "#f0f0f0"
antialiasing: true
border.color: "gray"
radius: height/2
Rectangle {
anchors.fill: parent
anchors.margins: 1
color: "transparent"
antialiasing: true
border.color: "#aaffffff"
radius: height/2
}
}
}

View File

@@ -1,16 +0,0 @@
import QmlProject 1.1
Project {
//mainFile: "main.qml"
/* Include .qml, .js, and image files from current directory and subdirectories */
QmlFiles {
directory: "."
}
JavaScriptFiles {
directory: "."
}
ImageFiles {
directory: "."
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 214 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 245 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 395 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 456 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 507 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 434 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 196 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 993 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 671 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

View File

@@ -1,209 +0,0 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick 2.3
import QtQuick.Controls 1.3
import QtQuick.Layouts 1.0
import QtQuick.Dialogs 1.0
import "content"
ApplicationWindow {
visible: true
title: "Component Gallery"
width: 640
height: 420
minimumHeight: 400
minimumWidth: 600
property string loremIpsum:
"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor "+
"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor "+
"incididunt ut labore et dolore magna aliqua.\n Ut enim ad minim veniam, quis nostrud "+
"exercitation ullamco laboris nisi ut aliquip ex ea commodo cosnsequat. ";
ImageViewer { id: imageViewer }
FileDialog {
id: fileDialog
nameFilters: [ "Image files (*.png *.jpg)" ]
onAccepted: imageViewer.open(fileUrl)
}
AboutDialog { id: aboutDialog }
Action {
id: openAction
text: "&Open"
shortcut: StandardKey.Open
iconSource: "images/document-open.png"
onTriggered: fileDialog.open()
tooltip: "Open an image"
}
Action {
id: copyAction
text: "&Copy"
shortcut: StandardKey.Copy
iconName: "edit-copy"
enabled: (!!activeFocusItem && !!activeFocusItem["copy"])
onTriggered: activeFocusItem.copy()
}
Action {
id: cutAction
text: "Cu&t"
shortcut: StandardKey.Cut
iconName: "edit-cut"
enabled: (!!activeFocusItem && !!activeFocusItem["cut"])
onTriggered: activeFocusItem.cut()
}
Action {
id: pasteAction
text: "&Paste"
shortcut: StandardKey.Paste
iconName: "edit-paste"
enabled: (!!activeFocusItem && !!activeFocusItem["paste"])
onTriggered: activeFocusItem.paste()
}
Action {
id: aboutAction
text: "About"
onTriggered: aboutDialog.open()
}
ExclusiveGroup {
id: textFormatGroup
Action {
id: a1
text: "Align &Left"
checkable: true
Component.onCompleted: checked = true
}
Action {
id: a2
text: "&Center"
checkable: true
}
Action {
id: a3
text: "Align &Right"
checkable: true
}
}
ChildWindow { id: window1 }
Component {
id: editmenu
Menu {
MenuItem { action: cutAction }
MenuItem { action: copyAction }
MenuItem { action: pasteAction }
MenuSeparator {}
Menu {
title: "Text &Format"
MenuItem { action: a1 }
MenuItem { action: a2 }
MenuItem { action: a3 }
MenuSeparator { }
MenuItem { text: "Allow &Hyphenation"; checkable: true }
}
Menu {
title: "Font &Style"
MenuItem { text: "&Bold"; checkable: true }
MenuItem { text: "&Italic"; checkable: true }
MenuItem { text: "&Underline"; checkable: true }
}
}
}
toolBar: ToolBar {
id: toolbar
RowLayout {
id: toolbarLayout
spacing: 0
anchors.fill: parent
ToolButton {
iconSource: "images/window-new.png"
onClicked: window1.visible = !window1.visible
Accessible.name: "New window"
tooltip: "Toggle visibility of the second window"
}
ToolButton { action: openAction }
ToolButton {
Accessible.name: "Save as"
iconSource: "images/document-save-as.png"
tooltip: "(Pretend to) Save as..."
}
Item { Layout.fillWidth: true }
CheckBox {
id: enabledCheck
text: "Enabled"
checked: true
}
}
}
menuBar: MenuBar {
Menu {
title: "&File"
MenuItem { action: openAction }
MenuItem {
text: "Close"
shortcut: StandardKey.Quit
onTriggered: Qt.quit()
}
}
Menu {
title: "&Edit"
MenuItem { action: cutAction }
MenuItem { action: copyAction }
MenuItem { action: pasteAction }
MenuSeparator { }
MenuItem {
text: "Do Nothing"
shortcut: "Ctrl+E,Shift+Ctrl+X"
enabled: false
}
MenuItem {
text: "Not Even There"
shortcut: "Ctrl+E,Shift+Ctrl+Y"
visible: false
}
Menu {
title: "Me Neither"
visible: false
}
}
Menu {
title: "&Help"
MenuItem { action: aboutAction }
}
}
SystemPalette {id: syspal}
color: syspal.window
ListModel {
id: choices
ListElement { text: "Banana" }
ListElement { text: "Orange" }
ListElement { text: "Apple" }
ListElement { text: "Coconut" }
}
MainTabView {
id: frame
enabled: enabledCheck.checked
anchors.fill: parent
anchors.margins: Qt.platform.os === "osx" ? 12 : 2
}
}

View File

@@ -1,38 +0,0 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick 2.2
import QtQuick.Controls 1.2
import QtQuick.Layouts 1.0
SplitView {
width: 600
height: 400
Rectangle {
id: column
width: 200
Layout.minimumWidth: 100
Layout.maximumWidth: 300
color: "lightsteelblue"
}
SplitView {
orientation: Qt.Vertical
Layout.fillWidth: true
Rectangle {
id: row1
height: 200
color: "lightblue"
Layout.minimumHeight: 1
}
Rectangle {
id: row2
color: "lightgray"
}
}
}

View File

@@ -1,17 +0,0 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick 2.2
import QtQuick.Controls 1.2
ApplicationWindow {
visible: true
width: 600
height: 400
MainForm {
anchors.fill: parent
}
}

View File

@@ -1,16 +0,0 @@
import QmlProject 1.1
Project {
mainFile: "main.qml"
/* Include .qml, .js, and image files from current directory and subdirectories */
QmlFiles {
directory: "."
}
JavaScriptFiles {
directory: "."
}
ImageFiles {
directory: "."
}
}

View File

@@ -1,59 +0,0 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick 2.2
import QtQuick.Window 2.1
import QtQuick.Controls 1.2
Column {
width: 540
height: 360
property alias frame: frame
property int margins: Qt.platform.os === "osx" ? 16 : 0
MainTabView {
id: frame
height: parent.height - 34
anchors.right: parent.right
anchors.left: parent.left
anchors.margins: margins
genteratedTabFrameVisible: frameCheckbox.checked
genteratedTabHeaderVisible: headerCheckbox.checked
genteratedTabSortIndicatorVisible: sortableCheckbox.checked
genteratedTabAlternatingRowColors: alternateCheckbox.checked
}
Row {
x: 12
height: 34
CheckBox{
id: alternateCheckbox
checked: true
text: "Alternate"
anchors.verticalCenter: parent.verticalCenter
}
CheckBox{
id: sortableCheckbox
checked: false
text: "Sort indicator"
anchors.verticalCenter: parent.verticalCenter
}
CheckBox{
id: frameCheckbox
checked: true
text: "Frame"
anchors.verticalCenter: parent.verticalCenter
}
CheckBox{
id: headerCheckbox
checked: true
text: "Headers"
anchors.verticalCenter: parent.verticalCenter
}
}
}

View File

@@ -1,70 +0,0 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick 2.2
import QtQuick.Window 2.1
import QtQuick.Controls 1.2
import "tabs"
TabView {
id:frame
focus:true
width: 540
height: 360
property bool genteratedTabFrameVisible: false
property bool genteratedTabHeaderVisible: false
property bool genteratedTabSortIndicatorVisible: false
property bool genteratedTabAlternatingRowColors: false
Tab {
title: "XmlListModel"
TabXmlListModel {
anchors.fill: parent
anchors.margins: 12
frameVisible: genteratedTabFrameVisible
headerVisible: genteratedTabHeaderVisible
sortIndicatorVisible: genteratedTabSortIndicatorVisible
alternatingRowColors: genteratedTabAlternatingRowColors
}
}
Tab {
title: "Multivalue"
TabMultivalue {
anchors.fill: parent
anchors.margins: 12
frameVisible: genteratedTabFrameVisible
headerVisible: genteratedTabHeaderVisible
sortIndicatorVisible: genteratedTabSortIndicatorVisible
alternatingRowColors: genteratedTabAlternatingRowColors
}
}
Tab {
title: "Generated"
id: generatedTab
TabGenerated {
anchors.margins: 12
anchors.fill: parent
frameVisible: genteratedTabFrameVisible
headerVisible: genteratedTabHeaderVisible
sortIndicatorVisible: genteratedTabSortIndicatorVisible
alternatingRowColors: genteratedTabAlternatingRowColors
}
}
Tab {
title: "Delegates"
TabDelegates {
}
}
}

Some files were not shown because too many files have changed in this diff Show More