Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

import Material 0.3 does nothing #468

Open
afendin opened this issue Jul 19, 2016 · 2 comments
Open

import Material 0.3 does nothing #468

afendin opened this issue Jul 19, 2016 · 2 comments

Comments

@afendin
Copy link

afendin commented Jul 19, 2016

Qt 5.7
Windows 10
What i have done step by step:
**1.**Created QtQuick Application(with git init)
**2.**git submodule add [email protected]:papyros/qml-material.git material
**3.**My pro file
`TEMPLATE = app

QT += qml quick
CONFIG += c++11

SOURCES += main.cpp

RESOURCES += qml.qrc

DEFINES += QPM_INIT(E)="E.addImportPath(QStringLiteral(\"qrc:/\"));"

Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH =

Default rules for deployment.
include(deployment.pri)
include(material/material.pri)
`

4. My main.cpp file

`#include QGuiApplication

include QQmlApplicationEngine

int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);

QQmlApplicationEngine engine;
QPM_INIT(engine)
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));

return app.exec();

}
`

5. import Material 0.3 does not work

what's wrong?

@alexhochreiter
Copy link

alexhochreiter commented Aug 8, 2016

Because of #442 you should replace
QPM_INIT(engine)
with
engine.addImportPath("qrc:/Material");
But let me guess, it still won't work?
Can you please edit your main.cpp file to check if the qmldir of Material is beeing at the right place at all?

int main(int argc, char *argv[]) {
    QApplication app(argc, argv);

    QFile f(":/Material/qmldir");
    f.open(QIODevice::ReadOnly);
    qDebug() << f.readAll();

    QQmlApplicationEngine engine;
    engine.addImportPath("qrc:/Material");
    engine.load(QUrl(QStringLiteral("qrc:/main.qml")));

    return app.exec();
}

Then it should also be enough to just define QPM_INITin your .pro file
DEFINES += QPM_INIT

@afendin
Copy link
Author

afendin commented Aug 9, 2016

thanks sir, i'm currently using QtQuick.Controls.Material 2.0 and everything ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants