Controls: Move QtQuick.Controls.impl import to QtQuick.Controls.Basic
We want it to be available in all the individual styles, not only if you import QtQuick.Controls. Fixes: QTBUG-104768 Fixes: QTBUG-109299 Pick-to: 6.5 Change-Id: Id483ee9f721e0c820bed638702a4a8aced759063 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
This commit is contained in:
parent
0cd146b4b0
commit
4cbc25f379
|
@ -12,8 +12,6 @@ qt_internal_add_qml_module(QuickControls2
|
|||
DESIGNER_SUPPORTED
|
||||
CLASS_NAME QtQuickControls2Plugin
|
||||
PLUGIN_TARGET qtquickcontrols2plugin
|
||||
IMPORTS
|
||||
QtQuick.Controls.impl/auto
|
||||
OPTIONAL_IMPORTS
|
||||
QtQuick.Controls.Fusion/auto
|
||||
QtQuick.Controls.Material/auto
|
||||
|
|
|
@ -155,6 +155,8 @@ qt_internal_add_qml_module(qtquickcontrols2basicstyleplugin
|
|||
CLASS_NAME QtQuickControls2BasicStylePlugin
|
||||
DEPENDENCIES
|
||||
QtQuick/auto
|
||||
IMPORTS
|
||||
QtQuick.Controls.impl/auto
|
||||
PLUGIN_TARGET qtquickcontrols2basicstyleplugin
|
||||
NO_PLUGIN_OPTIONAL
|
||||
NO_GENERATE_PLUGIN_SOURCE
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include <QtQuickControls2/qquickstyle.h>
|
||||
#include <QtQuickControls2/private/qquickstyle_p.h>
|
||||
#include <QtQuickControls2Impl/private/qquickiconlabel_p.h>
|
||||
#include <QtQuickControlsTestUtils/private/qtest_quickcontrols_p.h>
|
||||
|
||||
class tst_StyleImports : public QQmlDataTest
|
||||
{
|
||||
|
@ -34,6 +35,9 @@ private slots:
|
|||
|
||||
void fallbackStyleShouldNotOverwriteTheme_data();
|
||||
void fallbackStyleShouldNotOverwriteTheme();
|
||||
|
||||
void attachedTypesAvailable_data();
|
||||
void attachedTypesAvailable();
|
||||
};
|
||||
|
||||
tst_StyleImports::tst_StyleImports()
|
||||
|
@ -241,6 +245,54 @@ void tst_StyleImports::fallbackStyleShouldNotOverwriteTheme()
|
|||
QCOMPARE(contentItem->color(), expectedContentItemColor);
|
||||
}
|
||||
|
||||
void tst_StyleImports::attachedTypesAvailable_data()
|
||||
{
|
||||
QTest::addColumn<QString>("import");
|
||||
|
||||
// QtQuick.Controls import.
|
||||
QTest::newRow("Controls") << "";
|
||||
|
||||
const QStringList styles = testStyles();
|
||||
for (const QString &styleImport : styles)
|
||||
QTest::newRow(qPrintable(styleImport)) << styleImport;
|
||||
}
|
||||
|
||||
void tst_StyleImports::attachedTypesAvailable()
|
||||
{
|
||||
QFETCH(QString, import);
|
||||
|
||||
// If it's QtQuick.Controls, don't prepend anything.
|
||||
if (!import.isEmpty())
|
||||
import.prepend(QLatin1Char('.'));
|
||||
|
||||
// Should not warn about missing types.
|
||||
QTest::failOnWarning(QRegularExpression(".?"));
|
||||
|
||||
QQmlEngine engine;
|
||||
QQmlComponent c(&engine);
|
||||
c.setData(QString::fromLatin1(R"(
|
||||
import QtQuick
|
||||
import QtQuick.Controls%1
|
||||
|
||||
Item {
|
||||
SplitView {
|
||||
handle: Rectangle {
|
||||
opacity: SplitHandle.hovered || SplitHandle.pressed ? 1.0 : 0.0
|
||||
}
|
||||
Item {} // Need these to ensure the handle is actually created, otherwise we won't get warnings.
|
||||
Item {}
|
||||
}
|
||||
|
||||
Dialog {
|
||||
anchors.centerIn: Overlay.overlay
|
||||
}
|
||||
}
|
||||
)").arg(import).toLatin1(), QUrl());
|
||||
QVERIFY2(c.isReady(), qPrintable(c.errorString()));
|
||||
QScopedPointer<QObject> o(c.create());
|
||||
QVERIFY(!o.isNull());
|
||||
}
|
||||
|
||||
QTEST_MAIN(tst_StyleImports)
|
||||
|
||||
#include "tst_styleimports.moc"
|
||||
|
|
Loading…
Reference in New Issue