Fix uic/rcc generating outdated export for Qt for Python
Bump version to 6. Fixes: QTBUG-89124 Change-Id: Ifcf60552b5b6efb86f79da34da9c34b8efae9fa4 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> (cherry picked from commit fc9cda5f08ac848e88f63dd4a07c08b2fbc6bf17) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
be61909248
commit
539a16a69f
@ -1112,7 +1112,7 @@ bool RCCResourceLibrary::writeHeader()
|
|||||||
writeByteArray(QT_VERSION_STR);
|
writeByteArray(QT_VERSION_STR);
|
||||||
writeString("\n");
|
writeString("\n");
|
||||||
writeString("# WARNING! All changes made in this file will be lost!\n\n");
|
writeString("# WARNING! All changes made in this file will be lost!\n\n");
|
||||||
writeString("from PySide2 import QtCore\n\n");
|
writeString("from PySide6 import QtCore\n\n");
|
||||||
break;
|
break;
|
||||||
case Binary:
|
case Binary:
|
||||||
writeString("qres");
|
writeString("qres");
|
||||||
|
@ -39,9 +39,9 @@
|
|||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
static const char *standardImports =
|
static const char *standardImports =
|
||||||
R"I(from PySide2.QtCore import *
|
R"I(from PySide6.QtCore import *
|
||||||
from PySide2.QtGui import *
|
from PySide6.QtGui import *
|
||||||
from PySide2.QtWidgets import *
|
from PySide6.QtWidgets import *
|
||||||
)I";
|
)I";
|
||||||
|
|
||||||
// Change the name of a qrc file "dir/foo.qrc" file to the Python
|
// Change the name of a qrc file "dir/foo.qrc" file to the Python
|
||||||
@ -113,17 +113,17 @@ void WriteImports::acceptCustomWidget(DomCustomWidget *node)
|
|||||||
return; // Exclude namespaced names (just to make tests pass).
|
return; // Exclude namespaced names (just to make tests pass).
|
||||||
const QString &importModule = qtModuleOf(node);
|
const QString &importModule = qtModuleOf(node);
|
||||||
auto &output = m_uic->output();
|
auto &output = m_uic->output();
|
||||||
// For starting importing PySide2 modules
|
// For starting importing PySide6 modules
|
||||||
if (!importModule.isEmpty()) {
|
if (!importModule.isEmpty()) {
|
||||||
output << "from ";
|
output << "from ";
|
||||||
if (importModule.startsWith(QLatin1String("Qt")))
|
if (importModule.startsWith(QLatin1String("Qt")))
|
||||||
output << "PySide2.";
|
output << "PySide6.";
|
||||||
output << importModule;
|
output << importModule;
|
||||||
if (!className.isEmpty())
|
if (!className.isEmpty())
|
||||||
output << " import " << className << "\n\n";
|
output << " import " << className << "\n\n";
|
||||||
} else {
|
} else {
|
||||||
// When the elementHeader is not set, we know it's the continuation
|
// When the elementHeader is not set, we know it's the continuation
|
||||||
// of a PySide2 import or a normal import of another module.
|
// of a PySide6 import or a normal import of another module.
|
||||||
if (!node->elementHeader() || node->elementHeader()->text().isEmpty()) {
|
if (!node->elementHeader() || node->elementHeader()->text().isEmpty()) {
|
||||||
output << "import " << className << '\n';
|
output << "import " << className << '\n';
|
||||||
} else { // When we do have elementHeader, we know it's a relative import.
|
} else { // When we do have elementHeader, we know it's a relative import.
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
# Created by: The Resource Compiler for Qt version 6.0.0
|
# Created by: The Resource Compiler for Qt version 6.0.0
|
||||||
# WARNING! All changes made in this file will be lost!
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
from PySide2 import QtCore
|
from PySide6 import QtCore
|
||||||
|
|
||||||
qt_resource_data = b"\
|
qt_resource_data = b"\
|
||||||
\x00\x00\x00#\
|
\x00\x00\x00#\
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
# Created by: The Resource Compiler for Qt version 6.0.0
|
# Created by: The Resource Compiler for Qt version 6.0.0
|
||||||
# WARNING! All changes made in this file will be lost!
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
from PySide2 import QtCore
|
from PySide6 import QtCore
|
||||||
|
|
||||||
qt_resource_data = b"\
|
qt_resource_data = b"\
|
||||||
\x00\x00\x00#\
|
\x00\x00\x00#\
|
||||||
|
@ -36,9 +36,9 @@
|
|||||||
## WARNING! All changes made in this file will be lost when recompiling UI file!
|
## WARNING! All changes made in this file will be lost when recompiling UI file!
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
from PySide2.QtCore import *
|
from PySide6.QtCore import *
|
||||||
from PySide2.QtGui import *
|
from PySide6.QtGui import *
|
||||||
from PySide2.QtWidgets import *
|
from PySide6.QtWidgets import *
|
||||||
|
|
||||||
from gammaview import GammaView
|
from gammaview import GammaView
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ static QByteArray msgProcessStartFailed(const QString &command, const QString &w
|
|||||||
return result.toLocal8Bit();
|
return result.toLocal8Bit();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Locate Python and check whether PySide2 is installed
|
// Locate Python and check whether PySide6 is installed
|
||||||
static QString locatePython(QTemporaryDir &generatedDir)
|
static QString locatePython(QTemporaryDir &generatedDir)
|
||||||
{
|
{
|
||||||
QString python = QStandardPaths::findExecutable(QLatin1String("python"));
|
QString python = QStandardPaths::findExecutable(QLatin1String("python"));
|
||||||
@ -128,7 +128,7 @@ static QString locatePython(QTemporaryDir &generatedDir)
|
|||||||
QFile importTestFile(generatedDir.filePath(QLatin1String("import_test.py")));
|
QFile importTestFile(generatedDir.filePath(QLatin1String("import_test.py")));
|
||||||
if (!importTestFile.open(QIODevice::WriteOnly| QIODevice::Text))
|
if (!importTestFile.open(QIODevice::WriteOnly| QIODevice::Text))
|
||||||
return QString();
|
return QString();
|
||||||
importTestFile.write("import PySide2.QtCore\n");
|
importTestFile.write("import PySide6.QtCore\n");
|
||||||
importTestFile.close();
|
importTestFile.close();
|
||||||
QProcess process;
|
QProcess process;
|
||||||
process.start(python, {importTestFile.fileName()});
|
process.start(python, {importTestFile.fileName()});
|
||||||
@ -136,7 +136,7 @@ static QString locatePython(QTemporaryDir &generatedDir)
|
|||||||
return QString();
|
return QString();
|
||||||
if (process.exitStatus() != QProcess::NormalExit || process.exitCode() != 0) {
|
if (process.exitStatus() != QProcess::NormalExit || process.exitCode() != 0) {
|
||||||
const QString stdErr = QString::fromLocal8Bit(process.readAllStandardError()).simplified();
|
const QString stdErr = QString::fromLocal8Bit(process.readAllStandardError()).simplified();
|
||||||
qWarning("PySide2 is not installed (%s)", qPrintable(stdErr));
|
qWarning("PySide6 is not installed (%s)", qPrintable(stdErr));
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
importTestFile.remove();
|
importTestFile.remove();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user