Re: [Interest] QJSEngine won't evaluate octal literal

2021-08-03 Thread Fabrice Mousset | GEOCEPT GmbH
I don't know why (perhaps the "strict mode" is always active with Qt?), but you 
to use 0o11 to force octal encoding to avoid confusion with binary encoding 
(0b11).

QJSEngine eng;
auto jsv = eng.evaluate("(function(){return 0o11;})()");
qDebug() << jsv.isError() << jsv.toString() << jsv.toVariant();

Regards

Fabrice Mousset

> -Ursprüngliche Nachricht-
> Von: Interest  Im Auftrag von Hamish
> Moffatt via Interest
> Gesendet: Dienstag, 3. August 2021 08:36
> An: Qt Interest 
> Betreff: [Interest] QJSEngine won't evaluate octal literal
> 
> I have the following test code to evaluate an octal literal which I'm running 
> on
> Qt 5.12 and 5.15;
> 
>              QJSEngine eng;
>              auto jsv = eng.evaluate("(function(){return 011;})()");
>              qDebug() << jsv.isError() << jsv.toString() << jsv.toVariant();
> 
> This outputs:
> 
> true "SyntaxError: Expected token `;'" QVariant(QVariantMap, QMap())
> 
> 
> It works if I use hex literals, and the octal code works in node.js. Why 
> doesn't
> it work in QJSEngine?
> 
> 
> Hamish
> 
> ___
> Interest mailing list
> Interest@qt-project.org
> https://lists.qt-project.org/listinfo/interest
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] QML MenuBar : works with PySide2 but not c++ ?

2021-06-03 Thread Fabrice Mousset | GEOCEPT GmbH
I think you also have to load QML module in PRO file:
MenuBar.pro
===
QT += quick qml

Best regards

Fabrice Mousset

Von: Interest  Im Auftrag von Nicholas Yue
Gesendet: Donnerstag, 3. Juni 2021 06:09
An: Tony Rietwyk 
Cc: interest@qt-project.org
Betreff: Re: [Interest] QML MenuBar : works with PySide2 but not c++ ?

I copied the qml loading code from another working example, I was just testing 
a change in the QML content.

I'd have to dig further about the lambda

MenuBar.pro
===
QT += quick

CONFIG += c++11

# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Refer to the documentation for the
# deprecated API to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS

# You can also make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version 
of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x06# disables all the APIs 
deprecated before Qt 6.0.0

SOURCES += \
main.cpp

RESOURCES += main.qrc

# Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH =

# Additional import path used to resolve QML modules just for Qt Quick Designer
QML_DESIGNER_IMPORT_PATH =

# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target

main.qrc
===


MenuBar.qml



On Wed, 2 Jun 2021 at 20:36, Tony Rietwyk 
mailto:t...@rightsoft.com.au>> wrote:

Hi Nicholas,

The short answer is because your C++ is doing completely different things to 
the python code.  :O)

I'm not sure about using QML.  Have you included the qml file as a resource 
correctly to access via qrc:?  You aren't checking the result of the 
engine.load.  Also, why is the lambda exiting the application when the 
objectCreated matches the url?

Have run the Qt QML examples?  How is your C++ code different to those?

Hope that helps, Tony


On 3/06/2021 11:33 am, Nicholas Yue wrote:
Hi,

  I am learning about QML.

  I would like to find out why the PySide2 loading of the QML file results in a 
visible window but the C++ one does not. The compiled application runs but no 
window is displayed.

MenuBar.qml
===
import QtQuick 2.4
import QtQuick.Controls 2.13

ApplicationWindow {
visible: true
width: 720
height: 480
title: "simple window"

menuBar: MenuBar{
Menu{
title: "Menu1"
}

Menu{
title: "Menu2"
}

Menu{
title: ""
}
}
}

main.cpp

#include 
#include 

int main(int argc, char *argv[])
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);

QGuiApplication app(argc, argv);

QQmlApplicationEngine engine;
const QUrl url(QStringLiteral("qrc:/MenuBar.qml"));
QObject::connect(, ::objectCreated,
 , [url](QObject *obj, const QUrl ) {
if (!obj && url == objUrl)
QCoreApplication::exit(-1);
}, Qt::QueuedConnection);
engine.load(url);

return app.exec();
}

main.py
===
import sys
from PySide2 import QtCore, QtGui, QtQml

if __name__ == '__main__':

QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling)
app = QtGui.QGuiApplication(sys.argv)

engine = QtQml.QQmlApplicationEngine()

url = QtCore.QUrl.fromLocalFile('MenuBar.qml')
engine.load(url)
if not engine.rootObjects():
sys.exit(-1)

sys.exit(app.exec_())

--
Nicholas Yue
Graphics - Arnold, Alembic, RenderMan, OpenGL, HDF5
Custom Dev - C++ porting, OSX, Linux, Windows
http://au.linkedin.com/in/nicholasyue
https://vimeo.com/channels/naiadtools


___

Interest mailing list

Interest@qt-project.org

https://lists.qt-project.org/listinfo/interest
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


--
Nicholas Yue
Graphics - Arnold, Alembic, RenderMan, OpenGL, HDF5
Custom Dev - C++ porting, OSX, Linux, Windows
http://au.linkedin.com/in/nicholasyue
https://vimeo.com/channels/naiadtools
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] Memory leak in grabToImage?

2020-08-10 Thread Fabrice Mousset | GEOCEPT GmbH
Hi,

I am not a C++ guru, but I think your memory leak issue is linked with 
QSharedPointer usage.
I think you have to delete the connection to remove the lambda and destroy the 
QSharedPointer.

Like this:
void Utils::takeScreenshot()
{
QQuickItem *item = m_rootView->contentItem();
QSharedPointer grab = item->grabToImage();
if(grab.get() != nullptr) {
connect(grab.get(), ::ready, this, [grab]() {
garb.get()->disconnect();
qInfo() << "<<< Utils::takeScreenshot ";
});
}
}

Regards

Fabrice

Von: Interest  Im Auftrag von Marc Van Daele
Gesendet: Montag, 10. August 2020 10:32
An: Qt Interest 
Betreff: [Interest] Memory leak in grabToImage?

Hello,

The following example application has a memory leak when using 5.12.6 on Linux 
(when monitoring with htop, the memory of the process increases systematically).
Is this a programming error or a bug in Qt?

Looking forward to your input,

Marc

In QML, I take a screenshot every second

Timer {

id: memoryMonitor

interval: 1*1000

repeat: true

onTriggered: utils.takeScreenshot()

}

Component.onCompleted: memoryMonitor.start()



In main.cpp, I register my Utils class as a context property

Utils utils((QQuickWindow*)(app.allWindows()[0]));

engine.rootContext()->setContextProperty("utils", );



My Utils class looks like

class Utils : public QObject

{

Q_OBJECT

public:

explicit Utils(QQuickWindow* rootView, QObject *parent = nullptr);

Q_INVOKABLE void takeScreenshot();

signals:

public slots:

private:

QQuickWindow* m_rootView;

};

Utils::Utils(QQuickWindow* rootView, QObject *parent) : QObject(parent)

{

m_rootView = rootView;

}



void Utils::takeScreenshot()

{

QQuickItem *item = m_rootView->contentItem();

QSharedPointer grab = item->grabToImage();

if(grab.get() != nullptr) {

connect(grab.get(), ::ready, this, [grab]() {

qInfo() << "<<< Utils::takeScreenshot ";

});

}

}
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] QQuickWindow Transparent Window Issues on Windows NVIDIA GPU

2020-08-04 Thread Fabrice Mousset | GEOCEPT GmbH
Hello,

If you are targeting Windoows10, you could try to use Direct3D 12 renderer with 
Qt 5.15.x ==> https://doc.qt.io/qt-5/qtquick-visualcanvas-adaptations-d3d12.html

Regards

Fabrice

Von: Interest  Im Auftrag von Furkan Uzumcu
Gesendet: Dienstag, 4. August 2020 16:33
An: inter...@lists.qt-project.org
Betreff: [Interest] QQuickWindow Transparent Window Issues on Windows NVIDIA GPU

Hello everyone.

I’ve been having this issue on NVIDIA cards on Windows in all versions from Qt 
v5.12.2 to v5.15.0. I created a ticket here: 
https://bugreports.qt.io/browse/QTBUG-85524
But I wanted to reach out to see If anybody else encountered this. I’m not that 
well versed in this issue. I’m trying to research to see If there’s anything I 
can do about it or find a work around. There’s a few other related tickets in 
QTBUG but they don’t really offer a clear (At least to me) definition of the 
problem.

If anyone with the same problem can share their experience or provide any 
insight, I’d appreciate it.

Regards,
Furkan Üzümcü
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] Trouble with Android JNI and QEventLoop

2020-07-13 Thread Fabrice Mousset | GEOCEPT GmbH
Yes, JniHandler::stateChanged is called from Java.
I tried many ways:
* QMetaObject::invokeMethod() with „AutoConnection“
* QMetaObject::invokeMethod() with „QueuedConnection“
* QTimer::singleShot()

What will be different by using „emit pInstance ->signalName()“ ?

Regards

Fabrice

Von: Marc Van Daele  
Gesendet: Montag, 13. Juli 2020 16:45
An: Fabrice Mousset | GEOCEPT GmbH 
Cc: Qt Interest 
Betreff: Re: [Interest] Trouble with Android JNI and QEventLoop

The JniHandler::stateChanged is called from Android/Java (or Kotlin) I guess?
Can you try to emit a signal in JniHandler::stateChanged and call the 
updateList in the connected slot?

Marc 



On Mon, 13 Jul 2020 at 16:15, Fabrice Mousset | GEOCEPT GmbH 
<mailto:fabrice.mous...@geocept.com> wrote:
Thanks for your reply!

The thread ID is the same, all messages are from the same process (Activity and 
Service are on different processes).
I forgot to say that I have already tried QMutex to lock the access, but that 
is not useful here because if I set it up as "NonRecursive", it will dead lock!

Regards

Fabrice

Von: Marc Van Daele <mailto:marc.van.dael...@gmail.com> 
Gesendet: Montag, 13. Juli 2020 11:36
An: Fabrice Mousset | GEOCEPT GmbH <mailto:fabrice.mous...@geocept.com>
Cc: Qt Interest <mailto:interest@qt-project.org>
Betreff: Re: [Interest] Trouble with Android JNI and QEventLoop

Can you also print the thread-pointer/id next to the name?  
Maybe (just guessing) one QtMainLoopThread is from the main app and the other 
one is from the service?
You could add a QMutexLocker (https://doc.qt.io/qt-5/qmutexlocker.html) to 
ensure that the calls are executed sequentially.

Kind Regards,

Marc

On Mon, 13 Jul 2020 at 09:25, Fabrice Mousset | GEOCEPT GmbH 
<mailto:mailto:fabrice.mous...@geocept.com> wrote:
Hi all,

First, I tried to send this mail to Android mailing list, but got an error 
message as reply, so I try here. Sorry if I am wrong

I have a random issue with one of my Android service I've build with Qt 5.12.9.
I have centralized JNI interface in one C++ class, which is a singleton.
My service is single threaded, so there should not be a threading issue... I 
guess!

So here my issue: I have a function which will populate a list. This function 
could be called at service begin or while receiving a specific Broadcast 
message.
Sometimes, it happens that this function is called twice before first call is 
finished.

I have at some traces to follow what's happening, something like:
void MyService::updateList(int calledFrom) {
    qDebug() << "Update List start #"<< calledFrom << "@" << 
QThread::currentThread()->objectName();
    ...
    qDebug() << "Update List end #"<< calledFrom << "@" << 
QThread::currentThread()->objectName();}
}

And, on LogCat I can see:
Update List start # 0 @ "QtMainLoopThread"
Update List start # 1 @ "QtMainLoopThread"
Update List end # 1 @ "QtMainLoopThread"
Update List end # 0 @ "QtMainLoopThread"


Here is the way I handle JNI calls:
void JniHandler:: stateChanged(JNIEnv *, jobject, jint newState) {
    auto* pInstance = JniHandler::instance();
    if(pInstance)
    {
        QMetaObject::invokeMethod(pInstance, [pInstance , newState] {
            ...
            });
     }
}

I tried to change QMetaObject::invokeMethod call to add ' 
Qt::QueuedConnection', but didn't change anything.
I also change to use QTimer::singleShot():
    if(pInstance)
    {
        QEventLoop myLoop;
        Q_UNUSED(myLoop)
        QTimer::singleShot(0, pInstance, [pInstance , newState] {
            ...
            });
     }

But still have the same issue.

How is this possible?
What I am doing wrong?

Best regards

Fabrice Mousset

___
Interest mailing list
mailto:mailto:Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] Trouble with Android JNI and QEventLoop

2020-07-13 Thread Fabrice Mousset | GEOCEPT GmbH
Thanks for your reply!

The thread ID is the same, all messages are from the same process (Activity and 
Service are on different processes).
I forgot to say that I have already tried QMutex to lock the access, but that 
is not useful here because if I set it up as "NonRecursive", it will dead lock!

Regards

Fabrice

Von: Marc Van Daele  
Gesendet: Montag, 13. Juli 2020 11:36
An: Fabrice Mousset | GEOCEPT GmbH 
Cc: Qt Interest 
Betreff: Re: [Interest] Trouble with Android JNI and QEventLoop

Can you also print the thread-pointer/id next to the name?  
Maybe (just guessing) one QtMainLoopThread is from the main app and the other 
one is from the service?
You could add a QMutexLocker (https://doc.qt.io/qt-5/qmutexlocker.html) to 
ensure that the calls are executed sequentially.

Kind Regards,

Marc

On Mon, 13 Jul 2020 at 09:25, Fabrice Mousset | GEOCEPT GmbH 
<mailto:fabrice.mous...@geocept.com> wrote:
Hi all,

First, I tried to send this mail to Android mailing list, but got an error 
message as reply, so I try here. Sorry if I am wrong

I have a random issue with one of my Android service I've build with Qt 5.12.9.
I have centralized JNI interface in one C++ class, which is a singleton.
My service is single threaded, so there should not be a threading issue... I 
guess!

So here my issue: I have a function which will populate a list. This function 
could be called at service begin or while receiving a specific Broadcast 
message.
Sometimes, it happens that this function is called twice before first call is 
finished.

I have at some traces to follow what's happening, something like:
void MyService::updateList(int calledFrom) {
    qDebug() << "Update List start #"<< calledFrom << "@" << 
QThread::currentThread()->objectName();
    ...
    qDebug() << "Update List end #"<< calledFrom << "@" << 
QThread::currentThread()->objectName();}
}

And, on LogCat I can see:
Update List start # 0 @ "QtMainLoopThread"
Update List start # 1 @ "QtMainLoopThread"
Update List end # 1 @ "QtMainLoopThread"
Update List end # 0 @ "QtMainLoopThread"


Here is the way I handle JNI calls:
void JniHandler:: stateChanged(JNIEnv *, jobject, jint newState) {
    auto* pInstance = JniHandler::instance();
    if(pInstance)
    {
        QMetaObject::invokeMethod(pInstance, [pInstance , newState] {
            ...
            });
     }
}

I tried to change QMetaObject::invokeMethod call to add ' 
Qt::QueuedConnection', but didn't change anything.
I also change to use QTimer::singleShot():
    if(pInstance)
    {
        QEventLoop myLoop;
        Q_UNUSED(myLoop)
        QTimer::singleShot(0, pInstance, [pInstance , newState] {
            ...
            });
     }

But still have the same issue.

How is this possible?
What I am doing wrong?

Best regards

Fabrice Mousset

___
Interest mailing list
mailto:Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


[Interest] Trouble with Android JNI and QEventLoop

2020-07-13 Thread Fabrice Mousset | GEOCEPT GmbH
Hi all,

First, I tried to send this mail to Android mailing list, but got an error 
message as reply, so I try here. Sorry if I am wrong

I have a random issue with one of my Android service I've build with Qt 5.12.9.
I have centralized JNI interface in one C++ class, which is a singleton.
My service is single threaded, so there should not be a threading issue... I 
guess!

So here my issue: I have a function which will populate a list. This function 
could be called at service begin or while receiving a specific Broadcast 
message.
Sometimes, it happens that this function is called twice before first call is 
finished.

I have at some traces to follow what's happening, something like:
void MyService::updateList(int calledFrom) {
qDebug() << "Update List start #"<< calledFrom << "@" << 
QThread::currentThread()->objectName();
...
qDebug() << "Update List end #"<< calledFrom << "@" << 
QThread::currentThread()->objectName();}
}

And, on LogCat I can see:
Update List start # 0 @ "QtMainLoopThread"
Update List start # 1 @ "QtMainLoopThread"
Update List end # 1 @ "QtMainLoopThread"
Update List end # 0 @ "QtMainLoopThread"


Here is the way I handle JNI calls:
void JniHandler:: stateChanged(JNIEnv *, jobject, jint newState) {
auto* pInstance = JniHandler::instance();
if(pInstance)
{
QMetaObject::invokeMethod(pInstance, [pInstance , newState] {
...
});
 }
}

I tried to change QMetaObject::invokeMethod call to add ' 
Qt::QueuedConnection', but didn't change anything.
I also change to use QTimer::singleShot():
if(pInstance)
{
QEventLoop myLoop;
Q_UNUSED(myLoop)
QTimer::singleShot(0, pInstance, [pInstance , newState] {
...
});
 }

But still have the same issue.

How is this possible?
What I am doing wrong?

Best regards

Fabrice Mousset

___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] LinuxFB rotation configuration

2020-07-06 Thread Fabrice Mousset | GEOCEPT GmbH
Hi,

You can find it simply with a little help from google/qwant/duckduckgo/ect.

  *   
https://stackoverflow.com/questions/56601993/how-to-rotate-a-qt5-application-using-the-linux-framebuffer

To summarize:

  1.  Without changing code :
QT_QPA_PLATFORM=linuxfb:fb=/dev/fb0:rotation=180


  1.  With using QGraphicsScene and QGraphicsView::rotate()

Regards

Fabrice

Von: Interest  Im Auftrag von Ramakanth 
Kesireddy
Gesendet: Montag, 6. Juli 2020 13:44
An: Qt Interest 
Betreff: [Interest] LinuxFB rotation configuration

Hi,

As there is an environment variable QT_QPA_EGLFS_ROTATION to specify the 
rotation applied to software rendered content in QWidget based applications.

Can you let me know if we have similar environment variable for LinuxFB to 
rotate Qt5 widget applications?

Thanks and Regards,
Ramakanth
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] unexpected result from QString::compare

2020-05-08 Thread Fabrice Mousset | GEOCEPT GmbH
Perhaps you should use QString::localeAwareCompare() ?

BR

Fabrice

> -Ursprüngliche Nachricht-
> Von: Interest  Im Auftrag von Hamish
> Moffatt
> Gesendet: Freitag, 8. Mai 2020 08:27
> An: Qt Interest 
> Betreff: [Interest] unexpected result from QString::compare
> 
> I'm trying to sort a list of strings where umlauts are involved, and not 
> getting
> the answer I expect from QString::compare(). My sample code is:
> 
>          auto a = QStringLiteral("Äbc");
>          auto b = QStringLiteral("BCD");
>          auto c = a.compare(b);
>          qDebug() << a << b << c;
> 
> This produces the output:
> 
> "Äbc" "BCD" 130
> 
> which indicates that Äbc should be sorted after "BCD".
> 
> I get the same result when I load the strings through QTranslator so I don't
> believe there's any editor/encoding issue going on.
> 
> I seem to get the right result when I let QListWidget sort the items for me
> though.
> 
> 
> What am I missing?
> 
> 
> thanks,
> 
> Hamish
> 
> 
> ___
> Interest mailing list
> Interest@qt-project.org
> https://lists.qt-project.org/listinfo/interest
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] Should onImageSaved give a URL?

2020-01-23 Thread Fabrice Mousset | GEOCEPT GmbH
Hello,

I found this documentation entry very interesting about url vs string handling 
in QML/JavaScript
https://doc.qt.io/qt-5/qml-url.html

BR

Fabrice

> -Ursprüngliche Nachricht-
> Von: Interest  Im Auftrag von Jason H
> Gesendet: Mittwoch, 22. Januar 2020 21:53
> An: "Jérôme Godbout" 
> Cc: Thiago Macieira ; interest@qt-project.org
> Betreff: Re: [Interest] Should onImageSaved give a URL?
> 
> Wow. So in the intervening tie between replies I did some searching and
> thought this was a face-palm moment, but not event the experts know
> about Qt.resolvedUrl() https://doc.qt.io/qt-5/qml-qtqml-
> qt.html#resolvedUrl-method
> image.souce = Qt.resolvedUrl(path);
> 
> So I'll save the face-palm for another time.  I'm still not sure why
> onImageCaptured isn't using a url?
> 
> 
> 
> > Sent: Wednesday, January 22, 2020 at 3:07 PM
> > From: "Jérôme Godbout" 
> > To: "Thiago Macieira" ,
> > "interest@qt-project.org" 
> > Subject: Re: [Interest] Should onImageSaved give a URL?
> >
> > For Qml make a c++ function something like: Q_INVOKABLE static QUrl
> > makeUrl(const QString& path); It the easiest and reusable helper function
> for Qml, we do have a FileSystemHelper , since JS is not great to manipulate
> path and files.
> >
> > -Original Message-
> > From: Interest  On Behalf Of Thiago
> > Macieira
> > Sent: January 22, 2020 3:00 PM
> > To: interest@qt-project.org
> > Subject: Re: [Interest] Should onImageSaved give a URL?
> >
> > On Wednesday, 22 January 2020 11:00:41 PST Jason H wrote:
> > > > > onImageSaved: {
> > > > > var url = "file://"+path;
> > > >
> > > > NEVER construct a URL like this.
> > >
> > > Then how should it be done?
> >
> > I don't know about QML/JS, but in C++ use QUrl::fromLocalFile. There must
> be something equivalent in JS.
> >
> > --
> > Thiago Macieira - thiago.macieira (AT) intel.com
> >   Software Architect - Intel System Software Products
> >
> >
> >
> > ___
> > Interest mailing list
> > Interest@qt-project.org
> > https://lists.qt-project.org/listinfo/interest
> > ___
> > Interest mailing list
> > Interest@qt-project.org
> > https://lists.qt-project.org/listinfo/interest
> >
> ___
> Interest mailing list
> Interest@qt-project.org
> https://lists.qt-project.org/listinfo/interest
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] Binding based on typeof doesn't work any more

2019-10-17 Thread Fabrice Mousset | GEOCEPT GmbH
Hi Sebastian,

Can you try this (I preferred using !! to verify if a variable is defined and 
not null):
@
text: !!Controller ?  Controller.triedSteps : “”
@

BR

Fabrice

Von: Interest  Im Auftrag von m...@herrdiel.de
Gesendet: Donnerstag, 17. Oktober 2019 12:41
An: interest@qt-project.org
Betreff: Re: [Interest] Binding based on typeof doesn't work any more


Hi again,

I've found a better (JavaScript-) workaround without a dummy property:

@

text: { return ((Controller === "undefined" || !Controller) ? "" : 
Controller.triedSteps) }

@
But still: Why has the behavior been (apparently) changed at all in the first 
place? Or is it a bug after all?

BR
Sebastian

Am 17.10.2019 um 09:20 schrieb m...@herrdiel.de:

Hi,



I have a simple Label that has to show a property of a rootProperty, the latter 
not yet being created when the qml is loaded/created. Quite frequently I use 
this construct and it did work perfectly in older Qt versions (something before 
12.1 - that's the earliest I have installed now):

@

//[main.qml, inside a Label]

text: typeof Controller === "undefined" ? "" : Controller.successfulSteps

@

Now this doesn't show anything anymore. The following workaround does show the 
desired result:

@

property string dummy: ""

text: dummy+(typeof Controller === "undefined" ? "" : 
Controller.successfulSteps)

@

This seems very hackish. Is there a better way to achieve this? Why has the 
behavior been (apparently) changed at all in the first place?

The Controller has been set as a root property after loading the QML page:

@

//[main.cpp]

QQmlApplicationEngine engine;

engine.load(QUrl(QStringLiteral("qrc:/main.qml")));

Controller controller();

engine.rootContext()->setContextProperty("Controller", 
QVariant::fromValue());

@



I've asked this in forum.qt.io before 
(https://forum.qt.io/topic/107828/binding-based-on-typeof-doesn-t-work-any-more)



BR

Sebastian

--

http://www.classintouch.de - Tablet-Software für Lehrer



___

Interest mailing list

Interest@qt-project.org

https://lists.qt-project.org/listinfo/interest

--

http://www.classintouch.de - Tablet-Software für Lehrer
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] QEventLoop ::hasPendingEvents() replacement?

2019-06-26 Thread Fabrice Mousset | GEOCEPT GmbH
Hi Thiago,

thank's a lot for you answer and for your explanation.
Sadly for me, replacing with true/false is not an alternative for my use case.
I will have to rework the whole process.
I have a worker class (with his own thread), and before allowing a new task to 
be started I have to be sure previous task has been finished.
Depending on the type of task there are more or less slots which are triggered 
and depending on the parameter each slots could also trigger another slots.
hasPendingEvents() was a very attractive solution for my use case, too bad for 
me!

Fabrice Mousset

> -Ursprüngliche Nachricht-
> Von: Interest  Im Auftrag von Thiago
> Macieira
> Gesendet: Dienstag, 25. Juni 2019 18:09
> An: interest@qt-project.org
> Betreff: Re: [Interest] QEventLoop ::hasPendingEvents() replacement?
> 
> On Tuesday, 25 June 2019 08:00:02 PDT Fabrice Mousset | GEOCEPT GmbH
> wrote:
> > Hi all,
> >
> > Since Qt 5.3 QAbstractEventDispatcher::hasPendingEvents() has been set
> > "obsolete". Is there an alternate way to know if a QEventLoop has
> > pending events?
> 
> The reason it's obsolete is that it's a race condition. Since the race can't 
> be
> fixed, there will be no replacement.
> 
> I suggest you replace the call with "true" or "false", depending on how your
> code around it would react to an event being posted by another thread at
> just the wrong moment.
> 
> --
> Thiago Macieira - thiago.macieira (AT) intel.com
>   Software Architect - Intel System Software Products
> 

___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


[Interest] QEventLoop ::hasPendingEvents() replacement?

2019-06-25 Thread Fabrice Mousset | GEOCEPT GmbH
Hi all,

Since Qt 5.3 QAbstractEventDispatcher::hasPendingEvents() has been set 
"obsolete".
Is there an alternate way to know if a QEventLoop has pending events?

Best regards

Fabrice Mousset
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] QtWebAssembly license question

2019-04-17 Thread Fabrice Mousset | GEOCEPT GmbH
Thank you for the link.

And no, I don’t have a commercial license for Qt. Qt LGLP licensed part is 
enough for my needs.
I will have to deal with JavaScript then.

Regards

Fabrice

Von: Jason H 
Gesendet: Dienstag, 16. April 2019 16:28
An: Fabrice Mousset | GEOCEPT GmbH 
Cc: inter...@lists.qt-project.org
Betreff: Re: [Interest] QtWebAssembly license question

Check out: 
https://blog.qt.io/blog/2018/11/19/getting-started-qt-webassembly/#comment-1206267

You can always license it commercially. Commercial licesensees are not boung by 
GPL in Qt. Since you have a "boss" you're probably using Qt commercially. IANAL.

Sent: Tuesday, April 16, 2019 at 7:56 AM
From: "Fabrice Mousset | GEOCEPT GmbH" 
mailto:fabrice.mous...@geocept.com>>
To: "inter...@lists.qt-project.org<mailto:inter...@lists.qt-project.org>" 
mailto:inter...@lists.qt-project.org>>
Subject: [Interest] QtWebAssembly license question
Hello,

before starting QtWebAssembly evaluation, I would like to know what are the 
“limitation” of the GPL Version?
Does it mean that everything I will develop using QtWebAssembly must be GPL?

At this time, we have developed our Web frontend using JavaScript base kits, 
but I am not a JavaScript fan, I would prefer do the development with C++/QML.
But, if all have to be GPLed, my boss would not agree.

I am a software developer and not a lawyer, so could someone give me more 
information about this point?
I hope the is the right mailing-list to post this kind of question?

Best regards

Fabrice Mousset
___ Interest mailing list 
Interest@qt-project.org<mailto:Interest@qt-project.org> 
https://lists.qt-project.org/listinfo/interest
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] using a custom class as parameter of signal/slot, used in QML

2019-03-01 Thread Fabrice Mousset | GEOCEPT GmbH
Hi Sylvain,

It is not so complicated, when passing an object instance to QML (it can only 
by pointers of QObject based classes), if the instance doesn’t have a parent, 
the QML Engine take ownership of the object and delete if when it is no more 
needed.
If the instance has a parent, then QML Engine don’t try to delete it. It is the 
parent which will delete the instance, at least when parent is deleted.
So, there is no memory leak issue.

Best regards

Fabrice

Von: Interest  Im Auftrag von Sylvain Pointeau
Gesendet: Freitag, 1. März 2019 17:08
An: Jason H 
Cc: Qt Project 
Betreff: Re: [Interest] using a custom class as parameter of signal/slot, used 
in QML

Hi Jason,

thank you for the link, I did have a look but they are doing the same, with a 
comment "// parent-less QObject -> ownership transferred to the JS engine"

but what if there was no connection, or consumed by another object, then I 
guess there will be a memory leak?

I don't feel comfortable sending pointer to objects through the signals, the 
ownership for me is not clear.
I guess there is no real solution, except to avoid using objects in signals if 
QML is a consumer?

it is really puzzling me...

Best regards,
Sylvain


On Fri, Mar 1, 2019 at 4:12 PM Jason H mailto:jh...@gmx.com>> 
wrote:
Check out qtmultimedia/examples/multimedia/video/qmlvideofilter_opencl fo the 
filter result types. I think that's what you want?

I find it easier to code and work with to just rely on QVariant conversion. 
QVariantList and QVariantMap are transparently converted to JS Objects.

Sent: Friday, March 01, 2019 at 6:43 AM
From: "Sylvain Pointeau" 
mailto:sylvain.point...@gmail.com>>
To: "Qt Project" mailto:interest@qt-project.org>>
Subject: [Interest] using a custom class as parameter of signal/slot, used in 
QML
Dear all,

I understood how to use a struct / simple class as a parameter of a signal / 
slot, and it works well by value.

However as soon as we have to declare the type for QML, it is not good anymore.
It seems that it must be derived from QObject and passed by pointer.

Do I understand well that the QML world does only accept pointers on QObject?

However I don't understand, who owns the pointer of the custom class (derived 
from QObject) and who actually deletes it?
(I tried a sharepointer but QML does not know how to handle it)

Do you have any idea?

Best regards,
Sylvain


___ Interest mailing list 
Interest@qt-project.org 
https://lists.qt-project.org/listinfo/interest
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest