Merge "Merge remote-tracking branch 'origin/6.0'"

This commit is contained in:
The Qt Project
2022-01-19 10:52:01 +00:00
9 changed files with 69 additions and 34 deletions

View File

@@ -289,7 +289,6 @@ QtObject {
property string themeTabInactiveBackground: Theme.color(Theme.DStabInactiveBackground)
property string themeTabInactiveText: Theme.color(Theme.DStabInactiveText)
property string themeStateDefaultHighlight: Theme.color(Theme.DSstateDefaultHighlight)
property string themeStateSeparator: Theme.color(Theme.DSstateSeparatorColor)
property string themeStateBackground: Theme.color(Theme.DSstateBackgroundColor)
property string themeStatePreviewOutline: Theme.color(Theme.DSstatePreviewOutline)

View File

@@ -53,7 +53,6 @@ Rectangle {
property int closeButtonMargin: 6
property int textFieldMargin: 4
property int highlightBorderWidth: 2
signal delegateInteraction
@@ -165,21 +164,11 @@ Rectangle {
}
}
Rectangle { // highlight for default state
anchors.margins: (isDefaultState || (isBaseState && !modelHasDefaultState)) ? -myRoot.highlightBorderWidth : 0
anchors.fill: column
color: StudioTheme.Values.themeStateSeparator
border.color: StudioTheme.Values.themeStateDefaultHighlight
border.width: (isDefaultState || (isBaseState && !modelHasDefaultState)) ? myRoot.highlightBorderWidth : 0
}
Column {
id: column
anchors.margins: myRoot.stateMargin
anchors.fill: parent
spacing: expanded ? myRoot.columnSpacing : 0
Rectangle {
width: myRoot.width - 2 * myRoot.stateMargin
@@ -263,6 +252,13 @@ Rectangle {
}
}
Rectangle { // separator
width: column.width
height: myRoot.columnSpacing
color: StudioTheme.Values.themeStateSeparator
visible: expanded
}
Rectangle {
id: stateImageArea
width: myRoot.width - 2 * myRoot.stateMargin

View File

@@ -408,10 +408,7 @@ QFuture<ResultType> runAsync_internal(QThreadPool *pool,
QFuture<ResultType> future = job->future();
if (pool) {
job->setThreadPool(pool);
if (QThread::currentThread() == pool->thread())
pool->start(job);
else
QMetaObject::invokeMethod(pool, [pool, job]() { pool->start(job); }, Qt::QueuedConnection);
} else {
auto thread = new Internal::RunnableThread(job);
if (stackSize)

View File

@@ -4,7 +4,7 @@ if (APPLE)
endif()
add_qtc_plugin(QmlDesigner
CONDITION TARGET Qt5::QuickWidgets AND TARGET Qt5::Svg
CONDITION Qt5_VERSION VERSION_GREATER_EQUAL 6.2.0 AND TARGET Qt5::QuickWidgets AND TARGET Qt5::Svg
DEPENDS
QmlJS LanguageUtils QmlEditorWidgets AdvancedDockingSystem
Qt5::QuickWidgets Qt5::CorePrivate Sqlite Qt5::Xml Qt5::Svg

View File

@@ -81,12 +81,12 @@ QVector<GeneratableFile> queuedFiles;
void generateMenuEntry()
{
Core::ActionContainer *buildMenu =
Core::ActionManager::actionContainer(ProjectExplorer::Constants::M_BUILDPROJECT);
auto action = new QAction(QCoreApplication::translate("QmlDesigner::GenerateCmake", "Generate CMakeLists.txt Files"));
Core::ActionContainer *menu =
Core::ActionManager::actionContainer(Core::Constants::M_FILE);
auto action = new QAction(QCoreApplication::translate("QmlDesigner::GenerateCmake", "Export to Qt Creator (CMake)"));
QObject::connect(action, &QAction::triggered, GenerateCmake::onGenerateCmakeLists);
Core::Command *cmd = Core::ActionManager::registerAction(action, "QmlProject.CreateCMakeLists");
buildMenu->addAction(cmd, ProjectExplorer::Constants::G_BUILD_RUN);
menu->addAction(cmd, Core::Constants::G_FILE_EXPORT);
action->setEnabled(ProjectExplorer::SessionManager::startupProject() != nullptr);
QObject::connect(ProjectExplorer::SessionManager::instance(),

View File

@@ -195,8 +195,8 @@ QList<GenerateResource::ResourceFile> getFilesFromQrc(QFile *file, bool inProjec
void GenerateResource::generateMenuEntry()
{
Core::ActionContainer *buildMenu =
Core::ActionManager::actionContainer(ProjectExplorer::Constants::M_BUILDPROJECT);
Core::ActionContainer *menu =
Core::ActionManager::actionContainer(Core::Constants::M_FILE);
const Core::Context projectContext(QmlProjectManager::Constants::QML_PROJECT_ID);
// ToDo: move this to QtCreator and add tr to the string then
@@ -573,8 +573,8 @@ void GenerateResource::generateMenuEntry()
}
}
});
buildMenu->addAction(cmd, ProjectExplorer::Constants::G_BUILD_RUN);
buildMenu->addAction(cmd2, ProjectExplorer::Constants::G_BUILD_RUN);
menu->addAction(cmd, Core::Constants::G_FILE_EXPORT);
menu->addAction(cmd2, Core::Constants::G_FILE_EXPORT);
}
} // namespace QmlDesigner

View File

@@ -341,10 +341,16 @@ Rectangle {
x: 15
y: 65
color: "#ffffff"
text: qsTr("Community Edition")
font.pixelSize: 13
font.family: StudioFonts.titilliumWeb_light
visible: projectModel.communityVersion
text: {
if (projectModel.communityVersion)
return qsTr("Community Edition")
if (projectModel.enterpriseVersion)
return qsTr("Enterprise Edition")
return qsTr("Professional Edition")
}
ProjectModel {
id: projectModel

View File

@@ -197,6 +197,7 @@ public:
enum { FilePathRole = Qt::UserRole + 1, PrettyFilePathRole, PreviewUrl, TagData, Description };
Q_PROPERTY(bool communityVersion MEMBER m_communityVersion NOTIFY communityVersionChanged)
Q_PROPERTY(bool enterpriseVersion MEMBER m_enterpriseVersion NOTIFY enterpriseVersionChanged)
explicit ProjectModel(QObject *parent = nullptr);
@@ -273,11 +274,48 @@ public slots:
signals:
void communityVersionChanged();
void enterpriseVersionChanged();
private:
bool m_communityVersion = false;
void setupVersion();
bool m_communityVersion = true;
bool m_enterpriseVersion = false;
};
void ProjectModel::setupVersion()
{
const ExtensionSystem::PluginSpec *pluginSpec = Utils::findOrDefault(
ExtensionSystem::PluginManager::plugins(),
Utils::equal(&ExtensionSystem::PluginSpec::name, QString("LicenseChecker")));
if (!pluginSpec)
return;
ExtensionSystem::IPlugin *plugin = pluginSpec->plugin();
if (!plugin)
return;
m_communityVersion = false;
bool retVal = false;
bool success = QMetaObject::invokeMethod(plugin,
"qdsEnterpriseLicense",
Qt::DirectConnection,
Q_RETURN_ARG(bool, retVal));
if (!success) {
qWarning("Check for Qt Design Studio Enterprise License failed.");
return;
}
if (!retVal) {
qWarning("No Qt Design Studio Enterprise License. Disabling asset importer.");
return;
}
m_enterpriseVersion = true;
}
ProjectModel::ProjectModel(QObject *parent)
: QAbstractListModel(parent)
{
@@ -286,10 +324,7 @@ ProjectModel::ProjectModel(QObject *parent)
this,
&ProjectModel::resetProjects);
if (!Utils::findOrDefault(ExtensionSystem::PluginManager::plugins(),
Utils::equal(&ExtensionSystem::PluginSpec::name,
QString("LicenseChecker"))))
m_communityVersion = true;
setupVersion();
}
int ProjectModel::rowCount(const QModelIndex &) const
@@ -514,7 +549,9 @@ bool StudioWelcomePlugin::initialize(const QStringList &arguments, QString *erro
m_welcomeMode = new WelcomeMode;
m_removeSplashTimer.setSingleShot(true);
m_removeSplashTimer.setInterval(15000);
const QString splashScreenTimeoutEntry = "QML/Designer/splashScreenTimeout";
m_removeSplashTimer.setInterval(
Core::ICore::settings()->value(splashScreenTimeoutEntry, 15000).toInt());
connect(&m_removeSplashTimer, &QTimer::timeout, this, [this] { closeSplashScreen(); });
return true;
}

View File

@@ -1467,7 +1467,7 @@ QList<QTextCursor> TextEditorWidgetPrivate::generateCursorsForBlockSelection(
while (block.isValid()) {
const QString &blockText = block.text();
const int columnCount = tabSettings.columnCountForText(blockText);
if (blockSelection.anchorColumn < columnCount || blockSelection.column < columnCount) {
if (blockSelection.anchorColumn <= columnCount || blockSelection.column <= columnCount) {
const int anchor = tabSettings.positionAtColumn(blockText, blockSelection.anchorColumn);
const int position = tabSettings.positionAtColumn(blockText, blockSelection.column);
cursor.setPosition(block.position() + anchor);