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. Qml cannot install my private module while building
Qt 6.11 is out! See what's new in the release blog

Qml cannot install my private module while building

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 2 Posters 1.6k Views 1 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.
  • O Offline
    O Offline
    oksidez
    wrote on last edited by
    #1

    Hello everyone im stuck with this, i believe there is no syntax error and i will just simply paste my code here to explain;

    execom.h
    @#ifndef EXECOM
    #define EXECOM
    #include <QObject>

    class Execom : public QObject
    {
    Q_OBJECT

    public:
    Execom(QObject *parent = 0);
    signals:

    public slots:
    void runcom(const char *cmd);
    };
    #endif // EXECOM
    @

    execom.cpp
    @
    #include <execom.h>
    #include <stdlib.h>
    #include <unistd.h>

    Execom::Execom(QObject *parent):
    QObject(parent)
    {}

    void Execom::runcom(const char *cmd){

     system&#40;cmd&#41;;
    

    }
    @

    main.cpp
    @
    #include <QApplication>
    #include <QQmlApplicationEngine>

    #include "execom.h"
    #include <QtQml>

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

    QQmlApplicationEngine engine;
    engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
    
    
    qmlRegisterType<Execom>("Komut",1,0,"Execom");
    
    
    
    return app.exec&#40;&#41;;
    

    }
    @

    main.qml
    @
    import QtQuick 2.4
    import QtQuick.Controls 1.3
    import QtQuick.Window 2.2
    import QtQuick.Dialogs 1.2
    import Komut 1.0 // according to error this modul is not installed

    ApplicationWindow {

    ...

    Execom
    {
    id:kod

    }
    MainForm {
        anchors.fill: parent
        button1.onClicked: fileDialog.open(&#41;
        
        button2.onClicked: {
    
    
            command+="tiff2pdf -o /home/stajer/Masaüstü/output.pdf "+texturl
            console.log(""+command)
    
            kod.runcom(command)
            messageDialog.show(qsTr("Button 2 pressed"))
        }
    
    }
    

    FileDialog {

    ...

    @

    the pro file
    @
    TEMPLATE = app

    QT += qml quick widgets

    SOURCES += main.cpp
    execom.cpp

    RESOURCES += qml.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)

    HEADERS +=
    execom.h
    @

    and the error is this :

    QQmlApplicationEngine failed to load component
    qrc:/main.qml:5 module "Komut" is not installed

    I really can use your help.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      IIRC you should register your types before loading your qml file

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      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