[Interest] Is it safe to use QString::utf16() as a Windows wchar_t*?

2017-11-09 Thread Nikos Chantziaras

On Windows, I use this:

  void func(const wchar_t*);
  QString s;

  // ...

  func(reinterpret_cast(s.utf16()));

This saves an allocation, a copy and a free since I don't have to use 
QString::toWCharArray(). However, is this actually safe? "It seems to 
work," and AFAIK, QString::d->data() is already in the format and 
encoding Windows excepts a wchar_t* to be. Is this correct?


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


[Interest] Qt 5.9.1 for Android 4.0

2017-11-09 Thread Filip Piechocki
Hi,
I would like to use Qt 5.9.1 on Android 4.0 but docs say that at least
Android 4.1 is required. Is there any workaround for that? Like for example
some module requires it and we can just not use it in our deployment? What
in Qt 5.9.1 requires API level 16?

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


Re: [Interest] Is it safe to use QString::utf16() as a Windows wchar_t*?

2017-11-09 Thread Giuseppe D'Angelo

Il 09/11/2017 10:15, Nikos Chantziaras ha scritto:

This saves an allocation, a copy and a free since I don't have to use
QString::toWCharArray(). However, is this actually safe? "It seems to
work," and AFAIK, QString::d->data() is already in the format and
encoding Windows excepts a wchar_t* to be. Is this correct?


It is safe. QString is UTF-16 encoded (same code unit size as for 
wchar_t on Windows), and Windows APIs accepting wchar_t expect a 
NUL-terminated UTF-16 string as a wchar_t*, which is exactly what 
utf16() provides.


See also various of such usages into Qt itself, e.g.


https://code.woboq.org/qt5/qtbase/src/corelib/io/qfilesystemengine_win.cpp.html#387



Cheers,
--
Giuseppe D'Angelo | giuseppe.dang...@kdab.com | Senior Software Engineer
KDAB (UK) Ltd., a KDAB Group company | Tel: UK +44-1625-809908
KDAB - Qt, C++ and OpenGL Experts



smime.p7s
Description: Firma crittografica S/MIME
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Is it safe to use QString::utf16() as a Windows wchar_t*?

2017-11-09 Thread Konstantin Tokarev


09.11.2017, 12:16, "Nikos Chantziaras" :
> On Windows, I use this:
>
>    void func(const wchar_t*);
>    QString s;
>
>    // ...
>
>    func(reinterpret_cast(s.utf16()));
>
> This saves an allocation, a copy and a free since I don't have to use
> QString::toWCharArray(). However, is this actually safe? "It seems to
> work," and AFAIK, QString::d->data() is already in the format and
> encoding Windows excepts a wchar_t* to be. Is this correct?

Yes, if you make sure this code is used only on Windows.
You may want to add static assert that sizeof wchar_t == sizeof ushort

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

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


Re: [Interest] Need advice to add tests to an existing, project

2017-11-09 Thread Roland Hughes


On 11/08/2017 04:02 AM, Christian Gagneraud wrote:

On 8 November 2017 at 13:35, Roland Hughes  wrote:
Back in the days of the VAX 11/750 all of that microcode (what it was called
I know VACOS (VAcuum Cleaner Operated System) but I do not know VAX, sorry! ;)

This site has a picture, but pretty much everything else they list is wrong.
http://gunkies.org/wiki/VAX-11/750

A bit better write up. The first OS to run on it was VMS. Later there 
was Ultrix and other things.

https://en.wikipedia.org/wiki/VAX-11

VMS was and still is the operating system created by God.  When it 
posolutely absitivly __has__ to work it goes on VMS. VMS clusters (the 
only real clusters) now called OpenVMS clusters, have contiguous uptimes 
measured in decades. The vast majority of systems written for and still 
running on this platform were designed to run correctly long after the 
human race is extinct. That's not a joke. Most every nuclear power plant 
in the world, vast majority of steel and paper mills, any and every 
place a really bad thing will happen if a worthless PC OS was used.


If you search around you can find, it's either the Irish or the British 
railway system has been running for over 17 years of contiguous up time.


If you want to know how to program on it, you can find a copy of this:
http://theminimumyouneedtoknow.com/app_book.html
Actually, Dr. Dobb's decided that book is one of the few books which 
should be on every programmer's book shelf

http://www.drdobbs.com/tools/developers-reading-list/232500396?pgno=6





then) was on a cassette tape you turned the key to boot from. Whole menu of
diagnostics. Today we see a good number of systems returning to built in
test and calibration code.

Yeah, that completely true. But I see these as "system test", not unit test.
I don't think i want to run my system tests from QtC. Sounds like a click bait.
You could argue, that using Boot2Qt with their qemu stuff, you could
achieve that.
But I still think it's the wrong abstraction level.
A simulated Boot2Qt always runs in a x86 vm. It does boot the same
embedded linux distro but it doesn't boot on the same virtualised
hardware. I guess you could tweak the arch in Yocto, maybe... is it
worth?

Anyway, it's an interesting topic, for example are we talking factory
site auto-tests (eg. flash) or customer site auto-test (eg. remote
update)?
How much HW can you emulate/simulate that will make your tests meaningful?



"All life is sacred" she uttered while eating a steak.

Sorry, your viewpoint reminded me of a snippet of a novel I've returned 
to working on and have been serializing in un-edited form on an authors 
blog.


http://www.interestingauthors.com/blog/fiction/my-orphan-pt-1/

It will be a few days yet before the characters have the discussion 
about "All life is sacred" and humans being forced to eat other things 
which were once living, therefore "all" has a rather scoped definition.


Here, your definition of "unit" is rather scoped. It's not your fault. 
If you actually went to college for programming (be surprised how many 
in this field never did) and you were taught real logic, without PASCAL 
as part of the course, you had instructors teaching you each function 
required a "unit test." This was college. You were learning and this was 
all you had to work with, the single function you had just written.


In there defense, from the 1970s through to the late 1980s, many, many 
programmers were writing either for commercial sale, or in-house use, 
"library" functions. When C finally came out there were, perhaps 
thousands, of C function libraries for sale during days of DOS. Screen 
libraries, indexed file IO libraries, "super functions," the list went 
on and on. Some of it would still be useful today if the companies which 
wrote them hadn't went out of business without OpenSourcing the license. 
Other exist only on 5.25" floppies few can even read. "The C-Users 
Journal" used to let you purchase 5.25" floppies of all kinds of code 
written by staff and contributors. All of it is long since gone. Some of 
it would still be useful today.


When it comes to the world of embedded systems, "unit" has a much larger 
meaning and for good reason. Take something like a patient monitor. Some 
little device which puts a user interface and some control software into 
a box which then includes:


1) A blood pressure cuff pump with pressure sensors
2) An SP/O2 finger clip unit with current sensors
3) A temperature unit.

There could be other things in the monitor as well, but let us just 
assume this set. Each of these things is a "unit." The bundling of all 
of them into one device is also a "unit." Why does this terminology matter?


Unitized parts.

Each "unit" has to endure some, potentially 7+ years long, clinical 
trial/testing process in a regulated environment. I don't remember the 
exact wording of the FDA training, but, the higher the potential for 
"adverse outcome" the more intense and lengthy the testing pr

Re: [Interest] QtMqtt

2017-11-09 Thread Filip Piechocki
Hi,
Was playing a bit with QtMqtt and written some example publisher that
shares files from a specific directory. Each file contents is sent as a one
message on /dirName/fileName topic so a subscriber subscribes on /dirName/+

Along the files there was an 35MB mp4 file (so way below MQTT's ~256MB
limit). And it was not sent. I've debugged this and the cause seems to be
data.constData() in QMqttControlPacket::appendRaw() - m_payload.size() does
not change after append while it was appending 35MB bytearray. Removing
.constData() solves the issue - data is properly appended to payload and
subscriber got this message. Is there any reason for constData() there?
Same in append() - also constData is used there.

Another thing is that QMqttConnection::writePacketToTransport() checks if
_any_ bytes were written to QIODevice and what about case where actually
written byte count is _less_ than what we wanted to write?

BR,
Filip

On Oct 10, 2017 09:35, "Maurice Kalinowski" 
wrote:

> Hi,
>
> Only with limited network right now, but the repo has been opened
> yesterday evening and you can find it here
> https://codereview.qt-project.org/#/admin/projects/qt/
> qtmqtt
> 
>
> Also jira has a component for it.
>
> Be,
> Maurice
>
>
> Outlook for Android  herunterladen
>
> --
> *From:* Filip Piechocki 
> *Sent:* Tuesday, October 10, 2017 8:34:07 AM
> *To:* Maurice Kalinowski
> *Cc:* interest@qt-project.org Interest
> *Subject:* Re: [Interest] QtMqtt
>
> Hi,
> so how is it going? QtWS starts today, QtMqtt was mentioned in Qt 5.10
> beta release yesterday but I cannot find it anywhere...
>
> BR,
> Filip
>
> On Mon, Sep 25, 2017 at 11:05 AM, Maurice Kalinowski <
> maurice.kalinow...@qt.io> wrote:
>
>> Hi Filip,
>>
>>
>>
>> I’m afraid to say “not yet”. We’ve been struggling with getting the
>> infrastructure in place (with positive updates over the weekend). Currently
>> there are logistical items to be done (license header updates, etc.), but
>> we are progressing nicely now.
>>
>>
>>
>> The aim is to have everything available (also Qt Knx) within the Qt World
>> Summit timeframe. Probably, or hopefully, earlier.
>>
>>
>>
>> BR,
>>
>> Maurice
>>
>>
>>
>>
>>
>> *From:* Interest [mailto:interest-bounces+maurice.kalinowski=
>> qt...@qt-project.org] *On Behalf Of *Filip Piechocki
>> *Sent:* Friday, September 22, 2017 3:10 PM
>> *To:* interest@qt-project.org Interest 
>> *Subject:* [Interest] QtMqtt
>>
>>
>>
>> Hi,
>>
>> It's been over a month since the QtMqtt blog post (
>> http://blog.qt.io/blog/2017/08/14/introducing-qtmqtt-protocol/) but I
>> can't find the code to download. Is it already available somewhere?
>>
>>
>>
>> Best regards,
>>
>> Filip Piechocki
>>
>
>
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QtMqtt

2017-11-09 Thread Maurice Kalinowski
In the middle of another change, but try to change it to: 
m_payload.append(data.constData(), data.size());

Reason is that at around 35MB you get a null, hence it stops. If you specify 
the size of the data, QByteArray will take the argument as for granted.

Maurice


From: Filip Piechocki [mailto:fpiecho...@gmail.com]
Sent: Thursday, November 9, 2017 3:57 PM
To: Maurice Kalinowski 
Cc: interest@qt-project.org Interest 
Subject: Re: [Interest] QtMqtt

Hi,
Was playing a bit with QtMqtt and written some example publisher that shares 
files from a specific directory. Each file contents is sent as a one message on 
/dirName/fileName topic so a subscriber subscribes on /dirName/+

Along the files there was an 35MB mp4 file (so way below MQTT's ~256MB limit). 
And it was not sent. I've debugged this and the cause seems to be 
data.constData() in QMqttControlPacket::appendRaw() - m_payload.size() does not 
change after append while it was appending 35MB bytearray. Removing 
.constData() solves the issue - data is properly appended to payload and 
subscriber got this message. Is there any reason for constData() there? Same in 
append() - also constData is used there.

Another thing is that QMqttConnection::writePacketToTransport() checks if _any_ 
bytes were written to QIODevice and what about case where actually written byte 
count is _less_ than what we wanted to write?

BR,
Filip

On Oct 10, 2017 09:35, "Maurice Kalinowski" 
mailto:maurice.kalinow...@qt.io>> wrote:
Hi,
Only with limited network right now, but the repo has been opened yesterday 
evening and you can find it here
https://codereview.qt-project.org/#/admin/projects/qt/qtmqtt
Also jira has a component for it.
Be,
Maurice

Outlook for Android herunterladen


From: Filip Piechocki mailto:fpiecho...@gmail.com>>
Sent: Tuesday, October 10, 2017 8:34:07 AM
To: Maurice Kalinowski
Cc: interest@qt-project.org Interest
Subject: Re: [Interest] QtMqtt

Hi,
so how is it going? QtWS starts today, QtMqtt was mentioned in Qt 5.10 beta 
release yesterday but I cannot find it anywhere...

BR,
Filip

On Mon, Sep 25, 2017 at 11:05 AM, Maurice Kalinowski 
mailto:maurice.kalinow...@qt.io>> wrote:
Hi Filip,

I’m afraid to say “not yet”. We’ve been struggling with getting the 
infrastructure in place (with positive updates over the weekend). Currently 
there are logistical items to be done (license header updates, etc.), but we 
are progressing nicely now.

The aim is to have everything available (also Qt Knx) within the Qt World 
Summit timeframe. Probably, or hopefully, earlier.

BR,
Maurice


From: Interest 
[mailto:interest-bounces+maurice.kalinowski=qt...@qt-project.org]
 On Behalf Of Filip Piechocki
Sent: Friday, September 22, 2017 3:10 PM
To: interest@qt-project.org Interest 
mailto:interest@qt-project.org>>
Subject: [Interest] QtMqtt

Hi,
It's been over a month since the QtMqtt blog post 
(http://blog.qt.io/blog/2017/08/14/introducing-qtmqtt-protocol/) but I can't 
find the code to download. Is it already available somewhere?

Best regards,
Filip Piechocki

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


[Interest] Embed MyScript editor in QWidget?

2017-11-09 Thread Patrick Stinson
Hello!

Has anyone successfully embedded a MyScript UIView in a QWidget for handwriting 
recognition? I am no iOS expert, thought I would ask before I spend two weeks 
reading Apple docs to sort out the delegate/viewcontroller/etc mess.

Thanks!
-Patrick

smime.p7s
Description: S/MIME cryptographic signature
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Is it safe to use QString::utf16() as a Windows wchar_t*?

2017-11-09 Thread André Pönitz
On Thu, Nov 09, 2017 at 11:15:28AM +0200, Nikos Chantziaras wrote:
> On Windows, I use this:
> 
>   void func(const wchar_t*);
>   QString s;
> 
>   // ...
> 
>   func(reinterpret_cast(s.utf16()));
> 
> This saves an allocation, a copy and a free since I don't have to use
> QString::toWCharArray(). However, is this actually safe? "It seems to work,"
> and AFAIK, QString::d->data() is already in the format and encoding Windows
> excepts a wchar_t* to be. Is this correct?

As others indicated, yes, it's safe, under the conditions you specified.

Whether it makes sense to sacrifice e.g. platform independence in user
code for one saved string copy is a different question, very likely
with a different answer.

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