Re: [Interest] Qt6 : QPA qxcb - Ubuntu 20.04 dev libraries dependencies

2021-01-26 Thread Nicholas Yue
Turns out when I pasted a block of sudo apt-get install command to install
the required dependencies, not all of them ran.

Once I have ensure that all the dependencies are properly installed,
libqxcb*.so was built on Ubuntu 20.04 for Qt6

Cheers

On Sun, 24 Jan 2021 at 15:02, Andreas Buhr  wrote:

> Hi Nicholas,
>
> On 24.01.21 18:42, Nicholas Yue wrote:
> >I am troubleshooting the failure to configure Qt6 qxcb for building
> > on Ubuntu 20.04
> >
> >A number of sites I saw references 18.04 which I tried to adapt but
> > to no avail.
> >
> >Anyone know of the canonical list of dependencies required to build
> > Qt6 with qxcb on Ubuntu 20.04 ?
>
> I guess you are familiar with these guidelines:
> https://wiki.qt.io/Building_Qt_5_from_Git
>
> Could you maybe provide more details about the problem? What did you
> try? Into what problem did you run?
>
> best,
> Andreas
>
> --
> Andreas Buhr
> Senior Software Engineer
>
> The Qt Company
> Erich-Thilo-Str. 10
> 12489 Berlin
> Germany
> andreas.b...@qt.io
> www.qt.io
>
> Geschäftsführer: Mika Pälsi,
> Juha Varelius, Jouni Lintunen
> Sitz der Gesellschaft: Berlin,
> Registergericht: Amtsgericht
> Charlottenburg, HRB 144331 B
> ___
> 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] QVariant toBool() not working correctly?

2021-01-26 Thread Kevin André
Hi,

On Tue, Jan 26, 2021 at 5:38 PM Giuseppe D'Angelo via Interest
 wrote:

> You've been bit by a combination of two things, one is Qt not supporting
> the BIT column type natively (that's QTBUG-21326), and mapping it to a
> string. The other that the string you're getting contains a NUL
> (U+), not a literal 0 (U+0030). When converting a QVariant
> containing a string to bool, Qt maps empty strings, the string "0" and
> the string "false" (in any case) to false and everything else to true:
>
> > https://code.qt.io/cgit/qt/qtbase.git/tree/src/corelib/kernel/qvariant.cpp?h=5.12#n344

Thanks Christian and Giuseppe for your help.
I am now using the following workaround:

bool Database::getBool(QVariant v, bool nullValue)
{
if (v.isNull())
return nullValue;

/* workaround for zero BIT value being loaded as "\0" instead of "0" */
if (v == QVariant(QChar(0)))
return false;

return v.toBool();
}


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


Re: [Interest] QVariant toBool() not working correctly?

2021-01-26 Thread Robert Hairgrove

On 26.01.21 17:37, Giuseppe D'Angelo via Interest wrote:


You've been bit (...)

LOL ... pun was intentional, I assume?
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] QVariant toBool() not working correctly?

2021-01-26 Thread Giuseppe D'Angelo via Interest

Hi,

Il 26/01/21 16:52, Kevin André ha scritto:


When reading a zero BIT value from the database, this outputs:

getBool called for: QVariant(QString, "\u")
getBool will convert QVariant(QString, "\u") to bool true

The docs of toBool() claim that toBool should return false for a
string value of "0".
I am using Qt version 5.12.3.
So is this a mismatch between the Qt version of the docs and the Qt
version that I am using? Or am I missing something else here?


You've been bit by a combination of two things, one is Qt not supporting 
the BIT column type natively (that's QTBUG-21326), and mapping it to a 
string. The other that the string you're getting contains a NUL 
(U+), not a literal 0 (U+0030). When converting a QVariant 
containing a string to bool, Qt maps empty strings, the string "0" and 
the string "false" (in any case) to false and everything else to true:



https://code.qt.io/cgit/qt/qtbase.git/tree/src/corelib/kernel/qvariant.cpp?h=5.12#n344


Therefore, work around the issue and do the conversion yourself. (An 
alternative would be using TINYINT to represent bools.)


HTH,
--
Giuseppe D'Angelo | giuseppe.dang...@kdab.com | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts



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


Re: [Interest] QVariant toBool() not working correctly?

2021-01-26 Thread Christian Ehrlicher

Am 26.01.2021 um 16:52 schrieb Kevin André:

Hi,

I am reading a boolean value from a database column with SQL type
"BIT" in MySQL. But I discovered that when a zero is stored in that
column, my program apparently interprets that zero value as a boolean
true value. I traced the problem to the QVariant->bool conversion:

bool Database::getBool(QVariant v, bool nullValue)
{
 qDebug() << "getBool called for:" << v;
 if (v.isNull())
 return nullValue;

 qDebug() << "getBool will convert" << v << "to bool" << v.toBool();
 return v.toBool();
}

When reading a zero BIT value from the database, this outputs:

getBool called for: QVariant(QString, "\u")
getBool will convert QVariant(QString, "\u") to bool true

The docs of toBool() claim that toBool should return false for a
string value of "0".

But your string is not "0" - it's "\0".


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


[Interest] QVariant toBool() not working correctly?

2021-01-26 Thread Kevin André
Hi,

I am reading a boolean value from a database column with SQL type
"BIT" in MySQL. But I discovered that when a zero is stored in that
column, my program apparently interprets that zero value as a boolean
true value. I traced the problem to the QVariant->bool conversion:

bool Database::getBool(QVariant v, bool nullValue)
{
qDebug() << "getBool called for:" << v;
if (v.isNull())
return nullValue;

qDebug() << "getBool will convert" << v << "to bool" << v.toBool();
return v.toBool();
}

When reading a zero BIT value from the database, this outputs:

getBool called for: QVariant(QString, "\u")
getBool will convert QVariant(QString, "\u") to bool true

The docs of toBool() claim that toBool should return false for a
string value of "0".
I am using Qt version 5.12.3.
So is this a mismatch between the Qt version of the docs and the Qt
version that I am using? Or am I missing something else here?


Thanks,

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