Re: [Interest] QThreadPool functionality for QThreads

2017-01-17 Thread Frank Rueter | OHUfx

Hi Thiago,

thanks for your quick reply. I will try and give some more context:
I use the python requests module inside my PySide app to post requests 
to a website. Some of those requests return a lot of data that I need to 
parse to be able to show progress, other requests are file downloads 
that I need progress bars for as they stream onto disk.
I had tried to not use threads and use QApplication.processEvents() for 
each data chunk downloaded, but that made the download about 4-5 times 
slower. Introducing threading made a huge difference.


My app can download a list of files at the same time. Depending on the 
situation and the user request, the list of files to be downloaded can 
happen asynchronously, in other situations they need to be downloaded 
one after the other.


>>All I can tell you is that you don't need to do what you're trying to 
do, since you don't need threads in the first place.
If I can avoid threads to do the above I would be more than happy to 
adjust and get rid of them again, but I haven't managed to find a 
non-threaded approach that doesn't slow down the download significantly.


Cheers,
frank

On 18/01/17 6:26 PM, Thiago Macieira wrote:

On quarta-feira, 18 de janeiro de 2017 17:21:46 PST Frank Rueter | OHUfx
wrote:

Hi,

I got another threading question for the pros out there:

In  my current application I am using QThread objects and
QObject.moveToThread() to enable my GUI to download multiple files while
updating progress bars in the main event loop. This is the respective

As usual, the usual disclaimer: you do not need threads to do networking or
file I/O. The combined overhead of the networking I/O and saving of the files is
unlikely to overwhelm the event loop to the point that the progress bar can't
update smoothly.

I'm not saying impossible, but it's unlikely.


snippet of code:
  self.worker = MyClass()
  self.workerThread = QtCore.QThread()
  self.worker.moveToThread(self.workerThread)

The trouble is when the user wants to download multiple files at once.
In my current implementation that all works fine and I see multiple
progress bars do there thing.
However, there are cases when I need to force the download threads to be
synchronous. I had hoped that I can use QThreadPool with QThreads, but
turns out I need QRunnables in this case, and those don't have the same
signals as QThread.

Why do you need to force them to be synchronous? And synchronous with what?
With each other? Or do you mean sync() in the file saving?

Finally, what does being synchronous have to do with signals?


So my question is:
Is there a good way to use QThreads in a queue which is controlled by
the main thread, or should I re-write my code and subclass QRunnable to
add the signals I need (i.e. the ones that QThread has by default)?

The whole point of QThread is that the code it runs is independent of anything
else. Only the OS scheduler decides when it's time to run it or suspend it.


In the latter case I guess I'd have to inherit from both QObject and
QRunnable, is this ok?

Right.

But we still don't understand what you're trying to do. All I can tell you is
that you don't need to do what you're trying to do, since you don't need
threads in the first place.



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


Re: [Interest] Qt 5.8.0 RC build under windows

2017-01-17 Thread Thiago Macieira
On quarta-feira, 18 de janeiro de 2017 10:04:54 PST Prav wrote:
> Build errors with -no-rtti flag and without -no-rtti flag I gave in previous
> message too
> 
> Previously I build Qt without RTTI with no problems. That is why I had RTTI
> turned off. I prefer "turn on only if necessary" strategy 

-no-rtti is not tested and clearly someone broke it. I've submitted a change 
to remove that option from configure starting with Qt 5.8.1.

Please delete your build and reconfigure without that option. If you were not 
using a shadow build, delete all Makefiles before configuring again.

-- 
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] Qt 5.8.0 RC build under windows

2017-01-17 Thread Prav
Hello, Thiago.

> Did you pass any options related to RTTI to configure?
Already wrote about that in previous message
Build errors with -no-rtti flag and without -no-rtti flag I gave in previous 
message too

Previously I build Qt without RTTI with no problems. That is why I had RTTI 
turned off.
I prefer "turn on only if necessary" strategy :)


> Can you share your configure command-line?
Already shared in previous message )

Does anyone know about requirements of using Win10SDK for Qt 5.8.0? Is Win10SDK 
is really necessary to build Qt even for Win7 or it is bug in Qt build system?

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


[Interest] QThreadPool functionality for QThreads

2017-01-17 Thread Frank Rueter | OHUfx

Hi,

I got another threading question for the pros out there:

In  my current application I am using QThread objects and 
QObject.moveToThread() to enable my GUI to download multiple files while 
updating progress bars in the main event loop. This is the respective 
snippet of code:

self.worker = MyClass()
self.workerThread = QtCore.QThread()
self.worker.moveToThread(self.workerThread)


The trouble is when the user wants to download multiple files at once. 
In my current implementation that all works fine and I see multiple 
progress bars do there thing.
However, there are cases when I need to force the download threads to be 
synchronous. I had hoped that I can use QThreadPool with QThreads, but 
turns out I need QRunnables in this case, and those don't have the same 
signals as QThread.

So my question is:
Is there a good way to use QThreads in a queue which is controlled by 
the main thread, or should I re-write my code and subclass QRunnable to 
add the signals I need (i.e. the ones that QThread has by default)?
In the latter case I guess I'd have to inherit from both QObject and 
QRunnable, is this ok?



Cheers,
frank



--
ohufxLogo 50x50  	*vfx compositing 
 | *workflow customisation and 
consulting * *


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


Re: [Interest] Qt 5.8.0 RC build under windows

2017-01-17 Thread Thiago Macieira
Em terça-feira, 17 de janeiro de 2017, às 11:39:04 PST, Prav escreveu:
> cl -c -FIQtQuickDepends -YuQtQuickDepends
> -Fp.pch\release\Qt5Quick_pch.pch -nologo -Zc:wchar_t -FS -O2 -MD
> -Zc:strictStrings -D_HAS_EXCEPTIONS=0 -W3 -w34100 -w34189 -w44996 -DUNICODE
> -DWIN32 -DQT_NO_URL_CAST_FROM_STRING -DQT_NO_INTEGER_EVENT_COORDINATES
> -D_CRT_SECURE_NO_WARNINGS -DQT_BUILD_QUICK_LIB -DQT_BUILDING_QT
> -D_USE_MATH_DEFINES -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS
> -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS
> -DQT_DISABLE_DEPRECATED_BEFORE=0x040800 -DQT_NO_EXCEPTIONS -DQT_NO_DEBUG
> -DQT_GUI_LIB -DQT_QML_LIB -DQT_NO_QML_DEBUGGER -DQT_NETWORK_LIB
> -DQT_CORE_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_NO_DYNAMIC_CAST -DNDEBUG
> -D_WINDLL

-DQT_NO_DYNAMIC_CAST is there.

Did you pass any options related to RTTI to configure? Can you share your 
configure command-line?

-- 
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] context menu shortcut?

2017-01-17 Thread René J . V . Bertin
Shawn Rutledge wrote:

Hi,

> It’s not in QKeySequence::StandardKey.  There is a table in the QKeySequence
> docs which shows the standard key assignments on each platform.
> 
> Personally I don’t miss that on Linux… it’s just an extra key available for
> some other purpose (I’ve used it as a compose key sometimes, for example).

I don't really miss it on Linux either, but I think that's because I've never 
worked long enough under MSWin with this key in a convenient location, plus 
hitting a key to open a menu and then going back to the mouse or trackpad to 
pick the desired menu item isn't necessarily practical.

But I now have a Qt5-based application which on Mac seems to eat almost 1 out 
of 
every right-button click, and sometimes activates the 1st menu item from the 
context menu immediately. It must be a bug, but a sufficiently hard one to 
trace 
that I'm looking for alternative and reliable ways to open that menu.

FWIW I'm not seeing this when I use the xcb QPA so it may be partly an issue in 
Qt 5.7.1 (partly because not all Qt5 apps behave like this, fortunately).

R.

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


Re: [Interest] Finally about extends my app function ability

2017-01-17 Thread André Somers



I can´t found an explanation of the differences of
/reinterpret_cast/ and /dynamic_cast/, because I can´t found
information about /reinterpret_cast/ in Qt Documentation (5.5.0 Qt
version).


You will probably find that Qt doesn't have much to say about them 
because they are part of the C++ language.


http://en.cppreference.com/w/cpp/language/dynamic_cast
http://en.cppreference.com/w/cpp/language/reinterpret_cast

...and, since you're looking at casting, you should probably know 
about const_cast and static_cast as well:


http://en.cppreference.com/w/cpp/language/const_cast
http://en.cppreference.com/w/cpp/language/static_cast

Also have a look then at the cast operator that Qt _does_ provide: 
qobject_cast: http://doc.qt.io/qt-5/qobject.html#qobject_cast


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


[Interest] Qt Wayland Compositor screen rotation

2017-01-17 Thread Johannes Pointner
Hello everyone,

I just started to look into the new compositor api for wayland and was
wondering if it should be possible to implement a mobile phone like
screen/app rotation using this api?

Thx in advance,
Hannes
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] 5.8.0 QAbstractListModel

2017-01-17 Thread william.croc...@analog.com

On 01/16/2017 09:07 PM, mark diener wrote:

Bill:

I thought I would do a brain dump on what I learned.

If your data is bound by the roleNames() mechanism, then the
dataChanged( ) function works greatl

If your data is retrieved by INVOKABLE functions, then you need to call
the following:

QModelIndex gi = QModelIndex() ;
beginInsertRows(gi,gnrow,gnrow);
endInsertRows();
beginRemoveRows(gi,gnrow,gnrow);
endRemoveRows();



You should always use functions of that sort to notify
views of changes to the underlying model. From my experience
this becomes even more important if you start to use proxy models.


This will force the listview to drop and re-create the component in
the delegate.

Thanks for your feedback.

Marco



On Mon, Jan 16, 2017 at 12:05 PM, Bill Crocker
 wrote:




I do this all of the time and it works fine.

  QModelIndex index = createIndex(row,col);
  emit dataChanged(index,index);




Have you tried it under 5.8.0RC?
It was working under 5.7.1 and before.
What value for column are you using?
For AbstractListModel, I was using 0 (zero)



I am at 5.7
Yes, for a List model, col would always be 0.
Per a previous post, are you adding or removing rows.
If so, was that all reported (emitted) so the views know about it.
Models are a pain in the butt in that if you do not
use them correctly, they will silently misbehave
and not necessarily right away.

You should also use the "ModelTest" class to
point out the mistakes that it can.

Bill

___
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] How to build qt3d editor?

2017-01-17 Thread Dmitry Volosnykh
Hello, Larry.

Would you be so kind to elaborate more on what you have tried so far and
what result were achieved?

Regards.

On Tue, Jan 17, 2017 at 11:36 AM Larry <754833...@qq.com> wrote:

> Is there anyone knows, please!
> os: ubuntu 16.04
>
> Thanks!___
> 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] Qt 5.8.0 RC build under windows

2017-01-17 Thread Prav
Hello, Thiago.

>I want to see the command-line to the compiler
Here is compile command and its output (till next compile file)

cl -c -FIQtQuickDepends -YuQtQuickDepends 
-Fp.pch\release\Qt5Quick_pch.pch -nologo -Zc:wchar_t -FS -O2 -MD 
-Zc:strictStrings -D_HAS_EXCEPTIONS=0 -W3 -w34100 -w34189 -w44996 -DUNICODE 
-DWIN32 -DQT_NO_URL_CAST_FROM_STRING -DQT_NO_INTEGER_EVENT_COORDINATES 
-D_CRT_SECURE_NO_WARNINGS -DQT_BUILD_QUICK_LIB -DQT_BUILDING_QT 
-D_USE_MATH_DEFINES -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS 
-DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS 
-DQT_DISABLE_DEPRECATED_BEFORE=0x040800 -DQT_NO_EXCEPTIONS -DQT_NO_DEBUG 
-DQT_GUI_LIB -DQT_QML_LIB -DQT_NO_QML_DEBUGGER -DQT_NETWORK_LIB -DQT_CORE_LIB 
-DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_NO_DYNAMIC_CAST -DNDEBUG -D_WINDLL 
-IA:\qtt\__\580\qtdeclarative\src\quick -I. 
-IA:\qtt\__\580\qtdeclarative\src\quick -IA:\qtt\__\580\qtdeclarative\include 
-IA:\qtt\__\580\qtdeclarative\include\QtQuick -I..\..\include 
-I..\..\include\QtQuick -IA:\qtt\__\580\qtdeclarative\include\QtQuick\5.8.0 
-IA:\qtt\__\580\qtdeclarative\include\QtQuick\5.8.
 0\QtQuick -I..\..\include\QtQuick\5.8.0 -I..\..\include\QtQuick\5.8.0\QtQuick 
-Itmp -IA:\qtt\__\580\qtbase\include\QtGui\5.8.0 
-IA:\qtt\__\580\qtbase\include\QtGui\5.8.0\QtGui 
-IA:\qt\qtbase\include\QtGui\5.8.0 -IA:\qt\qtbase\include\QtGui\5.8.0\QtGui 
-IA:\qtt\__\580\qtdeclarative\include\QtQml\5.8.0 
-IA:\qtt\__\580\qtdeclarative\include\QtQml\5.8.0\QtQml 
-I..\..\include\QtQml\5.8.0 -I..\..\include\QtQml\5.8.0\QtQml 
-IA:\qtt\__\580\qtbase\include\QtCore\5.8.0 
-IA:\qtt\__\580\qtbase\include\QtCore\5.8.0\QtCore 
-IA:\qt\qtbase\include\QtCore\5.8.0 -IA:\qt\qtbase\include\QtCore\5.8.0\QtCore 
-IA:\qtt\__\580\qtbase\include -IA:\qtt\__\580\qtbase\include\QtGui 
-IA:\qt\qtbase\include -IA:\qt\qtbase\include\QtGui 
-IA:\qtt\__\580\qtdeclarative\include\QtQml -I..\..\include\QtQml 
-IA:\qtt\__\580\qtbase\include\QtNetwork -IA:\qt\qtbase\include\QtNetwork 
-IA:\qtt\__\580\qtbase\include\QtCore -IA:\qt\qtbase\include\QtCore 
-I.moc\release -IA:\qtt\__\580\qtbase\mkspecs\win32-msvc2013 -Fo.ob
 j\release\ @C:\Temp\qsgsoftwarecontext.obj.6564.26031.jom
qsgsoftwarecontext.cpp
qsgabstractsoftwarerenderer.cpp
a:\qtt\__\580\qtbase\include\qtcore\../../src/corelib/global/qglobal.h(1009) : 
error C2825: 'T': must be a class or namespace when followed by '::'

A:\qtt\__\580\qtdeclarative\src\quick\scenegraph\adaptations\software\qsgsoftwarepublicnodes.cpp(101)
 : see reference to function template instantiation 'T 
qt_dynamic_cast_check(X,T *)' being 
compiled
with
[
T=QSGSoftwarePixmapTexture *
,X=QSGTexture *
]
a:\qtt\__\580\qtbase\include\qtcore\../../src/corelib/global/qglobal.h(1009) : 
error C2039: 'dynamic_cast_will_always_fail_because_rtti_is_disabled' : is not 
a member of '`global namespace''
a:\qtt\__\580\qtbase\include\qtcore\../../src/corelib/global/qglobal.h(1009) : 
error C2146: syntax error : missing ';' before identifier 
'dynamic_cast_will_always_fail_because_rtti_is_disabled'
a:\qtt\__\580\qtbase\include\qtcore\../../src/corelib/global/qglobal.h(1009) : 
error C2275: 'T' : illegal use of this type as an expression

A:\qtt\__\580\qtdeclarative\src\quick\scenegraph\adaptations\software\qsgsoftwarepublicnodes.cpp(101)
 : see declaration of 'T'
a:\qtt\__\580\qtbase\include\qtcore\../../src/corelib/global/qglobal.h(1009) : 
error C2065: 'dynamic_cast_will_always_fail_because_rtti_is_disabled' : 
undeclared identifier

A:\qtt\__\580\qtdeclarative\src\quick\scenegraph\adaptations\software\qsgsoftwarepublicnodes.cpp(104)
 : see declaration of 'T'


> Why is RTTI disabled?
All previous versions of Qt I build successfully without RTTI (I did not need 
it and I was glad that Qt did not need it too).
This is not the case any more starting from Qt 5.8.0? Or its more complex ... 
like some modules needs RTTI and some not?


But OK. Let's assume that RTTI is necessary for qtdeclarative. If I remove 
-no-rtti flag from config I get another error message ( Qt 5.8.0 building seems 
not an easy job :) )
First error is in :
qtdeclarative\src\plugins\scenegraph\d3d12\Makefile.Debug 
[.obj\debug\qsgd3d12shadereffectnode.obj] Error 2
and it is :
cl -c -nologo -Zc:wchar_t -FS -Zi -MDd -D_HAS_EXCEPTIONS=0 -GR -W3 
-w34100 -w34189 -w44996 /Fd.obj\debug\qsgd3d12backendd.vc.pdb -DUNICODE -DWIN32 
-DQT_NO_EXCEPTIONS -DQT_PLUGIN -DQT_QUICK_LIB -DQT_GUI_LIB -DQT_QML_LIB 
-DQT_NO_QML_DEBUGGER -DQT_NETWORK_LIB -DQT_CORE_LIB -D_WINDLL 
-IA:\qtt\__\580\qtdeclarative\src\plugins\scenegraph\d3d12 -I. 
-IA:\qtt\__\580\qtdeclarative\include\QtQuick\5.8.0 
-IA:\qtt\__\580\qtdeclarative\include\QtQuick\5.8.0\QtQuick 
-I..\..\..\..\include\QtQuick\5.8.0 -I..\..\..\..\include\QtQuick\5.8.0\QtQuick 
-IA:\qtt\__\580\qtbase\include\QtGui\5.8.0 
-IA:\qtt\__\580\qtbase\include\QtGui\5.8.0\QtGui 

[Interest] How to build qt3d editor?

2017-01-17 Thread Larry
Is there anyone knows, please!
os: ubuntu 16.04

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