Re: [Interest] [Android] Qt machine unique id

2018-10-11 Thread Marek.Floriańczyk
Dnia środa, 10 października 2018 15:50:44 CEST Thiago Macieira pisze:
> On Wednesday, 10 October 2018 13:18:59 PDT Jérôme Godbout wrote:
> > I was hoping some device id was existing, but I will go with android id
> > and
> > make a platform function, with a TODO for the iOS one and trying to figure
> > out to cross the bridge when I get there.
> 
> If there's an ID we could get on Android and it isn't /etc/machine-id,
> please submit either a feature request or a patch implementing it in
> QSysInfo::uniqueMachineId. Ditto for iOS (we already have working code for
> macOS).

Hi

I'm using QSysInfo::uniqueMachineId in Windows environment but on macOS Qt 
5.11.1 does 
not have this implemented so I started using MAC address of network interface. 
Is this code you mention (for macOS) available somewhere or will be released in 
Qt 5.12 ?

Best,
Marek

> 
> It isn't implemented for those because I don't develop for Android or iOS,
> so I didn't do anything beyond superficial search to find out what types of
> IDs exist.


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


[Interest] QJSengine access QObject children

2018-10-11 Thread Eric Lemanisser
Hello,

I'm starting to use QJSEngine in order to make a full QObject hierarchy
scriptable. Calling QJSEngine::newQObject gives access to signals, slots
and properties of the object from the javascript side, but I could not find
the QObject's children in any properties, contrary to what is described in
the documentation http://doc.qt.io/qt-5/qjsengine.html#newQObject :
"Signals and slots, properties *and children* of object are available as
properties of the created QJSValue.". Did I miss something ?

As a workaround I ended up developing the following Q_INVOKABLE member,
which properly returns an array of objects with properties when invoked
from JS side:

QJSValue ScriptWindow::findChildren(const QJSValue &v)

{

const auto engine = qjsEngine(this);

const auto o = v.toQObject();

if(!o || !engine) return {};

const auto children = o->findChildren();

auto res = engine->newArray(children.size());

for(int i = 0; i < children.size(); i++)

{

res.setProperty(i, engine->newQObject(children.at(i)));

}

return res;

}


Shouldn't this boilerplate be integrated in Qt, with the handling of
QObject::findChildren parameters (QString aName and Qt::FindChildOptions) ?
dito for QObject::findChild

Eric Lemanissier
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] [Android] Qt machine unique id

2018-10-11 Thread coroberti .
On Wed, Oct 10, 2018 at 10:53 PM Thiago Macieira
 wrote:
>
> On Wednesday, 10 October 2018 07:00:13 PDT Igor Mironchik wrote:
> > Maybe MAC address of the network interface is good enough for you?
>
> There are some RFCs and internet drafts that recommend creating random or
> pseudo-random MAC addresses, for privacy. In other words, the MAC address
> would change depending on which network you're connected to and often which
> day it is.
>
> I do that for my Linux system for WiFi. Windows 10 has this feature too, but I
> don't remember if it's enabled by default.
>
> https://www.ietf.org/blog/mac-privacy/
>
> --
> Thiago Macieira - thiago.macieira (AT) intel.com
>   Software Architect - Intel Open Source Technology Center

MAC-randomization commonly means that per network (SSID) a MAC address
to be generated and used based on the machine's interface MAC (HW MAC) for
a certain connection and next changed not to be recognized by this network.

However, that doesn't mean that the implementation with overwrite the HW MAC
seen by commands and API. There's no need for that.

This links tells about one such linux distribution, but it seems that
there are no more such cases:
http://papers.mathyvanhoef.com/asiaccs2016.pdf

Are you familiar with any other cases?

There are cases when user with enough privileges can overwrite HW MAC,
and so Qt's way seems to be doing a great job by using other
parameters, not MACs.

Kind regards,
Robert Iakobashvili

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


Re: [Interest] Capture keyPressEvent on QMenuBar/QMenu?

2018-10-11 Thread Frederik Christiani via Interest

On 11-10-2018 02:02, Tony Rietwyk wrote:

Hi Israel,

Try installEventFilter on the menu to see the KeyPress events before 
they are handled by the menu.


In the eventFilter you'll want to look at the events of type
QEvent::ShortcutOverride. Remember to accept() the event if you don't 
want the shortcut action triggered.



Kind regards,
Frederik

--
Frederik Christiani
Viking Software
https://www.vikingsoftware.com/
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] Signals with QByteArray do not work in QML?

2018-10-11 Thread Jason H
So originally, QByteArray was not supported in QML. Then this happened in 5.8: 
http://doc.qt.io/qt-5/qtqml-cppintegration-data.html#qbytearray-to-javascript-arraybuffer

So naturally I tried to emit newData(QByteArray data), but this was not caught 
by my connections:

Connection {
target: shim
onNewData: {
   console.log(data)
}
}

I then tested this with having my slot handleNewData(QByteArray data) emit an 
additional signal hasNewData(bool), added it to the connections, and I was able 
to get it to work.

Is this a bug or am I trying to do eomething known to be wrong?
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Capture keyPressEvent on QMenuBar/QMenu?

2018-10-11 Thread Israel Brewster


On Oct 11, 2018, at 2:54 AM, Frederik Christiani via Interest 
mailto:interest@qt-project.org>> wrote:

On 11-10-2018 02:02, Tony Rietwyk wrote:
Hi Israel,
Try installEventFilter on the menu to see the KeyPress events before they are 
handled by the menu.

In the eventFilter you'll want to look at the events of type
QEvent::ShortcutOverride. Remember to accept() the event if you don't want the 
shortcut action triggered.



Ok, I tried with using an eventFilter, as per the documentation at 
http://doc.qt.io/qt-5/qobject.html#installEventFilter. As a test, I used their 
example code exactly for the implementation of the KeyPressEater class. I tried 
this in two ways: 1) installing the event filter on my QMenuBar object, and 2) 
installing the eventFilter on the base QApplication object, as per the 
documentation at http://doc.qt.io/qt-5/eventsandfilters.html#event-filters, 
which says:

"It is also possible to filter all events for the entire application, by 
installing an event filter on the QApplication or QCoreApplication object. Such 
global event filters are called before the object-specific filters."

When installed on my QMenuBar object, the eventFilter function was *never* 
called, as far as I can determine. When installed on the QApplication object, 
the eventFilter function *was* called as expected - right up until I activated 
a menu. ANY menu - even the Apple menu. At that point, the eventFilter function 
stopped receiving events.

I am running Qt 5.9.6 on MacOS X 10.13 and 10.14 (tried both with the same 
behavior). It sort of appears that the system is taking over the menu bar 
entirely, such that events simply don't make it to my application *at all* when 
the menu is activated. Is something like that a possibility?

---
Israel Brewster
Systems Analyst II
5245 Airport Industrial Rd
Fairbanks, AK 99709
(907) 450-7293
---
Kind regards,
Frederik

--
Frederik Christiani
Viking Software
https://www.vikingsoftware.com/
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

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


Re: [Interest] Capture keyPressEvent on QMenuBar/QMenu?

2018-10-11 Thread Israel Brewster
On Oct 11, 2018, at 8:36 AM, Israel Brewster 
mailto:ibrews...@flyravn.com>> wrote:



On Oct 11, 2018, at 2:54 AM, Frederik Christiani via Interest 
mailto:interest@qt-project.org>> wrote:

On 11-10-2018 02:02, Tony Rietwyk wrote:
Hi Israel,
Try installEventFilter on the menu to see the KeyPress events before they are 
handled by the menu.

In the eventFilter you'll want to look at the events of type
QEvent::ShortcutOverride. Remember to accept() the event if you don't want the 
shortcut action triggered.



Ok, I tried with using an eventFilter, as per the documentation at 
http://doc.qt.io/qt-5/qobject.html#installEventFilter. As a test, I used their 
example code exactly for the implementation of the KeyPressEater class. I tried 
this in two ways: 1) installing the event filter on my QMenuBar object, and 2) 
installing the eventFilter on the base QApplication object, as per the 
documentation at http://doc.qt.io/qt-5/eventsandfilters.html#event-filters, 
which says:

"It is also possible to filter all events for the entire application, by 
installing an event filter on the QApplication or QCoreApplication object. Such 
global event filters are called before the object-specific filters."

When installed on my QMenuBar object, the eventFilter function was *never* 
called, as far as I can determine. When installed on the QApplication object, 
the eventFilter function *was* called as expected - right up until I activated 
a menu. ANY menu - even the Apple menu. At that point, the eventFilter function 
stopped receiving events.

I am running Qt 5.9.6 on MacOS X 10.13 and 10.14 (tried both with the same 
behavior). It sort of appears that the system is taking over the menu bar 
entirely, such that events simply don't make it to my application *at all* when 
the menu is activated. Is something like that a possibility?


In digging deeper into the documentation, I found this: 
http://doc.qt.io/qt-5/osx-issues.html#limitations, which states:

"QMenu objects used in the native menu bar are not able to handle Qt events via 
the normal event handlers. Install a delegate on the menu itself to be notified 
of these changes"

So I guess I need to install a delegate on the menu itself. Can someone point 
me to the documentation for that? Thanks.
---
Israel Brewster
Systems Analyst II
5245 Airport Industrial Rd
Fairbanks, AK 99709
(907) 450-7293
---

---
Israel Brewster
Systems Analyst II
5245 Airport Industrial Rd
Fairbanks, AK 99709
(907) 450-7293
---
Kind regards,
Frederik

--
Frederik Christiani
Viking Software
https://www.vikingsoftware.com/
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

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

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


Re: [Interest] [Android] Qt machine unique id

2018-10-11 Thread Thiago Macieira
On Thursday, 11 October 2018 01:26:47 PDT Marek.Floriańczyk wrote:
> I'm using QSysInfo::uniqueMachineId in Windows environment but on macOS Qt
> 5.11.1 does not have this implemented 

Yes, it does:
https://code.woboq.org/qt5/qtbase/src/corelib/global/
qglobal.cpp.html#_ZN8QSysInfo15machineUniqueIdEv

See the part about "Darwin" on line 2920.

> so I started using MAC address of
> network interface. Is this code you mention (for macOS) available somewhere
> or will be released in Qt 5.12 ?

It was released in Qt 5.11.

But it's somehow broken:

$ tests/manual/qsysinfo/qsysinfo | grep Unique
QSysInfo::machineUniqueId() = 
QSysInfo::bootUniqueId() = 

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center



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


Re: [Interest] [Android] Qt machine unique id

2018-10-11 Thread Thiago Macieira
On Thursday, 11 October 2018 11:26:54 PDT Thiago Macieira wrote:
> But it's somehow broken:
> 
> $ tests/manual/qsysinfo/qsysinfo | grep Unique
> QSysInfo::machineUniqueId() =
> QSysInfo::bootUniqueId() =

As far as I can tell, this is not our fault. This Python script[1] also fails 
to get *any* sysctl. The sysctlbyname() function is returning -1 in the Python 
test but errno remains 0. Debugging the Qt code shows it returns 0 but does 
not fill in the data.

Please complain to Apple.

[1] https://gist.github.com/pudquick/581a71425439f2cf8f09

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center



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


Re: [Interest] Icons on macOS

2018-10-11 Thread Mitch Curtis
It seems that after wiping the build directory and rebuilding it has started 
working. :/

On 10/9/18, 7:12 AM, "Interest on behalf of Mitch Curtis" 
 wrote:

The Qbs docs state that there is no direct equivalent to ICON:

https://doc.qt.io/qbs/porting-to-qbs.html#icon

I’ve got this Qbs code that points to the .xcassets directory:

Group {
name: "macOS (icons)"
condition: qbs.targetOS.contains("macos")
files: ["images/logo/slate.xcassets"]
}

This sets the icon name:

Properties {
condition: qbs.targetOS.contains("macos")
ib.appIconName: "slate-icon-mac"
//bundle.infoPlist: {
//CFBundleIconFile: 
"images/logo/slate.xcassets/slate-icon-mac.appiconset"
//}
}

When you mentioned deploying the icon file to the app bundle I 
double-checked what was in the Resources directory:

Assets.car
slate-icon-mac.icns

So it seems to be there, albeit in the form of an icns file.. not sure 
what’s going on there.

On 10/8/18, 9:58 PM, "Artem Sidyakin"  wrote:

With qmake project file it's just this one line, nothing else is 
required:

ICON = icon.icns

It will deploy the icon file to the app bundle and put the 
corresponding line into Info.plist.

Unfortunately, I don’t know how it is done with Qbs as I never used it.

---
Artem Sidyakin

> On 8 Oct 2018, at 19:15, Mitch Curtis  wrote:
> 
> I’m trying to add icons to an application on macOS. My Qbs file looks 
like this:
> 
> https://github.com/mitchcurtis/slate/tree/master/app/app.qbs
> 
> The generated assetcatalog_generated_info.plist file looks like this:
> 
> 
> http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
> 
> 
>   CFBundleIconFile
>   slate-icon-mac
>   CFBundleIconName
>   slate-icon-mac
> 
> 
> 
> The contents of slate.xcassets:
> 
> 
https://github.com/mitchcurtis/slate/tree/master/app/images/logo/slate.xcassets
> 
> I don’t see the icon in the dock or anywhere else.
> 
> I saw this page:
> 
> 
http://doc.qt.io/qt-5/appicon.html#setting-the-application-icon-on-macos
> 
> It says:
> 
> “The application icon, typically displayed in the application dock 
area, is set by calling QWindow::setWindowIcon() on a window.”
> 
> However, the app that I’m basing my setup on doesn’t do that. It 
actually avoids macOS when it sets the window icon and yet still manages to get 
an icon to show up:
> 
> 
https://github.com/bjorn/tiled/blob/0b01a9c907e6cd6531204c32e36ea51af75f3bfc/src/tiled/mainwindow.cpp#L233
> 
> Another thing is that an asset catalog contains many .png files. I 
was under the impression that the point of it was for the OS to pick the 
correct image based on the metadata provided in the Contents.json file, so how 
would I know which size .png to set?
> 
> The rest of that page describes icns files, which the documentation 
explicitly says to avoid 
(https://developer.apple.com/design/human-interface-guidelines/macos/icons-and-images/app-icon/),
 so it seems like it might be a bit out-dated.
> 
> So, how is this supposed to be done?
> 
> ___
> Interest mailing list
> Interest@qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest



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


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


[Interest] SQL databases and threading

2018-10-11 Thread Konstantin Shegunov
Hello,
Is there any way to tell (besides looking at the sources) if a given SQL
plugin, or single methods of it, is reentrant/thread safe? The docs are
rather evasive on the issue ...
What would be allowed to do if I want to thread the SQL queries? Can I
serialize the exec/prepare and then pull the resultset in another thread?
Ideally I would like to process the results in a thread if possible, even
if I have to serialize the exec.

Currently I'm working with the PQSQL driver, but general answers are
acceptable as well.

Thanks in advance.
Kind regards.
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] SQL databases and threading

2018-10-11 Thread Andrew Ialacci
It is not. You should create a QObject, move that to a thread, and then work 
with the query inside the thread inside the QObject.

I needed to do massive insertion of financial data and ended up writing a 
request / reply interface. Think QNetworkRequest / Reply and then a dispatcher 
to handle the scheduling of jobs.



From: Interest  on behalf of 
Konstantin Shegunov 
Date: Friday, October 12, 2018 at 8:53 AM
To: Interests Qt 
Subject: [Interest] SQL databases and threading

Hello,
Is there any way to tell (besides looking at the sources) if a given SQL 
plugin, or single methods of it, is reentrant/thread safe? The docs are rather 
evasive on the issue ...
What would be allowed to do if I want to thread the SQL queries? Can I 
serialize the exec/prepare and then pull the resultset in another thread?
Ideally I would like to process the results in a thread if possible, even if I 
have to serialize the exec.

Currently I'm working with the PQSQL driver, but general answers are acceptable 
as well.

Thanks in advance.
Kind regards.
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest