Re: [Interest] Refusing to generate non-lowercase name "A" for unknown foreign type

2024-08-16 Thread Ulf Hermann via Interest
You can indeed write your .qmltypes files manually and then pass NO_GENERATE_QMLTYPES to prevent them from getting generated. However, this is not for the faint of heart (hence the "NO" prefix). You can probably also build the "A" library yourself, retrieve the metatypes.json file from that, a

Re: [Interest] Refusing to generate non-lowercase name "A" for unknown foreign type

2024-08-16 Thread Ulf Hermann via Interest
Unfortunately this is not enough in my real case, where `A` is not only a different library, but is provided by a separate (debian) package, so `A` in the current project is an INTERFACE target, which `qt_extract_metatypes()` falls over with an obscure error. Indeed without metatypes we cannot

Re: [Interest] getting type information of properties in QML

2024-08-05 Thread Ulf Hermann via Interest
1) value types are always copied Sort of. Most value types still look like JavaScript objects which are passed by reference. Internally, the reference nature is simulated by copying the data into a local and two-way-synchronizing with the original. This becomes expensive if either side change

Re: [Interest] problem with type registration during QML module compilation

2024-08-05 Thread Ulf Hermann via Interest
On 7/15/24 22:14, Stefan Seefeld wrote: Thanks Mike for the followup ! Yes, it's a shame that these tools are so restrictive in how users may lay out their code. I'll see what the best options are to proceed. For now I'm simply adding a private include path to make the compiler find the header

Re: [Interest] Getting "really old" Qt sources

2024-05-26 Thread Ulf Hermann via Interest
This should do: git checkout v5.3.2 git submodule sync --recursive git submodule update --init --recursive best, Ulf ___ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest

Re: [Interest] what are the requirements for QMetaType::metaObjectForType(QMetaType::type("QQuickLayout*")) to work?

2024-05-07 Thread Ulf Hermann via Interest
I am not seeing it in 5.15.2, was it added later? Oh, sorry, I was mistaken. https://codereview.qt-project.org/c/qt/qtdeclarative/+/304078 did indeed not make it into Qt5. Otherwise you could actually use the syntax with versions also in qmldir. So in Qt5 the versions have to match. Maybe y

Re: [Interest] what are the requirements for QMetaType::metaObjectForType(QMetaType::type("QQuickLayout*")) to work?

2024-05-06 Thread Ulf Hermann via Interest
Not possible as in this case it assumes the same version as the module that qmldirs belongs to Looks like qmlRegisterModuleImport() is also available (and undocumented) in Qt 5.15 and it does allow you to specify versions: https://doc.qt.io/qt-6/qqmlengine.html#qmlRegisterModuleImport best r

Re: [Interest] what are the requirements for QMetaType::metaObjectForType(QMetaType::type("QQuickLayout*")) to work?

2024-05-06 Thread Ulf Hermann via Interest
I don't think it works, adding `import QtQuick.Layouts 1.15` to qmldir of that module produces an error  "import requires 2 arguments, but 2 were provided" In Qt5 you couldn't specify the version, yet. Try with only: import QtQuick.Layouts best regards, Ulf ___

Re: [Interest] what are the requirements for QMetaType::metaObjectForType(QMetaType::type("QQuickLayout*")) to work?

2024-05-06 Thread Ulf Hermann via Interest
On 5/6/24 18:12, NIkolai Marchenko wrote: Is there a way to automatically import qtquick.layouts while importing a custom module inside of qml file? If you control the custom module and are OK with anyone importing the custom module always also importing QtQuick.Layouts, then yes. There is IM

Re: [Interest] what are the requirements for QMetaType::metaObjectForType(QMetaType::type("QQuickLayout*")) to work?

2024-05-06 Thread Ulf Hermann via Interest
... Of course it only does that if you actually import QtQuick somewhere. Correction: You need to import QtQuick.Layouts, not QtQuick for QQuickLayout to get registered. best regards, Ulf ___ Interest mailing list Interest@qt-project.org https://lis

Re: [Interest] what are the requirements for QMetaType::metaObjectForType(QMetaType::type("QQuickLayout*")) to work?

2024-05-06 Thread Ulf Hermann via Interest
That means it's relying on some automatic registration somewhere, somehow. QQuickLayout has a QML_NAMED_ELEMENT macro which means it's picked up by qmltyperegistrar which does what it says. Of course it only does that if you actually import QtQuick somewhere. That's probably the difference be

Re: [Interest] qt_add_qml_module() RESOURCES vs qt_add_resources()

2024-02-16 Thread Ulf Hermann via Interest
Hi Ekke, not really sure what I'll have to do - will read again tomorrow and trying to understand ;-) BTW: this is the (qml) structure of my apps: qml/Main.qml     pages/MyPage.qml /xxx.qml     popups/MyPopup.qml     ... In QML these are 3 Modules: * A module called "qml" with

Re: [Interest] controlling QML singleton lifetime from C++

2024-02-16 Thread Ulf Hermann via Interest
Hi Stefan, I'd like to be able to replace that singleton instance over the course of the application's workflow, but I couldn't find any indication in the docs for whether that's allowed, or whether that might lead to undefined behaviour. There is QQmlEngine::clearSingletons(), but it's not

Re: [Interest] qt_add_qml_module() RESOURCES vs qt_add_resources()

2024-02-13 Thread Ulf Hermann via Interest
Setting NO_RESOURCE_TARGET_PATH removed the prefix and fixes the pathes for me. [...] engine.loadFromModule("Main_Module", "Main"); Indeed, if you make the module invisible, you cannot load from it. NO_RESOURCE_TARGET_PATH is one of the "NO" options. They are called "NO" for a reason: You

Re: [Interest] CMake - List Sources: qt_add_executable vs qt_add_qml_module

2024-01-30 Thread Ulf Hermann via Interest
I can list all my other cpp SOURCES in qt_add_executable or in qt_add_qml_module, what is recommended in this case ? It doesn't really matter. My recommendation is to list all the C++ files that produce types exposed to QML in the QML module and all other C++ files in qt_add_executable. bes

Re: [Interest] QGraphicsView and OpenGL in Qt6

2023-12-09 Thread Ulf Hermann via Interest
The (former) lack of QTreeView and problems in styling QtQuick Controls are not actually about the QML language. They are about QtQuick and QtQuick Controls. I feel that I have to again remind you all that those are different things. If you are willing to use private API, you can build your ap

Re: [Interest] sharing singleton instance between C++ and QML

2023-10-31 Thread Ulf Hermann via Interest
which works fine. Then I wanted to clean the code up a little more, and removed the "public:", given that the above is a `struct`, so everything in it is public anyhow. And that's where it stopped working ! The Q_GADGET macro contains a "private:", just like the Q_OBJECT macro: #define Q_GADGE

Re: [Interest] sharing singleton instance between C++ and QML

2023-10-26 Thread Ulf Hermann via Interest
Dear Stefan, I don't want to patronize you, but I know the person who has to handle your bug reports if things go south with whatever architecture you come up with. Such things have happened before. So, sorry if that came across in the wrong way. Wrapping your C++ singleton into another obje

Re: [Interest] sharing singleton instance between C++ and QML

2023-10-26 Thread Ulf Hermann via Interest
For the record it is actually possible (I proved it) to create multiple instances of the same singleton with only one engine using a singleton published from C++ if you concoct your C++ side, um,  poorly. But that's another matter for people stuck before C++11... I've fixed QTBUG-116432 if tha

Re: [Interest] sharing singleton instance between C++ and QML

2023-10-25 Thread Ulf Hermann via Interest
The very common misconception I keep reading over and over is that C++ singletons should be the same as QML singletons. They generally aren't. You can shoehorn a C++ singleton into a QML one, but if you can avoid that exercise, you should avoid it. The usual way to declare a QML singleton is j

Re: [Interest] Problems with qt_add_qml_module

2023-10-25 Thread Ulf Hermann via Interest
Well ... maybe you want to read https://doc.qt.io/qt-6/qtqml-writing-a-module.html Actually, I like https://www.qt.io/blog/qml-modules-in-qt-6.2 better because it contains some history and motivation for why QML modules are what they are. For the actual examples, better refer to doc.qt.io, tho

Re: [Interest] Problems with qt_add_qml_module

2023-10-25 Thread Ulf Hermann via Interest
The first argument to the `qt_add_qml_module()` function is *not* a new target to be defined by the call. You can also give it an existing target. See all our examples that first create an executable target and then attach a QML module to it. Furthermore, the `SOURCES` argument isn't a list o

Re: [Interest] Problems with qt_add_qml_module

2023-10-24 Thread Ulf Hermann via Interest
In our existing code we call `qmlRegisterType<...>(...)` in our regular C++ code (e.g., some shared libraries that the main application links to). I thought that, to be able to use those types in stand-alone QML code, I'd need to move these calls into plugins, or at least have some QML extension

Re: [Interest] Problems with qt_add_qml_module

2023-10-24 Thread Ulf Hermann via Interest
Most of the context would be injected into the QML runtime from C++ via calls to `setContextProperty()`, as well as by defining additional QML modules from C++ (via `qmlRegister...()`). This is where your architecture fails. By using setContextProperty() and procedurally registering types, you

Re: [Interest] How to avoid qml engine repeatedly copying and garbage collecting qstringlists?

2023-10-24 Thread Ulf Hermann via Interest
Actually, funnily enough, Qt.fontfamilies is an order of magnitude faster than custom property wrapping the result of ::families. Dunno why.  5s vs 500 ms for the sue case Still, checking on .lncludes(name) in javascript is seemingly also an order of magnitude slower than sending family name to

Re: [Interest] Problems with qt_add_qml_module

2023-10-24 Thread Ulf Hermann via Interest
I'm trying to create a QML extension module using CMake, and I've run into some road blocks. I want to create a QML module including a "plugin", based on my own code rather than an auto-generated plugin stub. My first question is why? The most important part of a QML module is generally a back

Re: [Interest] How to avoid qml engine repeatedly copying and garbage collecting qstringlists?

2023-10-23 Thread Ulf Hermann via Interest
doesn't QtQuickGuiProvider do the exact same thing with QfontDatabase::families? Yes, it does. It returns a QStringList. What I mean is that you don't need a custom C++ base class for your singleton if all you want to do is expose the font families in pre-wrapped form. The following is enough

Re: [Interest] How to avoid qml engine repeatedly copying and garbage collecting qstringlists?

2023-10-23 Thread Ulf Hermann via Interest
The question though is whether this would be a singleton per qmlengine. If it will, then that's a nogo as the list of loaded fonts needs to exist once regardless of how much engines are running Singletons are created once per engine, even C++ ones. You should not subvert this. And you cannot s

Re: [Interest] How to avoid qml engine repeatedly copying and garbage collecting qstringlists?

2023-10-23 Thread Ulf Hermann via Interest
How is instantiating a new c++ instance each time faster than referencing a c++ side singleton?? This is not what I meant. I mean: // singletonbase.h class SingletonBase : public QObject { Q_OBJECT QML_ELEMENT // Not a singleton! Q_PROPERTY( ... ) public: Q_INVOKABLE ... };

Re: [Interest] How to avoid qml engine repeatedly copying and garbage collecting qstringlists?

2023-10-23 Thread Ulf Hermann via Interest
So do I use `pragma Singleton` to wrap a c++ singleton into a qml one declaring such a var property? That would be one way to do it. I don't know what your singleton looks like. Maybe it can be defined in QML and instantiate a non-singleton type declared in C++ rather than referencing yet anot

Re: [Interest] How to avoid qml engine repeatedly copying and garbage collecting qstringlists?

2023-10-23 Thread Ulf Hermann via Interest
On 10/23/23 16:37, NIkolai Marchenko wrote: > If you cannot port to Qt6 and compile the QML code to C++ Unfortunately qt6 broke too much of Qt Quick 1 that porting will require non trivial effort. Are you really still using QtQuick 1? It had been unsupported for years already before Qt6 hap

Re: [Interest] How to avoid qml engine repeatedly copying and garbage collecting qstringlists?

2023-10-23 Thread Ulf Hermann via Interest
So, should I send the value from qml to c++ to do a search there instead? It's the solution I ended up doing but I hoped storing something on JS side was possible to not cross language boundaries on each item initialization. If you cannot port to Qt6 and compile the QML code to C++, this may b

Re: [Interest] How to avoid qml engine repeatedly copying and garbage collecting qstringlists?

2023-10-23 Thread Ulf Hermann via Interest
Hi Nikolai, it would be interesting to see the QML code that produces this behavior. However, I can very well imagine what's happening there. This is likely the "value type reference" problem. The list is a "sequence type". It doesn't have an identity of its own but rather is only accessible a

Re: [Interest] How to prevent large qml forms from hitting javascript stack size?

2023-09-14 Thread Ulf Hermann via Interest
> Will it still add to total object count if this is used:? Due to the fact that we're reserving space for all objects in the compilation unit, the rectangle does count towards the total. Indeed the calculation could be improved here. We're not going to need this stack slot. Maybe we should al

Re: [Interest] How to prevent large qml forms from hitting javascript stack size?

2023-09-11 Thread Ulf Hermann via Interest
Loaders with a component specified inline add to the object count. Loaders with a URL don't. And yes, we need to allow loaders with a module/component pair so that you don't have to specify a URL. We will get there. best regards, Ulf ___ Interest ma

Re: [Interest] How to prevent large qml forms from hitting javascript stack size?

2023-09-11 Thread Ulf Hermann via Interest
775k objects, the form is split into smaller pieces mentioned as Components to load when needed, but qml engine traverses it all completely and reserves full memory seemingly Finally, if you really, really want this, you can patch Qt to produce a QV4::ArrayObject on the JavaScript heap rather

Re: [Interest] How to prevent large qml forms from hitting javascript stack size?

2023-09-11 Thread Ulf Hermann via Interest
would initially help you here, but it would still result in lots of objects being created after it's done processing the compilation units. You may still do it for the internals of your components once you've split them into groups. best regar

Re: [Interest] How to prevent large qml forms from hitting javascript stack size?

2023-09-11 Thread Ulf Hermann via Interest
ve yourself a much easier time reading the code, too. best regards, Ulf Hermann ___ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest

Re: [Interest] Qt 6.5.2 and qmllint questions/issues

2023-08-31 Thread Ulf Hermann via Interest
ssumptions using imports. Then the receiver of the QML file at least has a chance to track down the dependencies. best regards, Ulf Hermann ___ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest

Re: [Interest] Qt 6.5.2 and qmllint questions/issues

2023-08-31 Thread Ulf Hermann via Interest
start adding something there, we don't know anything about the types anymore. So, don't. best regards, Ulf Hermann ___ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest

Re: [Interest] Qt 6.5.2 and qmllint questions/issues

2023-08-31 Thread Ulf Hermann via Interest
about where to find the respective functionality when generating C++ code. Please don't add anything to it. You should define singletons if you need to add globally accessible functionality. A singleton can have methods, and access to a known singleton can be compiled to C++.

Re: [Interest] Qt 6.5.2 and qmllint questions/issues

2023-08-30 Thread Ulf Hermann via Interest
confused in certain situations. We will fix that soon-ish. There is unfortunately a lot of outdated information about the QML type system all over the internet. best regards, Ulf Hermann ___ Interest mailing list Interest@qt-project.org https://lists.qt

Re: [Interest] Qt 6.5.2 and qmllint questions/issues

2023-08-30 Thread Ulf Hermann via Interest
module in the QML interface to your C++-defined components. best regards, Ulf Hermann ___ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest

Re: [Interest] Qt 6.5.2 and qmllint questions/issues

2023-08-30 Thread Ulf Hermann via Interest
mltyperegistrar and have it generate consistent type registrations. That will probably fix some of your problems. best regards, Ulf Hermann ___ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest

Re: [Interest] Default stack size of QThread

2023-08-29 Thread Ulf Hermann via Interest
Mind that it's not really exact. See [2] for the implementation. [1] https://code.qt.io/cgit/qt/qtdeclarative.git/tree/src/qml/memory/qv4stacklimits_p.h [2] https://code.qt.io/cgit/qt/qtdeclarative.git/tree/src/qml/memory/qv4stacklimits.cpp best regards, U

Re: [Interest] Qt Quick: no qmake support anymore?

2023-05-02 Thread Ulf Hermann via Interest
Which begs the question of if it's worth it to bother with QML at all, or at least, when there is the option of something else like widgets. It has a more complex model of mixing the two worlds, it requires additional build system support, and the tooling support is also an additional layer tha

Re: [Interest] Qt Quick: no qmake support anymore?

2023-04-29 Thread Ulf Hermann via Interest
It will come back in a future release: https://codereview.qt-project.org/c/qt-creator/qt-creator/+/473719 It is, however, not a good idea to use qmake for new QML-based projects. In qmake you don't have qt_add_qml_module (ht

Re: [Interest] QML singleton properties are undefined if file placed in subdirectory

2023-03-07 Thread Ulf Hermann via Interest
Qt 6.4.2 QML singleton's properties undefined if singleton QML file placed in subdirectory e.g "/qml" (${CMAKE_SOURCE_DIR}/qml/Style.qml) You should not place your QML files in a different directory than the module (as denoted by the generated qmldir file). Otherwise their implicit import is n

Re: [Interest] Porting a previous qmake approach to cmake

2023-01-13 Thread Ulf Hermann via Interest
Amir is trying to reproduce your problem. I can't figure out what is wrong there because I don't use macOS. In the mean time, you can also just load your QML modules from the resource file system. Then they don't have to be present in the bundle's file system. To do that on 6.4 add RESOURCE_

Re: [Interest] What is the right way of creating a static lib that has qml resources with cmake?

2023-01-12 Thread Ulf Hermann via Interest
Yes, there is. There's -Wl,--whole-archive for the Unix linkers. This should solve the problem for everyone except MSVC users. That option is not very attractive because: a, as you state yourself, it doesn't work on MSVC. b, it only works at the last link step, when the library is linked into

Re: [Interest] What is the right way of creating a static lib that has qml resources with cmake?

2023-01-12 Thread Ulf Hermann via Interest
It works fine here. Please file a bug report with all the details (platform, Qt version etc). Also please state whether you are trying to run the example from the build directory or from some deployment. best regards, Ulf ___ Interest mailing list Int

Re: [Interest] What is the right way of creating a static lib that has qml resources with cmake?

2023-01-12 Thread Ulf Hermann via Interest
I will try to reproduce the problem basing myself on this. In case I need to submit a bug report what is the category? Add "build system: CMake" and "QML tooling". ___ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/

Re: [Interest] What is the right way of creating a static lib that has qml resources with cmake?

2023-01-12 Thread Ulf Hermann via Interest
If you state STATIC in qt_add_qml_module (without a qt_add_library or similar that makes it dynamic) and then it builds a dynamic library, that's a bug. Please file a report at https://bugreports.qt-project.org with a minimal reproducer and state the version of Qt you are using. If it does bui

Re: [Interest] What is the right way of creating a static lib that has qml resources with cmake?

2023-01-11 Thread Ulf Hermann via Interest
With the following approach two libs are created: libshared.a and libsharedplugin.a I just want to have a single target called libshared.a with all the qml resources embedded. You can add NO_PLUGIN to your qt_add_qml_module, but be warned: The linker will be clever and omit your type regi

Re: [Interest] Qml Linting Error - Warnings occurred while importing module "QtQuick.Controls":

2022-12-20 Thread Ulf Hermann via Interest
- Have an option to disable the warning for those who want to support multiple styles in one executable (but still want compilation outside of controls). You said it is possible to "disable the compilation for this specific file", but I'm not sure if that's the same thing as disabling the warni

Re: [Interest] Qml Linting Error - Warnings occurred while importing module "QtQuick.Controls":

2022-12-19 Thread Ulf Hermann via Interest
Warning: QtQuick.Controls uses optional imports which are not supported. Some types might not be found. This is not an error but a warning. Indeed the compiler will not compile your code to C++ because it doesn't know which of the optional imports (ie styles) will be active at run time. You ca

Re: [Interest] qmake to cmake - error: redefinition of 'unit' const QQmlPrivate::CachedQmlUnit unit

2022-12-15 Thread Ulf Hermann via Interest
list(APPEND QML_FILES resources/qml/Browser.qml resources/qml/BrowserBank.qml resources/qml/BrowserButton.qml … Are there more files called "Browser.qml" in the same module? That doesn't work. Your QML components need unique names. Or is there some qt_target_qml_sources()

Re: [Interest] Scripting within Qt6 and QJSEngine

2022-11-14 Thread Ulf Hermann via Interest
I think that QML/JS is not viable for scripting of QtWidgets since public functions are not available when registering Qt classes as types (only slots and Q_INVOKABLE functions next to properties). Without the public class functions only very basic functionality is exposed to the scripting engine.

Re: [Interest] Scripting within Qt6 and QJSEngine

2022-11-14 Thread Ulf Hermann via Interest
That is an intesting question because it somehow pin points something that is not clear to me. Perusing the documentation, I saw that QQmlEngine derives from QJSengine. I cannot figure out which is best to employ in my use case: scripting a QtWidgets C++ application. Can I use QML as a scripting

Re: [Interest] Scripting within Qt6 and QJSEngine

2022-11-10 Thread Ulf Hermann via Interest
Hi Filippo, the equivalent to Q_OBJECT for value types is Q_GADGET. So, your data structure would look like this: struct DataPoint { Q_GADGET Q_PROPERTY(double x MEMBER x) Q_PROPERTY(double y MEMBER y) public: double x; double y; } Now, depending on what you want to do wi

Re: [Interest] qt_add_qml_module and not embedding QML files

2022-11-02 Thread Ulf Hermann via Interest
2. The app is primarily widgets, but we use QML inside QQuickView, inside container widgets. So when the app starts 3 or 4 QML engines are created. That is a problem. The preview can only handle a single QML engine so far. You should see the following error message: " QML engines available.

Re: [Interest] qt_add_qml_module and not embedding QML files

2022-11-02 Thread Ulf Hermann via Interest
You probably have to enable QML debugging and profiling in the build and run settings. It is already, and it works. I can set breakpoints in QML and it works as expected. Can you try to construct a minimal example that reproduces the problem and create a bug report? One significant d

Re: [Interest] qt_add_qml_module and not embedding QML files

2022-11-01 Thread Ulf Hermann via Interest
I did not know about that, it looks nice. But... it does not work with my application, it gets stuck at "QML Debugger: Connecting to socket" You probably have to enable QML debugging and profiling in the build and run settings. ___ Interest mailing

Re: [Interest] qt_add_qml_module and not embedding QML files

2022-10-31 Thread Ulf Hermann via Interest
I cannot use qmlpreview, as I usually need to have the full application running. You can run any application through QML preview. In Qt Creator (in contrast to Qt Design Studio), the option is a bit hidden: There is a "QML Preview" Option in the build menu. Use that to start the application.

Re: [Interest] qt_add_qml_module and not embedding QML files

2022-10-31 Thread Ulf Hermann via Interest
Is there a way to not embed QML files into the Qt resource system when using qt_add_qml_module() ? We can only pre-compile files embedded into the resource file with qmlcachegen. That's why we strongly recommend using the resource file system. You can, of course still manually write your qmldi

Re: [Interest] Small survey on necessary Qt Container size

2022-09-27 Thread Ulf Hermann
I think Andre's point is that you should not use Qt containers for such large amounts of data, but rather some other data structure better suited for your case (most trivially, std::vector instead of QList). The implicit sharing of Qt containers is a nice trait that enables you to write more c

Re: [Interest] Qt 5 -> 6: In QQmlEngine, Qt.Checked, etc. are no longer available

2022-06-24 Thread Ulf Hermann
Right, normally when evaluating a script, any error can be caught and reported however you wish, but this does not work when the script execution is trigger through a signal connection. In this case, when using QJSEngine, errors are always printed to the standard out, whereas the QQmlEngine all

Re: [Interest] Qt 5 -> 6: In QQmlEngine, Qt.Checked, etc. are no longer available

2022-06-24 Thread Ulf Hermann
This is very promising, but unfortunately I could only get it to work with QJSEngine and not with QQmlEngine. With the latter, the Qt object stubbornly still only provides various functions. Indeed, in QQmlEngine the global object is frozen. You cannot replace its properties. Apparently you can

Re: [Interest] Qt 5 -> 6: In QQmlEngine, Qt.Checked, etc. are no longer available

2022-06-23 Thread Ulf Hermann
Thanks for pointing this out! .import QtQml 2.15 as CoreQML console.log(CoreQML.Qt.Checked) yields: At line 2: ReferenceError: CoreQML is not defined Is that something I should report as a bug? I'd appreciate any other potential workarounds. The .import dance as shown above

Re: [Interest] QML required property in view delegate - bug?

2022-05-13 Thread Ulf Hermann
I agree with the doc for the "first level" of properties, but is it also by design even if the required properties are in a sub item, as in my 2nd example (where the delegate itself doesn't have any required properties)? It is this case that seems a bug to me. Indeed that is a bug. Thanks for

Re: [Interest] QML required property in view delegate - bug?

2022-05-13 Thread Ulf Hermann
Which raises the error "ReferenceError: model is not defined", as documented. Is there a way around this? Just add the the "noise" property as another required one and don't access "model" in the delegate. You can do that where you assign to the "text" property. This way it doesn't require you

Re: [Interest] Support for Qt 5 & Qt 6 in QML app

2022-05-13 Thread Ulf Hermann
Hi, I need to migrate a Qt 5 application with QML ui to Qt 6 without losing Qt 5 support. What is the best approach here? Version-specific resources? File selectors (by the way is it even possible to select QML files based on the Qt version?) I mean it is clear that platform-specific code/import

Re: [Interest] QML issues after deployment

2022-04-26 Thread Ulf Hermann
Hi, just lately I started integrating QML features into my Qt6 app (related to web browsing). This works fine so far, however, after deployment via macdeployqt I receive this error upon bootup: module "QtQml.WorkerScript" is not installed There can be many reasons for this. The most likely on

Re: [Interest] [Qt6] QML notify dynamic property changes from C++

2022-03-07 Thread Ulf Hermann
On a related note, I'd suggest including an iterator/const_iterator for the QQmlPropertyMap for convenience, and also it could possibly handle this sort of value change in a more streamlined manner. QQmlPropertyMap is not our focus for new features. It's most important downside is that we cann

Re: [Interest] [Qt6] QML notify dynamic property changes from C++

2022-03-07 Thread Ulf Hermann
Hi, Do you possibly mean QQmlPropertyMap::updateValue, because I don't see a setValue method in the documentation. Either way it doesn't appear to Sorry, it's called: void insert(const QString &key, const QVariant &value); Gadgets cannot send signals or notify about property changes in any

Re: [Interest] [Qt6] QML notify dynamic property changes from C++

2022-03-07 Thread Ulf Hermann
Hi Konstantin, I have exposed some dynamic properties through QQmlPropertyMap to the QML engine and that works well. However I need to change the values from C++ and want to notify the bindings about the property change from there. Is there a way to do it? QQmlPropertyMap::setValue(key, valu

Re: [Interest] [Qt6] Inject a QML enum from C++ at runtime

2022-01-20 Thread Ulf Hermann
Well, the number of names isn't fixed is the point - they're loaded at runtime and will change (increase) from time to time. Then an enumerator won't really help you. The point of an enumerator is that each entry is a constant. If the names and values can change at runtime, you should use a

Re: [Interest] [Qt6] Inject a QML enum from C++ at runtime

2022-01-20 Thread Ulf Hermann
I imagine I'm not supposed to do such stuff, but is it at all possible to provide a QML enumerator at runtime from C++? Why does it have to be an enumerator? To me it sounds like the values should be properties of a singleton. The code accessing them needs to know a fixed set of names after al

Re: [Interest] [Qt6] QML automatic type registration in a (shared) library

2022-01-14 Thread Ulf Hermann
In my case to make extra sure I exported a dummy global symbol from the dll. If I don't do anything with it - nothing works. If I print it with qDebug() in the application code, the library is loaded and registration code and all works just as expected. Indeed. And instead of the dummy symbol

Re: [Interest] [Qt6] QML automatic type registration in a (shared) library

2022-01-14 Thread Ulf Hermann
Perhaps that's how it's supposed to work, but I'm not intending to mess around with the target output paths in cmake. It simply makes no sense to me. If you want the QML engine to find your module, you need to follow certain conventions around the paths. You can create a separate CMake targe

Re: [Interest] [Qt6] QML automatic type registration in a (shared) library

2022-01-14 Thread Ulf Hermann
I don't know. I have the generated qmldir in the C:\Programming\tsc\build\debug\TscUi directory, which I think should be correct. I haven't messed with the output paths at all. The application goes to a neighboring directory in C:\Programming\tsc\build\debug\TscApp Well, no, that doesn't work.

Re: [Interest] [Qt6] QML automatic type registration in a (shared) library

2022-01-14 Thread Ulf Hermann
Otherwise, if the module ends up in C:/foo/bar/Tsc/Ui/, then you need to add C:/foo/bar/ to the import path. Well, unless your executable is in C:/boo/bar. Then you don't need to do anything. But apparently that's not the case. The executable would be at the root of the application-specific

Re: [Interest] [Qt6] QML automatic type registration in a (shared) library

2022-01-14 Thread Ulf Hermann
Is the place where the module's qmldir ends up reachable via the QML import path? If you're linking the library into the application, you may just add :/ to your import path so that it's loaded from the qrc file system right away. Be aware that some linkers just drop the linkage if they perceiv

Re: [Interest] [Qt6] Gadgets in QML

2022-01-07 Thread Ulf Hermann
Well, it does work, albeit I'm not convinced if it's better/efficient enough. In any case, if you're interested we can pick up on gerrit, just say so. Sure, if you have something on gerrit let me see! However, value types with upper case names is something I probably won't allow. All our exis

Re: [Interest] [Qt6] Gadgets in QML

2022-01-06 Thread Ulf Hermann
Person is a `QObject`, the `Age` is a gadget I've exposed from C++. Then it's easy. If the "age" property is declared in C++, already today you can do the following (just like with font): property var person: Person { age { years: 12 months: 4 } Simulation.onAdvan

Re: [Interest] [Qt6] Gadgets in QML

2022-01-06 Thread Ulf Hermann
Yeah, but my beef with it is that I must derive from QObject for that, don't I? I can live with not having notifications for the fields, is what I mean. font is explicitly _not_ derived from QObject. That's the whole point of value types. Value types, however, cannot exist as root objects. The

Re: [Interest] [Qt6] Gadgets in QML

2022-01-06 Thread Ulf Hermann
To be frank it's been an annoyance for me that gadgets can't be instantiated the same way the QObject can within the QML document/tree. Is there a good reason to disallow this or is it simply not implemented? Am I missing some odd use/corner case why it's not a good idea? It's not implemented

Re: [Interest] [Qt6] QML_ATTACHED failing with ::QQmlPrivate not declared

2022-01-05 Thread Ulf Hermann
I didn't mean the name's wrong, simply that I read in the docs instead of or something akin. would import a class called "QQmlRegistration". There is no such class in that header. It's a collection of macros. The correct form is . best regards, Ulf ___

Re: [Interest] [Qt6] QML_ATTACHED failing with ::QQmlPrivate not declared

2022-01-05 Thread Ulf Hermann
On a side note, I was wondering, why these, contrary to other Qt headers, don't provide cpp style naming? Where do you see the lack in cpp style naming? What name is wrong? best regards, Ulf ___ Interest mailing list Interest@qt-project.org https://li

Re: [Interest] [Qt6] QML_ATTACHED failing with ::QQmlPrivate not declared

2022-01-03 Thread Ulf Hermann
https://codereview.qt-project.org/c/qt/qtdeclarative/+/383175 may have fixed this. It forward declares some of the types. best regards, Ulf ___ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest

Re: [Interest] [Qt6] QML_ATTACHED failing with ::QQmlPrivate not declared

2022-01-03 Thread Ulf Hermann
So, did I stumble on a bug? Indeed that sounds wrong. You should not need to include qqmlprivate.h manually. We've moved the registration macros from qqml.h to qqmlregistration.h, but apparently not all their dependencies. Including qqml.h instead of qqmlregistration.h should work. best reg

Re: [Interest] Javascript: regex: no /s flag support?

2021-11-25 Thread Ulf Hermann
And the 's' flag was apparently added in ES2018, which QML does not support, yet. best, Ulf ___ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest

Re: [Interest] Javascript: regex: no /s flag support?

2021-11-25 Thread Ulf Hermann
On Thursday, November 25, 2021 11:47:19 PM MSK Alexander Dyagilev wrote: I'm trying to: var re = new RegExp('someregex', 's'); This does not produce a QRegularExpression but rather a JavaScript regular expression. Unfortunately those are slightly different. See https://developer.mozilla.org/

Re: [Interest] QML type hints and their problems

2021-11-03 Thread Ulf Hermann
a, Use type annotations on all JavaScript functions in QML files. Period. It helps tooling, gives you better diagnostics from qmllint and qmlsc, helps you understand your code better. There are no downsides. b, In this particular case we could be more lenient, but what if that was actually an

Re: [Interest] Binding::restoreMode buyers guide

2021-10-21 Thread Ulf Hermann
The question is all about QtQml 2.15 Binding type. The infamous missing unexported `restoreMode` property sure makes our lifes slightly harder than it should be (by generating warnings if left out); but when it comes to choosing an appropriate value for it -- I am totally lost. The short story i

Re: [Interest] Can QML compiler optimize switch into array indexing?

2021-10-15 Thread Ulf Hermann
I now saw your nice blog post about this at [1], saying "You should not call qmlRegisterType() and friends procedurally anymore.". I then saw that there's no pointer in the docs for qmlRegisterType and friends [2] to QML_ELEMENT. There are quite a few links from the qmlRegisterType() family of

Re: [Interest] Can QML compiler optimize switch into array indexing?

2021-10-14 Thread Ulf Hermann
Hi, Let's look at the QML snippet again: enabledBorders: { switch (control.edge) { case Qt.BottomEdge: return PlasmaCore.FrameSvgItem.TopBorder; case Qt.RightEdge: return PlasmaCore.FrameSvgItem.LeftBorder; case Qt.To

Re: [Interest] Qt 5.15 LTS vs Qt 6.2 LTS

2021-10-02 Thread Ulf Hermann
There are no patient killing bugs in the underlying OS or the previously used drivers. Those only exist in the new drivers, new OS patches and new Qt code. All of the new code has to be written following 62304 SDLC Although I doubt that Windows XP or the new graphics drivers are free of patien

Re: [Interest] Qt 5.15 LTS vs Qt 6.2 LTS

2021-10-01 Thread Ulf Hermann
I doubt you get a paid-for 5.15 LTS under an Open Source licence, so no, this is not comparable a̲t̲ ̲a̲l̲l̲. I did not compare to anything. Roland listed a number of open source projects with LTS versions _after_ I wrote this. If you want to discuss the issue of "I want a supported open sour

Re: [Interest] Qt 5.15 LTS vs Qt 6.2 LTS

2021-09-30 Thread Ulf Hermann
Long story short: You can have a Qt 5.15 LTS. You just have to pay for it. You can even have Qt supported on obscure outdated platforms, as Volker mentioned. It's just even more expensive. The price is high because there is a lot work involved in making this happen and the number of customers r

  1   2   >