Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Custom controls based on material are not loaded

Custom controls based on material are not loaded

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 1 Posters 316 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    adutzu89
    wrote on last edited by
    #1

    Hello,
    I'm trying to build my own custom controls toolkit for my applications, based on Material design, but I cannot seem to be able to load it.
    I have tried even replicating the example from here: https://doc.qt.io/archives/qt-5.11/qtquickcontrols2-fileselectors.html
    The application still loads :/CustomButton.qml and not :/+material/CustomButton.qml.
    As a side test :/+unix/CustomButton.qml is loaded (as I am using Linux).
    I am loading the Material style from main.cpp, but tried using qtquickcontrols2.conf without succes either:

    #include <QGuiApplication>
    #include <QQmlApplicationEngine>
    #include <QQuickStyle>
    int main(int argc, char *argv[]) {
        QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
        QQuickStyle::setStyle("Material");
    
        QGuiApplication app(argc, argv);
    
        QQmlApplicationEngine engine;
        const QUrl url(QStringLiteral("qrc:/main.qml"));#include <QGuiApplication>
        #include <QQmlApplicationEngine>
        #include <QQuickStyle>
        QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
                         &app, [url](QObject *obj, const QUrl &objUrl) {
            if (!obj && url == objUrl)
                QCoreApplication::exit(-1);
        }, Qt::QueuedConnection);
        engine.load(url);
    
        return app.exec();
    }
    

    Any ideeas what am I doing wrong?
    System: KDE Neon, based on Ubuntu 18.04, x64.
    Qt version: 5.12.5.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      adutzu89
      wrote on last edited by adutzu89
      #2

      Don't know what happened, but now it works, after a restart of the computer.
      It partially works, I decided to import the sub-folder directly using import "+theme"

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved