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 Camera problem
Qt 6.11 is out! See what's new in the release blog

QML Camera problem

Scheduled Pinned Locked Moved QML and Qt Quick
6 Posts 3 Posters 3.4k 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.
  • L Offline
    L Offline
    Lucijan
    wrote on last edited by
    #1

    Hello,

    I have problems trying to use the QML QtMultimedia Camera but the program just crashes and displays a Messagebox:

    bq. This application has requested the Runtime to terminate it in an unusual way.
    Please contact the application's support team for more information.

    The Application Output window displays the message:

    bq. QWidget: Cannot create a QWidget without QApplication
    Invalid parameter passed to C runtime function.
    Invalid parameter passed to C runtime function.
    D:\Qt\Programs\build-untitled5-Desktop_Qt_5_1_0_MinGW_32bit-Release\release\untitled5.exe exited with code 3

    Here's the program:

    @import QtQuick 2.0
    import QtMultimedia 5.0

    Rectangle {
    width: 360
    height: 360
    color: "lightgrey"

    Camera {
        id: bla
    }
    

    }
    @

    I can't seem to find anything on this problem. The webcam works fine. The platform is Win7 x64 and Qt 5.1 with MinGW.

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      First problem are problably some missing dependencies, search for it: I've seen it happen to many people before with MinGW. I don't know the solution myself, I'm mostly on Linux.

      For the second one, please post relevant parts of your code, especially where your main() function is.

      (Z(:^

      1 Reply Last reply
      0
      • L Offline
        L Offline
        Lucijan
        wrote on last edited by
        #3

        Dependencies? I didn't think this could happen if the program is run from QtCreator. I know it can happen if I try to run the program outside of QtCreator, but this is not what I'm doing.

        As for the code, I didn't change anything from what Qt generates for a Qt Quick 2 program.

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          Something is clearly wrong. I won't help you by using my magic wand, though. You either need to check it yourself, or post more info...

          (Z(:^

          1 Reply Last reply
          0
          • mranger90M Offline
            mranger90M Offline
            mranger90
            wrote on last edited by
            #5

            This is a coincidence. I just ran into this one myself. Make sure that in your driver main.cpp the app is a QApplication, NOT a QGuiApplication. Oddly, a QGuiApplication will work in Linux, but not under Win7. I think it probably has to do with what kind of widget gets generated for the underlying camera interface, i.e. DirectShow in Windows.

            1 Reply Last reply
            0
            • L Offline
              L Offline
              Lucijan
              wrote on last edited by
              #6

              main.cpp

              @#include <QtGui/QGuiApplication>
              #include "qtquick2applicationviewer.h"

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

              QtQuick2ApplicationViewer viewer;
              viewer.setMainQmlFile&#40;QStringLiteral("qml/untitled5/main.qml"&#41;);
              viewer.showExpanded();
              
              return app.exec();
              

              }
              @

              .pro

              @# Add more folders to ship with the application, here
              folder_01.source = qml/untitled5
              folder_01.target = qml
              DEPLOYMENTFOLDERS = folder_01

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

              QML_IMPORT_PATH =

              If your application uses the Qt Mobility libraries, uncomment the following

              lines and add the respective components to the MOBILITY variable.

              CONFIG += mobility

              MOBILITY +=

              The .cpp file which was generated for your project. Feel free to hack it.

              SOURCES += main.cpp

              Installation path

              target.path =

              Please do not modify the following two lines. Required for deployment.

              include(qtquick2applicationviewer/qtquick2applicationviewer.pri)
              qtcAddDeployment()

              OTHER_FILES +=
              android/AndroidManifest.xml
              android/res/layout/splash.xml
              android/res/values/libs.xml
              android/res/values/strings.xml
              android/res/values-de/strings.xml
              android/res/values-el/strings.xml
              android/res/values-es/strings.xml
              android/res/values-et/strings.xml
              android/res/values-fa/strings.xml
              android/res/values-fr/strings.xml
              android/res/values-id/strings.xml
              android/res/values-it/strings.xml
              android/res/values-ja/strings.xml
              android/res/values-ms/strings.xml
              android/res/values-nb/strings.xml
              android/res/values-nl/strings.xml
              android/res/values-pl/strings.xml
              android/res/values-pt-rBR/strings.xml
              android/res/values-ro/strings.xml
              android/res/values-rs/strings.xml
              android/res/values-ru/strings.xml
              android/res/values-zh-rCN/strings.xml
              android/res/values-zh-rTW/strings.xml
              android/src/org/kde/necessitas/ministro/IMinistro.aidl
              android/src/org/kde/necessitas/ministro/IMinistroCallback.aidl
              android/src/org/qtproject/qt5/android/bindings/QtActivity.java
              android/src/org/qtproject/qt5/android/bindings/QtApplication.java
              android/version.xml
              @

              In addition to switching from QGuiApplication to QApplication, it's also necessary to add QT += widgets to the .pro file.

              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