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. C++ to change QML object properties
Forum Updated to NodeBB v4.3 + New Features

C++ to change QML object properties

Scheduled Pinned Locked Moved QML and Qt Quick
57 Posts 4 Posters 44.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.
  • V Offline
    V Offline
    Vignes
    wrote on last edited by
    #48

    Hi, I want to detect .bin file on load and call a function in qml. I mange to do the follow code.
    @
    onAccepted: {
    var str = openFile.fileUrl;
    var rx = /.bin/;
    if(rx.test(str)){
    urlCpp(str);
    }
    else {
    imageViewer.source = str;
    }
    }
    @

    But I am looking for full QML RegExp reference list. I couldn't locate it on http://qt-project.org/. Could you let me know the url for QML RegExp reference please.
    Thank you.

    1 Reply Last reply
    0
    • jeremy_kJ Offline
      jeremy_kJ Offline
      jeremy_k
      wrote on last edited by
      #49

      I find the w3schools.com javascript reference to be pretty good for js portion of QML.

      http://www.w3schools.com/jsref/jsref_obj_regexp.asp

      Asking a question about code? http://eel.is/iso-c++/testcase/

      1 Reply Last reply
      0
      • p3c0P Offline
        p3c0P Offline
        p3c0
        Moderators
        wrote on last edited by
        #50

        You can extract the filename extension using split and then compare
        @
        var f = "myfile.bin"
        console.log(f.split('.').pop())
        @

        157

        1 Reply Last reply
        0
        • V Offline
          V Offline
          Vignes
          wrote on last edited by
          #51

          Hi,
          I tried to test QtAV examples (downloaded the ZIP file), but I couldn't get them build. I even tried the following link https://github.com/wang-bin/QtAV/wiki/Use-QtAV-In-Your-Projects
          I couldn't get it build.
          There is qml example code :
          @import QtQuick 2.0
          import QtAV 1.3
          Item {
          VideoOutput {
          anchors.fill: parent
          source: player
          }
          AVPlayer { //or MediaPlayer
          id: player
          source: "test.mp4"
          }
          MouseArea {
          anchors.fill: parent
          onClicked: player.play()
          }
          }@

          • If I want to get this to work, what should I do?
          • If I were to add new video decoder format e.g H.265, where should I add?

          Thanks

          1 Reply Last reply
          0
          • p3c0P Offline
            p3c0P Offline
            p3c0
            Moderators
            wrote on last edited by
            #52

            Since this is a completely new topic now than the original one I would suggest you to create a new Post, add there what you have done and what errors do you get on compiling plus your new questions related to it.

            157

            1 Reply Last reply
            0
            • V Offline
              V Offline
              Vignes
              wrote on last edited by
              #53

              Hi,
              I have an issue that is related to Mac OS. In QML, I am setting the window flag to "SplashScreen" at starting point then after one second, I change the window flag to "Window". This second change course the contents inside the window to disappear. But the same code on MS Windows works fine (contents does not disappear).

              I want the window start without frame then after a second frame appears.

              Is it possible to solve this issue?

              Thanks

              1 Reply Last reply
              0
              • V Offline
                V Offline
                Vignes
                wrote on last edited by
                #54

                Hi,
                I have an issue that is related to Mac OS. In QML, I am setting the window flag to "SplashScreen" at starting point then after one second, I change the window flag to "Window". This second change course the contents inside the window to disappear. But the same code on MS Windows works fine (contents does not disappear).

                I want the window start without frame then after a second frame appears.

                Is it possible to solve this issue?

                Thanks

                1 Reply Last reply
                0
                • p3c0P Offline
                  p3c0P Offline
                  p3c0
                  Moderators
                  wrote on last edited by
                  #55

                  I'm not quite sure about this one as I don't have Mac OS to try this. But since it works on Windows and not on Mac it could probably a bug. You can report it on "Qt Bug Tracker":https://bugreports.qt.io.

                  157

                  1 Reply Last reply
                  0
                  • p3c0P Offline
                    p3c0P Offline
                    p3c0
                    Moderators
                    wrote on last edited by
                    #56

                    I'm not quite sure about this one as I don't have Mac OS to try this. But since it works on Windows and not on Mac it could probably a bug. You can report it on "Qt Bug Tracker":https://bugreports.qt.io.

                    157

                    1 Reply Last reply
                    0
                    • p3c0P p3c0

                      Please encapulate your code in the code tags '@@' so that its easily readable to others.

                      You should either use QQmlApplicationEngine or QQuickView not both.
                      If using QQmlApplicationEngine you can try
                      @
                      QGuiApplication app(argc, argv);
                      QQmlApplicationEngine engine;
                      engine.load(QUrl(QStringLiteral("qrc:///main.qml")));
                      QQuickItem item = engine.rootObjects().at(0)->findChild<QQuickItem>("myRect");
                      if (item) {
                      item->setProperty("color", QColor(Qt::yellow));
                      }
                      return app.exec();
                      @

                      S Offline
                      S Offline
                      sagarbade
                      wrote on last edited by
                      #57

                      @p3c0 said in C++ to change QML object properties:

                      myRect

                      hello ..i have question related this topic ..i have 2 qml pages main.qml and mynew.qml
                      in my main.cpp i load main.qml page and execute and main.qml have sack view and in this stack i push mynew.qml in mynew.qml page one button for start thread scanner.cpp and one label for display result coming from thread ....now the question is i want to pass signel from thread to set label text in mynew.qml

                      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