Solved QtQuick.Controls.Material.impl not found
-
I'm having difficulty getting to the QuickControls2-material objects. In Designer, When I import 'QtQuick.Controls.Material' no such QML Types are made available to add to the canvas.
Separately, I 'double-clicked' on the slider.qml file in the directory C:\QT\5.12.6\mingw73_64\qml\QtQuick\Controls.2\Material. This brings up the QML file in QC and indicates that one of the iterms, "handle: SliderHandle" is undefined. It is probably in the QML module "QtQuick.Controls.Material.impl" whose import statement is also flagged "not found".
Anybody know why this might be the case, or where I can find said module (i.e., the .impl file)?
Install info:
Qt Creator 4.11.0
Based on Qt 5.14.0 (MSVC 2017, 32 bit)
From revision 017ed74400Thanks!
Joe
Built on Dec 10 2019 12:27:18 -
What import statements do you use in your QML file?
Did you add Quick Controls 2 to QT variable in qmake?
QT += quickcontrols2
Which Qt version are you building this project against? (not Qt creator version, but Qt version used in your Kit)
-
@sierdzio said in QtQuick.Controls.Material.impl not found:
QT += quickcontrols2
Thanks sierdzio for your help.
I have installed Qt 5.14.0.
I create the project. Looking for the Material QML types, I import 'QtQuick.Controls.Material 2.12' in the Design view. I have the following import statements in my QML file:
import QtQuick 2.12
import QtQuick.Window 2.12
import QtQuick.Controls.Material 2.0
import QtQuick.Controls 2.3When I hover over these in the Edit view, a bubble indicates: 'Read typeinfo files successfully'.
However, I do not have access to the Material QML types when I return to the Design window. I do have the 'QT Quick - Controls 2' sub-window that has all of those types available for dragging onto the canvas - but not Material.
I added the 'QT += quickcontrols2' statement to qmake, saved the files and closed and re-opened the project with no luck.
When I double-click on the Material 'slider' QML file in the distribution it brings it up in QC with the following:
import QtQuick 2.12
import QtQuick.Templates 2.12 as T
import QtQuick.Controls.Material 2.12
import QtQuick.Controls.Material.impl 2.12 * QML module not found (QtQuick.Controls.Material.impl).This makes me think that file is missing from my (Windows) distribution.
Thanks,
Joe
-
I found out what I was doing wrong.
Simply, a 'style' can be looked at as applying to a basic set of controls and not as it's own set of controls.
Once configured correctly (below) one simply drags the basic controls to the canvas and they retain their 'un-stylized' look. Once you build and run the program, the resulting window will show the 'stylized' QML type. In my case, a 'slider'.
To configure a Quick Controls style to work:
-
Add QT += quickcontrols2 to your project .pro file (thanks @sierdzio !)
-
Edit your main.cpp file to turn the style on (in my case 'Material'):
#include <QQuickStyle> QQuickStyle::setStyle("Material"); (in the main section)
-
Use the Design mode Imports window to add the following to the main.qml file:
import QtQuick.Controls 2.3
import QtQuick.Controls.Material 2.0 -
Add controls to the canvas as desired. Build. You will see the controls now in your chosen style.
-