Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.0k Topics 77.3k Posts
  • New TreeView in Qt6

    Unsolved
    1
    1 Votes
    1 Posts
    216 Views
    No one has replied
  • 0 Votes
    1 Posts
    172 Views
    No one has replied
  • ApplicationWindow is not visible by default?

    Unsolved
    2
    0 Votes
    2 Posts
    198 Views
    SGaistS
    Hi, Good point ! A fix for the doc has been submitted.
  • Qml inspection, eventFilter

    Unsolved qml c++
    2
    1 Votes
    2 Posts
    320 Views
    KH-219DesignK
    I'll check back tomorrow or Tuesday to see if I can better explain the code that I am about to share. I'm in a hurry today, so I'm just going to paste this and hope that anyone reading it can make use of it :) #include <QQmlComponent> #include <QQmlProperty> #include <QQuickItem> void dumpRecursive( int level, QObject* object ) { if( object ) { QByteArray buf; buf.fill( ' ', level / 2 * 8 ); if( level % 2 ) buf += " "; QString name = object->objectName(); QVariant propv = QQmlProperty::read( object, "visible" ); if( propv.isNull() ) { fprintf( stderr, "%s\n", "IS_NULL visible prop" ); } else { QQmlProperty prop( object, "visible" ); fprintf( stderr, "hasNotifySignal %d\n", static_cast<int>( prop.hasNotifySignal() ) ); fprintf( stderr, "isResettable %d\n", static_cast<int>( prop.isResettable() ) ); fprintf( stderr, "isSignalProperty %d\n", static_cast<int>( prop.isSignalProperty() ) ); fprintf( stderr, "isValid %d\n", static_cast<int>( prop.isValid() ) ); fprintf( stderr, "isWritable %d\n", static_cast<int>( prop.isWritable() ) ); fprintf( stderr, "propertyTypeName %s\n", prop.propertyTypeName() ); fprintf( stderr, "needsNotifySignal %d\n", static_cast<int>( prop.needsNotifySignal() ) ); // bool QQmlProperty::needsNotifySignal() const // QMetaMethod m = prop.method(); } QVariant prop = QQmlProperty::read( object, "testtest" ); if( !prop.isNull() ) { if( !prop.canConvert<QList<QVariant>>() ) { fprintf( stderr, "%s\n", "whoooooooooooooooooooooooooops ! ! !" ); } else { QList<QVariant> list = prop.toList(); fprintf( stderr, "wheeeeeeeeeeeeeeeee %p\n", reinterpret_cast<void*>( &list ) ); for( const auto& state : list ) { fprintf( stderr, "got one %p\n", reinterpret_cast<void*>( &list ) ); if( state.canConvert<QQuickItem*>() ) { QQuickItem* t = state.value<QQuickItem*>(); fprintf( stderr, "converts one %p\n", reinterpret_cast<void*>( t ) ); } } } } qDebug( "%s%s::%s", reinterpret_cast<const char*>( buf.data() ), object->metaObject()->className(), name.toLocal8Bit().data() ); QObjectList children = object->children(); if( !children.isEmpty() ) { for( int i = 0; i < children.size(); ++i ) dumpRecursive( level + 1, children.at( i ) ); } } } void localDump( QObject* object ) { dumpRecursive( 0, object ); } // return true if the event should be filtered (i.e. stopped) bool EventFilter::eventFilter( QObject* obj, QEvent* event ) { localDump( obj ); return QObject::eventFilter( obj, event ); }
  • 0 Votes
    9 Posts
    348 Views
    C
    @GrecKo Could you elaborate on how to use qRegisterMetaType? And on what you mean by root context properties should not be used anymore, access lookup is heavy for them.
  • qml app does not run without any error and but does run in <qtVersion>\mingw\bin

    Solved
    5
    0 Votes
    5 Posts
    598 Views
    Q
    @SGaist it worked fine. thank you so much (: ❤️
  • QML Svg in qt 5.15 static build, using CMake

    Unsolved
    3
    0 Votes
    3 Posts
    2k Views
    B
    The solution for me was in addition to including Qt5::Svg in find_package and target_link_libraries, eg: find_package(Qt5 REQUIRED COMPONENTS Core Quick Qml Xml Charts Gui Svg QuickControls2) target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core Qt5::Quick Qt5::Qml Qt5::Xml Qt5::Charts Qt5::Gui Qt5::Svg Qt5::QuickControls2) To also include the following when statically linking Qt 5.15: qt5_import_plugins(${PROJECT_NAME} INCLUDE Qt5::QSvgPlugin) That resolved errors such as "QML ButtonIcon: Error decoding: qrc:/resources/images/add-white-36dp.svg: Unsupported image format"
  • Make Independent Popup

    Solved
    4
    0 Votes
    4 Posts
    395 Views
    PadawanP
    @GrecKo Thanks I've gotten it sorted out. I encapsulated the component i wanted to show inside a window and created it using Qt.createComponent() var playListComponent = Qt.createComponent("CustomPlaylist.qml") var window = playListComponent.createObject(rootWindow) window.show() The root element of CustomPlaylist.qml is a Window [image: 4c1cfe8b-9403-4008-9066-c4ec97b8f368.png]
  • why doesn't it draw PathLine ??

    Unsolved quick qt quick qt5.11
    2
    0 Votes
    2 Posts
    811 Views
    B
    If I understood correctly, you want to draw a red line. The purpose of Path is to position elements through a path. Think of a row or a column that's not straight. You can understand better if you run the first example from this tutorial. To draw paths you need Shape. import QtQuick 2.15 import QtQuick.Window 2.15 import QtQuick.Shapes 1.12 Window { width: 640 height: 480 visible: true title: qsTr("Редактор персонажей") Shape { ShapePath { strokeColor: "red"; // it works :) startX: 0; startY: 100 PathLine { x: 640; y: 480 } } } }
  • How to show multiple Popup on a window? (for ToolTip)

    Solved
    3
    0 Votes
    3 Posts
    415 Views
    W
    @GrecKo Nice and good example! I can solve my problem. Thanks.
  • Using of property mouse.accepted

    Solved
    4
    1 Votes
    4 Posts
    3k Views
    GrecKoG
    not that for a single parameter you can get rid of the parenthesis, mouse => { ... } works
  • "ValueAxis.tickInterval" is not available in QtCharts 2.3.

    Solved
    3
    0 Votes
    3 Posts
    351 Views
    S
    It works ! Thanks (I don't understand it either...)
  • Qt Quick QML Types in QtQuick 2.11 ??

    Solved qml types
    2
    0 Votes
    2 Posts
    473 Views
    raven-worxR
    @timob256 you mean this? https://doc.qt.io/archives/qt-5.11/qtquick-qmlmodule.html
  • Fonts, again. Different appearance on different platforms. Same font.

    Solved
    6
    0 Votes
    6 Posts
    1k Views
    GrecKoG
    That's how font works in every UI system, there is a fallback behavior. As for why there is both font.family and fontInfo.family, it's because it makes developers life easier. You can actually see if the chosen font differs from the one that was set without having to store the expected font somewhere else. For the font family you can also gives a very vague one like "serif", "sans-serif", "monospace" and seeing what the font matched with fontInfo might be important. It would be weird to do font.family = "sans-serif"; and then getting "DejaVu Sans" back when querying font.family, wouldn't it? QML is declarative, so making font.family a function won't be very practical and give much advantages. You already have your feedback in a declarative way, I really don't see how an imperative API would be any better? Do you have a pseudo code example of what your perfect API would look like?
  • TableView header hides first elements

    Unsolved
    3
    0 Votes
    3 Posts
    694 Views
    sudarshandS
    Use topMargin property of Table View.
  • Problems with ScrollBar and ListView

    Solved
    2
    0 Votes
    2 Posts
    831 Views
    C
    I figured it out. For anyone who's interested. If you set the visibility of the contentItem to be: visible: theListView.contentHeight > theListView.height that should do the trick.
  • Dialog and DropArea issue

    Unsolved
    5
    0 Votes
    5 Posts
    2k Views
    G
    This is an annoying problem and I'm struggling with it at the moment. Did anyone manage to find a proper workaround to it?
  • Qt Creator: qml.qrc with different prefix, problem in design editor

    Unsolved
    1
    0 Votes
    1 Posts
    209 Views
    No one has replied
  • QList as qml model

    Unsolved
    2
    0 Votes
    2 Posts
    286 Views
    raven-worxR
    @Cyrille-de-Brebisson Q_PROPERTY(QList<MyObj*> liste READ getliste NOTIFY listeChanged) now emit the listeChanged signal everytime you change the list If you would implement a QAbstractListModel subclass you would have more control of rearrangements etc.
  • 0 Votes
    4 Posts
    1k Views
    raven-worxR
    @Tee_ normally a pro file results in a separate target (executable or library). Even if you "combine" them with a subdirs project. So your AppUi project must link against the AppLib