[Interest] Qt3D Scene2D Multisampling

2020-06-20 Thread Daniel Proksch
I am attaching a Texture2DMultisample to the output of a Scene2D object in QML 
and I don't see a property to explicitly enable multisample rendering.
Rendering doesn't seem to work (texture stays black) so I am wondering is 
multisampling at all supported by Scene2D?

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


[Interest] QFile + resource + DLL = weird problem

2020-06-20 Thread Alexander Dyagilev

Hello,

My app consist of serveral binaries. Main binary uses some DLLs. One of 
DLLs has resources inside of it. It uses them for its own purposes.


I read resources inside of the DLL using this code:

QFilef(":/promise.js");
Q_ASSERT(f.exists());
if(!f.open(QFile::ReadOnly))
returnerrorFrom(f,__SRCLINE__);
autob=QString::fromUtf8(f.readAll());
mylogex("promise.js:"

Re: [Interest] QDateTime::toString() fails when used in exit handler

2020-06-20 Thread Giuseppe D'Angelo via Interest

Il 19/06/20 22:12, Bernhard Lindner ha scritto:

Can someone tell me what is going wrong here?


There's a wider blanket statement made by Qt: you're not allowed to 
touch _most_ Qt APIs without a QCoreApplication object being alive. 
That's the case here. In detail, QDateTime uses some global that got 
already destroyed by the time your atexit handler runs. But Qt doesn't 
even guarantee that the usage in main() is OK (because there's no QCA 
around).


My 2 c,
--
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] adding widget into a mousePressEvent

2020-06-20 Thread Carlos Agon
Hi Volker

Thanks, it works !

André Pönits thanks to you too. I had made a bad test.

Bye

Carlos

> Le 20 juin 2020 à 18:25, Volker Hilsheimer  a écrit :
> 
> You have to show widgets that you add to parents that are already visible.
> Cheers,
> Volker
> 
> 
> From: Interest  on behalf of Carlos Agon 
> 
> Sent: Saturday, June 20, 2020 10:28:46 AM
> To: interest@qt-project.org 
> Subject: [Interest] adding widget into a mousePressEvent
>  
> Hello 
> 
> I would like to add a button to my view at each time I click, but my code 
> doesn't work, it prints the message "click enter" but nothing is added. What 
> is wrong with this code ?
> 
> thanks
> 
> Carlos (newbie at this list)
> 
> ==
> 
> class ShView :public QFrame {
> protected:
>void mousePressEvent(QMouseEvent *event) override;
> }
> 
> void ShView::mousePressEvent(QMouseEvent *event) {
>std::cout << " click enter " << std::endl;
>QPushButton * child = new QPushButton ("push",this);
> }
> ___
> 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] QDateTime::toString() fails when used in exit handler

2020-06-20 Thread Thiago Macieira
On Friday, 19 June 2020 13:12:17 PDT Bernhard Lindner wrote:
> Can someone tell me what is going wrong here?

Yes, the calendar system in Qt has already been destroyed. You can't format 
dates anymore. QDateTime::date() and QDateTime::time() still work.

In general, don't do anything complex in exit handlers, since most global 
statics will have been destroyed already. SIOF: Static (De)Initialisation 
Order Fiasco.

-- 
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


Re: [Interest] adding widget into a mousePressEvent

2020-06-20 Thread Volker Hilsheimer
You have to show widgets that you add to parents that are already visible.
Cheers,
Volker



From: Interest  on behalf of Carlos Agon 

Sent: Saturday, June 20, 2020 10:28:46 AM
To: interest@qt-project.org 
Subject: [Interest] adding widget into a mousePressEvent

Hello

I would like to add a button to my view at each time I click, but my code 
doesn't work, it prints the message "click enter" but nothing is added. What is 
wrong with this code ?

thanks

Carlos (newbie at this list)

==

class ShView :public QFrame {
protected:
   void mousePressEvent(QMouseEvent *event) override;
}

void ShView::mousePressEvent(QMouseEvent *event) {
   std::cout << " click enter " << std::endl;
   QPushButton * child = new QPushButton ("push",this);
}
___
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] Set manipulation in Qt 6

2020-06-20 Thread André Pönitz
On Sat, Jun 20, 2020 at 08:44:19AM +0200, Vadim Peretokin wrote:
>Being good users open-source of Qt, [1]we're looking into our
>compatibility early on to help report any issues and we're finding this
>compatibility code to be rather problematic from the developer
>experience point of view:
>QMap> customLines;
>QMap customLinesColor;
>// ...
>#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
>auto customLineKeys = customLines.keys();
>QSet missingKeys{customLineKeys.begin(),
>customLineKeys.end()};
>if (!customLinesColor.isEmpty()) {
>auto customLinesColorKeys = customLinesColor.keys();
>QSet
>customLinesColorKeysSet{customLinesColorKeys.begin(),
>customLinesColorKeys.end()};
>missingKeys.subtract(customLinesColorKeysSet);
>}
>#else
>QSet
>missingKeys{customLines.keys().toSet().subtract(customLinesColor.keys()
>.toSet())};
>#endif
>Are we doing it wrong or is this a regression in Qt? ([2]QTBUG-83697)

I don't think you are doing anything wrong here.

The Qt Creator code base currently has the following in a central header:

// Replacement for deprecated Qt functionality

#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
template 
QSet toSet(const QList )
{
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
return list.toSet();
#else
return QSet(list.begin(), list.end());
#endif
}
#endif

template
QSet toSet(const QVector )
{
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
QSet result;
for (const T  : vec) {
result.insert(p);
}
return result;
#else
return QSet(vec.begin(), vec.end());
#endif
}

template
QList toList(const QSet )
{
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
return set.toList();
#else
return QList(set.begin(), set.end());
#endif
}

template 
void addToHash(QHash *result, const QHash 
)
{
#if (QT_VERSION < QT_VERSION_CHECK(5, 15, 0))
result->unite(additionalContents);
#else
result->insert(additionalContents);
#endif
}

and used those functions to replace the previously used member functions.

This is not really nice either, but at least keeps the main application code
free of preprocessor #if's.

Andre'




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


Re: [Interest] Set manipulation in Qt 6

2020-06-20 Thread Giuseppe D'Angelo via Interest

Hi,

Il 20/06/20 08:44, Vadim Peretokin ha scritto:

QMap> customLines;
QMap customLinesColor;
// ...

#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
     auto customLineKeys = customLines.keys();
     QSet missingKeys{customLineKeys.begin(), 
customLineKeys.end()};

     if (!customLinesColor.isEmpty()) {
         auto customLinesColorKeys = customLinesColor.keys();
         QSet 
customLinesColorKeysSet{customLinesColorKeys.begin(), 
customLinesColorKeys.end()};

         missingKeys.subtract(customLinesColorKeysSet);
     }
#else
     QSet 
missingKeys{customLines.keys().toSet().subtract(customLinesColor.keys().toSet())};

#endif



With my hat of the guy going around and deprecating toSet() and friends: 
the rationale for these deprecations is the terrible code that those 
methods encourage, and the



Let's just look at this last line. This is, at a minimum:


customLines.keys()


- 1 temporary allocation + #LINES temporary copies (builds a QList 
copying all the keys from the map)



.toSet()


- #LINES+1 allocations + #LINES copies (builds a QHash copying all the 
values from the list)



customLinesColor.keys().toSet()


- 1+1+#COLOR temporary allocations, 2*#COLOR temporary copies (same, but 
this is completely temporary)



Totals:

- 4 + #LINES + #COLOR allocations
- 2 * #LINES + 2 * #COLOR copies
- 3 + #LINES + 2 * #COLOR destructions at a minimum
- 3 + #COLOR deallocations at a minimum

(Luckily the keys are QStrings, and not something where the copy and 
destruction would be even more expensive, or QList would cause further 
allocations).




There are much better alternatives you can aim for with minimal effort.
Assuming that at the end you do want exactly a QSet, you can port it in 
the slightly more verbose but still straightforward:



QSet customLinesKeys(customLines.keyBegin(), customLines.keyEnd());
{
QSet customLinesColorKeys(customLinesColor.keyBegin(), 
customLinesColor.keyEnd());
customLinesKeys.subtract(customLinesColorKeys);
}


Which saves buildings the temporary QLists. Totals now:

- 2 + #LINES + #COLOR allocations
- #LINES + #COLOR copies
- 1 + #COLOR destructions at a minimum
- 1 + #COLOR deallocations at a minimum



I think it's possible to do even better -- a QMap, by definition, keeps 
its keys in order. Which means now you can use e.g. std::set_difference.


Unfortunately we can't use a QSet as an output -- let's sketch with a 
std::unordered_set for the moment:



std::unordered_set result;
std::set_difference(customLines.keyBegin(), customLines.keyEnd(),
customLinesColor.keyBegin(), customLinesColor.keyEnd(),
std::inserter(result, result.end()));


Cost of this one:

- 1 + (#LINES / #COLOR) allocations
- (#LINES / #COLOR) copies

AKA optimal.

With a QSet, the cost and the code would be identical. The problem is 
that we can't write _that_ code as QSet is not usable with std::inserter 
(QSet lacks a suitable insert() method). Then again, do you _need_ a 
QSet or would a QList output suffice?


(Which brings me to my second crusade, try stop encouraging the usage of 
Qt containers, as their API is full of holes and doesn't play nice with 
algorithms or ranges. But it's enough for this mail.)


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


[Interest] adding widget into a mousePressEvent

2020-06-20 Thread Carlos Agon
Hello 

I would like to add a button to my view at each time I click, but my code 
doesn't work, it prints the message "click enter" but nothing is added. What is 
wrong with this code ?

thanks

Carlos (newbie at this list)

==

class ShView :public QFrame {
protected:
   void mousePressEvent(QMouseEvent *event) override;
}

void ShView::mousePressEvent(QMouseEvent *event) {
   std::cout << " click enter " << std::endl;
   QPushButton * child = new QPushButton ("push",this);
}
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


[Interest] Set manipulation in Qt 6

2020-06-20 Thread Vadim Peretokin
Being good users open-source of Qt, we're 
looking into our compatibility early on to help report any issues and we're
finding this compatibility code to be rather problematic from the developer
experience point of view:

QMap> customLines;
QMap customLinesColor;
// ...

#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
auto customLineKeys = customLines.keys();
QSet missingKeys{customLineKeys.begin(), customLineKeys.end()};
if (!customLinesColor.isEmpty()) {
auto customLinesColorKeys = customLinesColor.keys();
QSet customLinesColorKeysSet{customLinesColorKeys.begin(),
customLinesColorKeys.end()};
missingKeys.subtract(customLinesColorKeysSet);
}
#else
QSet
missingKeys{customLines.keys().toSet().subtract(customLinesColor.keys().toSet())};
#endif

Are we doing it wrong or is this a regression in Qt? (QTBUG-83697
)
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest