Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.0k Topics 77.3k Posts
  • QML focus iteating with QPlatformInputContext

    1
    0 Votes
    1 Posts
    857 Views
    No one has replied
  • Draw without paintevent

    2
    0 Votes
    2 Posts
    776 Views
    p3c0P
    Hi, Do you mean you want to draw an ellipse without paint() ? What is your class derived from ? Also to call a function from QML you need to register your class and make the function "Q_INVOKABLE":http://qt-project.org/doc/qt-5/qobject.html#Q_INVOKABLE
  • Usage of setContextProperty

    11
    0 Votes
    11 Posts
    5k Views
    ?
    Yes you are right. Qt creator is not able to highlight the context property's name during compile time. But in runtime it works fine. I was trying to find a solution to remove this warning during compile time. But still i didn't find a right soln. I think usage of QStringLiteral will solve this issue in unicode enabled settings.
  • Updating qml child label element text after completing a function in C++

    4
    0 Votes
    4 Posts
    3k Views
    jeremy_kJ
    Another approach is to declare a property in C++ object, register the class or an instance with the QML engine, and emit the property's update signal when the value should be re-read from QML.
  • What is the QML equivalent of QDataWidgetMapper?

    1
    1 Votes
    1 Posts
    961 Views
    No one has replied
  • Using custom QSqlTableModel from QT Quick QML file

    4
    0 Votes
    4 Posts
    2k Views
    SGaistS
    Hi and welcome to devnet, It requires a little more work than that. Have a look at this "wiki entry":http://qt-project.org/wiki/How_to_use_a_QSqlQueryModel_in_QML
  • How to emit signal with variable as reference from qml to c++

    2
    0 Votes
    2 Posts
    1k Views
    M
    Hi there. I came up with a quick example that does what you want but with strings instead. Should follow the same concept for objects. main.qml @import QtQuick 2.0 Item { width: 800 height: 600 signal listSignal(var list) property variant stringList: ["one", "two", "three"] Timer { interval: 2000 onTriggered: listSignal(stringList) running: true } } @ main.cpp @#include <QtGui/QGuiApplication> #include "qtquick2applicationviewer.h" #include "signalcatcher.h" int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); QtQuick2ApplicationViewer viewer; viewer.setMainQmlFile&#40;QStringLiteral("qml/Testing/main.qml"&#41;); viewer.showExpanded(); SignalCatcher signalCatcher(viewer.rootObject()); return app.exec(); } @ signalcatcher.h @#ifndef SIGNALCATCHER_H #define SIGNALCATCHER_H #include <QObject> #include <QVariant> class QQuickItem; class SignalCatcher : public QObject { Q_OBJECT public: SignalCatcher(QQuickItem *rootItem, QObject *parent = NULL); private slots: void processList(const QVariant &var); }; #endif // SIGNALCATCHER_H @ signalcatcher.cpp @#include <QQuickItem> #include "signalcatcher.h" SignalCatcher::SignalCatcher(QQuickItem *rootItem, QObject *parent) : QObject(parent) { connect(rootItem, SIGNAL(listSignal(QVariant)), this, SLOT(processList(QVariant))); } void SignalCatcher::processList(const QVariant &var) { QStringList list = var.toStringList(); for(int i = 0; i < list.size(); i++) { qDebug(list[i].toStdString().c_str()); } } @
  • Event handling

    2
    0 Votes
    2 Posts
    912 Views
    M
    Take a look at "this":http://qt-project.org/doc/qt-5/qml-qtquick-flickable.html Especially the components that inherit this class ie: "ListView":http://qt-project.org/doc/qt-5/qml-qtquick-listview.html
  • Troubles with QtclConsole

    1
    0 Votes
    1 Posts
    525 Views
    No one has replied
  • TypeError: Type error ?

    4
    0 Votes
    4 Posts
    5k Views
    p3c0P
    Ok, Questions: What is position_cursor and number_inputted ? What are its Data Types ? How are they declared ?
  • 0 Votes
    1 Posts
    447 Views
    No one has replied
  • Deploying an application using QtQuick controls

    1
    0 Votes
    1 Posts
    527 Views
    No one has replied
  • How to change source

    3
    0 Votes
    3 Posts
    975 Views
    mrdebugM
    I have used Loader to embed in the main qml file the new files, as pages but I don't like so mutch this approach. With Declarative I can change the screen as I want.
  • How to give a JavaScript function to a qml component [solved]

    3
    0 Votes
    3 Posts
    998 Views
    A
    Hi, i found it. If my component use f(x) and this component is in a file Draw.qml Simply do it @ Draw { function f(x) { return Math.cos(x) } } @ Have a nice day
  • Set size of the a window according to its items

    4
    0 Votes
    4 Posts
    1k Views
    SGaistS
    Sorry, my bad, i didn't notice the sub-forum of the question. I currently can't tell from a qml point of view.
  • QML / Akonadi

    2
    0 Votes
    2 Posts
    613 Views
    SGaistS
    Hi and welcome to devnet, Since you want to interface Akonadi, you should rather ask this on the KDE forums. You'll probably have better chances to get a quick answer about that. Looking at the KDE sdk might also give you some hints.
  • 1 Votes
    1 Posts
    892 Views
    No one has replied
  • QML List Model

    2
    0 Votes
    2 Posts
    875 Views
    N
    Right way is to write model in pure C++. QQmlListModel is internal class, so you can not use it from C++.
  • Can't focus on TextField in Intergration Mode

    2
    0 Votes
    2 Posts
    840 Views
    ?
    Someone can help me? Selection doesn't work for the TextInput and TextAreaInput even when it's not read only. this is a bug ?! how can I solve this problem ?
  • Question about selection in the new TableView QML type

    2
    0 Votes
    2 Posts
    2k Views
    J
    This is actually not currently supported by TableView. However it is not all that hard to do yourself. I made an example spreadsheet to give you an idea: @import QtQuick 2.2 import QtQuick.Layouts 1.1 import QtQuick.Controls 1.1 TableView { id: table model: 100 width: 600 height: 400 TableViewColumn { } TableViewColumn { } TableViewColumn { } TableViewColumn { } property int currentColumn: 0 Keys.onRightPressed: if (currentColumn < table.columnCount - 1) currentColumn++; Keys.onLeftPressed: if (currentColumn > 0) currentColumn--; rowDelegate: Rectangle { // grid height: 20 color: "#fff" } itemDelegate: Rectangle { property bool selected: styleData.row === table.currentRow && styleData.column === currentColumn color: "transparent" Rectangle { anchors.fill: parent color: selected ? "#4488ee" : "transparent" } Label { id: label verticalAlignment: Text.AlignVCenter anchors.leftMargin: 4 anchors.rightMargin: 4 anchors.fill: parent elide: Text.ElideRight text: styleData.value color: selected ? "white" : "black" } Rectangle { anchors.right: parent.right height: parent.height ; width: 1 color: selected ? "transparent" : "#eee" } Rectangle { width: parent.width ; height: 1 color: selected ? "transparent" : "#eee" } MouseArea { anchors.fill: parent onClicked: { currentColumn = styleData.column currentRow = styleData.row table.forceActiveFocus(); } } } } @