Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.1k Topics 77.6k Posts
  • Binding in a looping Sequential Animation doesn't work?

    1
    0 Votes
    1 Posts
    621 Views
    No one has replied
  • 'Repeater' not displaying the data from its DataModel in fetched sequence

    1
    0 Votes
    1 Posts
    563 Views
    No one has replied
  • Extending QML - When is the parent set?

    10
    0 Votes
    10 Posts
    5k Views
    J
    The itemchange() method informs you when the parent is set. @RenderWindow::itemChange( ItemChange change, const ItemChangeData& value ) { switch ( change ) { case QQuickItem::ItemParentHasChanged: // value.item and parent() both contain the new parent } }@
  • Implementing filedownloader to QML

    2
    0 Votes
    2 Posts
    814 Views
    S
    Hi, in your example code you do: @void FileDownloader::fileDownloaded(QNetworkReply* pReply) { qDebug()<<"Download successful!"; m_DownloadedData = pReply->readAll(); QFile file("D:\Test.jpg"); file.open(QIODevice::WriteOnly); file.write(pReply->readAll()); //emit a signal pReply->deleteLater(); emit downloaded(); } @ the line "m_DownloadedData = pReply->readAll();" creates this issue, after this line, the buffer of your network reply is empty, and the data is inside "m_DownloadedData" a few lines lower, you try to save the image by doing: "file.write(pReply->readAll());" but the buffer is already empty... so you shoud do: "file.write( m_DownloadedData );" i should do, @ void FileDownloader::fileDownloaded(QNetworkReply* pReply) { qDebug()<<"Download successful!"; QFile file("D:\Test.jpg"); if( !file.open(QIODevice::WriteOnly) ) return; // file could not be created file.write(pReply->readAll()); //emit a signal pReply->deleteLater(); emit downloaded(); } @ and remove the variable "m_DownloadedData" for your second issue, you also have to include the macro QML_DECLARE_TYPE(CLASSNAME) in your header file, before you can use the qmlRegisterType method. so: @ //filedownloader.h #ifndef FILEDOWNLOADER_H #define FILEDOWNLOADER_H #include <QtQml> // add for QML_DECLARE_TYPE macro !!!!! #include <QObject> #include <QByteArray> #include <QNetworkAccessManager> #include <QNetworkRequest> #include <QNetworkReply> class FileDownloader : public QObject { Q_OBJECT public: explicit FileDownloader(QUrl imageUrl, QObject *parent = 0); virtual ~FileDownloader(); QByteArray downloadedData() const; signals: void downloaded(); private slots: void fileDownloaded(QNetworkReply* pReply); private: QNetworkAccessManager m_WebCtrl; QByteArray m_DownloadedData; }; QML_DECLARE_TYPE( FileDownloader ) // marco !! #endif // FILEDOWNLOADER_H @
  • When is the gl context set?

    1
    0 Votes
    1 Posts
    565 Views
    No one has replied
  • Assign C++ object to Text element (implicit conversion to QString)

    5
    0 Votes
    5 Posts
    2k Views
    S
    Hi JKSH, thank you very much.
  • Using QtQuick Location Map with C++ QGeoMap* items

    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • Set Direction for ParallelAnimation or PropertyAnimation

    2
    0 Votes
    2 Posts
    711 Views
    p3c0P
    Well after searching i didnt get anything equivalent directly in ParallelAnimation or PropertyAnimation But seems that this can be achieved using Transitions and States.
  • Getting the opengl context for sharing

    1
    0 Votes
    1 Posts
    617 Views
    No one has replied
  • 0 Votes
    4 Posts
    2k Views
    A
    Anyone find a way to set NativeRendering App wide?
  • QtQuick2: Drag and Drop between two ListViews

    2
    0 Votes
    2 Posts
    1k Views
    B
    Hi, I'm actually looking at something similare, did you get anywhere ?
  • QML TextEdit with RichText problem mixing text and image tag

    2
    0 Votes
    2 Posts
    2k Views
    A
    No one knows a solution?!
  • Kinetic Motion with Deceleration

    3
    0 Votes
    3 Posts
    998 Views
    J
    My first try was to poke around at Flickables, but these don't quick work that way. For the time being I've gone with the deceleration animations. It's not ideal, but it's simple and good enough so far. Box2D does look like the ideal. My understanding is that this is Quick 1.0 for the time being though and I'd like to stay in 2.0. In the end this is really the direction I want to go though. Thanks, -Jake
  • Control/update the Qt Quick QML text element from C++

    7
    0 Votes
    7 Posts
    7k Views
    M
    I think I will stick to QmlApplicationViewer unless someone will tell me this is not a right way. Board: i.mx6 by Boundary Devices I did try runing it on PC with same result. I am almost certain that I need to connect the GUI text object with the MyDisplay object in C++ code, however I am stuck with syntax. I am also not sure in which part of the code should the "connect" statement be placed. Here is the main.cpp. The displayTime.setText("XXXXXXXX"); works correctly because the next line spits out the right output on the debug console. However the QML text object is still blank. @int main(int argc, char * argv[]) { QScopedPointer<QApplication> app(createApplication(argc, argv)); QmlApplicationViewer viewer; MyPlayer player(&viewer); MyDisplay displayTime; player.setDisplay(&displayTime); viewer.rootContext()->setContextProperty("myQmlTest", &player); viewer.rootContext()->setContextProperty("displayTime", &displayTime); viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); viewer.setMainQmlFile&#40;QLatin1String("qml/QtPlayer3/main.qml"&#41;); viewer.showExpanded(); viewer.showFullScreen(); player.myGSTint(); // init GStreamer displayTime.setText("XXXXXXXX"); qDebug() << "This is a test: " << displayTime.getText(); return app->exec&#40;&#41;; }@ ...and the QML section @ Text { id: time //text: "none" color: "#999999" font.pixelSize: 30 anchors.topMargin: 90 anchors.top: parent.top anchors.horizontalCenter: parent.horizontalCenter text: displayTime.getText() }@ and the MyDisplay class @MyDisplay::MyDisplay() { newText = ""; } MyDisplay::MyDisplay(QString text) { newText = text; } QString MyDisplay::getText() const { return newText; } void MyDisplay::setText(const QString &text) { if (text != newText) { newText = text; emit textChanged(text); } }@
  • TExt Rendering : Spaces appears betxeen characters according to the scale

    1
    0 Votes
    1 Posts
    640 Views
    No one has replied
  • Resize and move windows fails

    1
    0 Votes
    1 Posts
    790 Views
    No one has replied
  • Changing State of a Component from another Component

    2
    0 Votes
    2 Posts
    692 Views
    Q
    Hi awais. Welcome to devnet. Take a look to a signals and slots: "signalsandslots":http://qt-project.org/doc/qt-5.0/qtcore/signalsandslots.html
  • Expose QComboBox to QML

    11
    0 Votes
    11 Posts
    3k Views
    P
    Then this is a very awkward implementation on Qt side. Nowhere else (in Windows) a popup menu is used for Combo Dropdowns, for obvious reasons. Menus are not (easily) scrollable.
  • <SOLVED> Changing QML properties in C++

    4
    0 Votes
    4 Posts
    4k Views
    sierdzioS
    No worries :) QML requires a bit different way of thinking than C++, which makes connecting it to C++ a bit tricky even for experienced users. If you need some hardcore example of QtQuick, feel free to browse my CCF project ("link":https://github.com/sierdzio/closecombatfree).
  • Problem with deployment on windows [solved]

    15
    0 Votes
    15 Posts
    4k Views
    SGaistS
    You're welcome ! Well... That's the case for numerous software, they are not very heavy but the libraries they use might be (without mentioning the possible runtime dependencies such as drivers/external libraries etc...) You could always rebuild Qt to suite your needs disabling what you don't use (time intensive and error prone) or go the static route BUT this one introduces some constraints such as having a commercial license from Digia. Also, don't forget to update the thread title prepending [solved] so other forum users may know a solution has been found :)