Re: [Interest] ´ð¸´: how to block run function of QRunnable class

2013-03-19 Thread Tony Rietwyk
Hi Ken, 

 

Sorry for the confusion - deriving from both QRunnable and QThread is probably 
NOT a good idea - you don't want to create your own QThread - just access the 
static methods: 

 

// Hack to get around Qt strictness...

class TSleepThread: public QThread

{

public:

  static void sleep(unsigned long secs) { QThread::sleep(secs); };

  static void msleep(unsigned long msecs) { QThread::msleep(msecs); };

  static void usleep(unsigned long usecs) { QThread::usleep(usecs); };

};

 

then in your QRunnable derived class: 

 

  ...

  TSleepThread::msleep( 20 );

  ...

 

Regards, 

 

Tony

 

 

From: pengliang(??) [mailto:pengli...@founder.com] 
Sent: Tuesday, 19 March 2013 4:46 PM
To: Tony Rietwyk; interest@qt-project.org
Subject: ??: [Interest]´ð¸´: how to block run function of QRunnable class

 

Hi

I have defined a class derived from Qrunnable and Qthread.

Now, i call sleep in run function, it worked perfect.

 

Thanks

Ken

 

 

  _  

发件人: interest-bounces+pengliang=founder@qt-project.org 
[mailto:interest-bounces+pengliang=founder@qt-project.org] 代表 Tony Rietwyk
发送时间: 2013年3月19日 13:36
收件人: interest@qt-project.org
主题: Re: [Interest]´ð¸´: how to block run function of QRunnable class

 

Hi Ken,

 

In Qt 4, you have to define your own override of QThread and expose the 
protected static sleep methods.   I'm don't know about Qt 5. 

 

Tony

 

 

From: interest-bounces+tony=rightsoft.com...@qt-project.org 
[mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf Of 
pengliang(??)
Sent: Tuesday, 19 March 2013 4:22 PM
To: Amogh Kudari
Cc: Interest@qt-project.org
Subject: [Interest] 答复: how to block run function of QRunnable class

 

Hi

 Thank you.

But I check source code of Qt, QthreadPool is derived from Qobject, not Qthread.

 

 

Thanks

Ken

 

 

 

  _  

发件人: Amogh Kudari [mailto:amogh.kuda...@gmail.com] 
发送时间: 2013年3月19日 11:53
收件人: pengliang(彭亮)
抄送: Interest@qt-project.org
主题: Re: [Interest] how to block run function of QRunnable class

 

Hi Pengliang,

 

  I am not pretty sure but it may be possible as QThreadPoolThread is a 
friend class of Qrunnable class and 

QThreadPoolThread is derived from QThread and QThread has the sleep method.

Hope this helps.

 

Regards,

Amogh.

 

On Tue, Mar 19, 2013 at 8:11 AM, pengliang(彭亮) pengli...@founder.com wrote:

Hi all

 I don’t know how to block run function several seconds of Qrunnable 
class.

 

Andybody know?

 

 

Thanks

Ken

 

 


___
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] 答复: ´ð¸´: how to block run function of QRunnable class

2013-03-19 Thread 彭亮
Hi,

 Yes, you method works perfectly too.

 

But, if Run class derived from Qrunnable and Qthread, is there any problem? Or 
is there any potential risk?

 

 

 

Thanks

Ken

 

 

 



发件人: interest-bounces+pengliang=founder@qt-project.org 
[mailto:interest-bounces+pengliang=founder@qt-project.org] 代表 Tony Rietwyk
发送时间: 2013年3月19日 14:10
收件人: interest@qt-project.org
主题: Re: [Interest]´ð¸´: how to block run function of QRunnable class

 

Hi Ken, 

 

Sorry for the confusion - deriving from both QRunnable and QThread is probably 
NOT a good idea - you don't want to create your own QThread - just access the 
static methods: 

 

// Hack to get around Qt strictness...

class TSleepThread: public QThread

{

public:

  static void sleep(unsigned long secs) { QThread::sleep(secs); };

  static void msleep(unsigned long msecs) { QThread::msleep(msecs); };

  static void usleep(unsigned long usecs) { QThread::usleep(usecs); };

};

 

then in your QRunnable derived class: 

 

  ...

  TSleepThread::msleep( 20 );

  ...

 

Regards, 

 

Tony

 

 

From: pengliang(??) [mailto:pengli...@founder.com] 
Sent: Tuesday, 19 March 2013 4:46 PM
To: Tony Rietwyk; interest@qt-project.org
Subject: ??: [Interest]´ð¸´: how to block run function of QRunnable class

 

Hi

I have defined a class derived from Qrunnable and Qthread.

Now, i call sleep in run function, it worked perfect.

 

Thanks

Ken

 

 



发件人: interest-bounces+pengliang=founder@qt-project.org 
[mailto:interest-bounces+pengliang=founder@qt-project.org] 代表 Tony Rietwyk
发送时间: 2013年3月19日 13:36
收件人: interest@qt-project.org
主题: Re: [Interest]´ð¸´: how to block run function of QRunnable class

 

Hi Ken,

 

In Qt 4, you have to define your own override of QThread and expose the 
protected static sleep methods.   I'm don't know about Qt 5. 

 

Tony

 

 

From: interest-bounces+tony=rightsoft.com...@qt-project.org 
[mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf Of 
pengliang(??)
Sent: Tuesday, 19 March 2013 4:22 PM
To: Amogh Kudari
Cc: Interest@qt-project.org
Subject: [Interest] 答复: how to block run function of QRunnable class

 

Hi

 Thank you.

But I check source code of Qt, QthreadPool is derived from Qobject, not Qthread.

 

 

Thanks

Ken

 

 

 



发件人: Amogh Kudari [mailto:amogh.kuda...@gmail.com] 
发送时间: 2013年3月19日 11:53
收件人: pengliang(彭亮)
抄送: Interest@qt-project.org
主题: Re: [Interest] how to block run function of QRunnable class

 

Hi Pengliang,

 

  I am not pretty sure but it may be possible as QThreadPoolThread is a 
friend class of Qrunnable class and 

QThreadPoolThread is derived from QThread and QThread has the sleep method.

Hope this helps.

 

Regards,

Amogh.

 

On Tue, Mar 19, 2013 at 8:11 AM, pengliang(彭亮) pengli...@founder.com wrote:

Hi all

 I don’t know how to block run function several seconds of Qrunnable 
class.

 

Andybody know?

 

 

Thanks

Ken

 

 


___
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] opengl graphics system status in 4.8.x?

2013-03-19 Thread Simon St James
Hi Thiago,

On Monday 18 Mar 2013 15:55:25 Thiago Macieira wrote:
 On segunda-feira, 18 de março de 2013 20.07.34, Simon St James wrote:
  Currently, performance is surprisingly good considering we are still using
  the raster graphics system where everything is plotted pixel by pixel by
  Qt and then flushed to the canvas after pixel format conversion.  
  However,
  we suspect that we can get significant gains in rendering speed by writing
  a Qt graphics system that uses HTML5 Canvas drawing primitives.
 
 [snip]
 
  So I was wondering whether using Qt's opengl graphics system is feasible?
  I
  heard it was experimental and not pixel-perfect, but I've not heard
  any
  reports that that matched mine, which makes me wonder if I just got very
  unlucky
 
 The OpenGL graphics system in Qt 4 is considered a done experiment, leading
 to the conclusion that an OpenGL graphics system is a very bad idea. The
 code itself never left experimental state and is considered flawed. Do not
 use it.
 
 The experiment itself was a success, since it concluded that we should do
 something entirely different for performance using OpenGL. That's the Qt 5 /
 Qt Quick 2 scene graph.

Sounds pretty decisive, then :) Thanks for the information!

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


Re: [Interest] opengl graphics system status in 4.8.x?

2013-03-19 Thread Till Oliver Knoll


Am 19.03.2013 um 08:01 schrieb Simon St James kdede...@etotheipiplusone.com:

 ...
 The experiment itself was a success, since it concluded that we should do
 something entirely different for performance using OpenGL. That's the Qt 5 /
 Qt Quick 2 scene graph.
 
 Sounds pretty decisive, then :) Thanks for the information!

What does seem to work however - also in Qt 4.8 - is e.g. a QGraphicsView on 
top of a QGLWidget: some (most?) paint operations are then OpenGL accelerated.

Also using a simple QPainter on top of a QGLWidget does accelerate certain 
(most?) paint operations. You have to be careful though not to mix the GL 
state induced by the QPainter and your own GL state (setup with your own 
modelview matrix etc.). See beginNativePaint and friends in the Qt docs.

Not sure whether that helps in your context.

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


Re: [Interest] qt3D and qt5 status

2013-03-19 Thread Alejandro Exojo
2013/3/10 qtnext qtn...@gmail.com:
 I wants to port an existing apps from Qt4 to Qt5. I suppose that all is
 easily portable, but I use qt3D c++ scenegraph to render my opengl stuff. It
 seems that qt3D is not included in qt5 trunk, but has anybody tryed to
 compile qt3D C++ with qt5 ? Does it works for basic feature ?

I just want to point out the following post:

http://www.kdab.com/kdab-contributions-to-qt-5-0-part-5/

In which you can read: For Qt 5.1, KDAB is additionally assuming
maintainership of the Qt3D and QtX11Extras modules.

I don't know exactly if it will be considered stable enough in 5.1. I
see very little activity in the repository (last commit that seems to
modify actual code and not just buildsystem, license, typos, etc.,
seems to be from February 7th), but I don't know if that's any real
indication of anything or not.

Let's hope for the best.

-- 
Alejandro Exojo Piqueras

ModpoW, S.L.
Technova LaSalle | Sant Joan de la Salle 42 | 08022 Barcelona | www.modpow.es
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] qt3D and qt5 status

2013-03-19 Thread BOUCARD Olivier
The last commit from the repository says: 5.2 is the expected release version, 
so set it already.

We have to be a little more patient. ;-)

Olivier Boucard.




 De : Alejandro Exojo aex...@modpow.es
À : Interest@qt-project.org 
Envoyé le : Mardi 19 mars 2013 9h30
Objet : Re: [Interest] qt3D and qt5 status
 
2013/3/10 qtnext qtn...@gmail.com:
 I wants to port an existing apps from Qt4 to Qt5. I suppose that all is
 easily portable, but I use qt3D c++ scenegraph to render my opengl stuff. It
 seems that qt3D is not included in qt5 trunk, but has anybody tryed to
 compile qt3D C++ with qt5 ? Does it works for basic feature ?

I just want to point out the following post:

http://www.kdab.com/kdab-contributions-to-qt-5-0-part-5/

In which you can read: For Qt 5.1, KDAB is additionally assuming
maintainership of the Qt3D and QtX11Extras modules.

I don't know exactly if it will be considered stable enough in 5.1. I
see very little activity in the repository (last commit that seems to
modify actual code and not just buildsystem, license, typos, etc.,
seems to be from February 7th), but I don't know if that's any real
indication of anything or not.

Let's hope for the best.

-- 
Alejandro Exojo Piqueras

ModpoW, S.L.
Technova LaSalle | Sant Joan de la Salle 42 | 08022 Barcelona | www.modpow.es
___
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] Qt5 Visual Studio Add-In 1.2.1 RC

2013-03-19 Thread Haataja Ismo
Hi,

Release candidate of Qt5 Visual Studio Add-In 1.2.1 in now available for 
download here.

http://origin.releases.qt-project.org/digia_vsaddin/

Change list of modifications available here 
http://qt.gitorious.org/qt-labs/vstools/blobs/master/Qt4VS2003/Qt4VSAddin/Changes-1.2.1

Final version is scheduled to be released after Easter, first week of April.

BR,
Ismo

--
Ismo Haataja
Senior Software Specialist - Digia, Qt
Visit us on: http://qt.digia.com


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


[Interest] scale all fonts

2013-03-19 Thread Hamish Moffatt
Is it possible to apply a scaling to all font sizes used in an application?

I can see Qt is doing the right thing by converting point sizes to pixel 
sizes in accordance with the DPI of the display. Now suppose I want to 
override the DPI, or redefine point to be other than 1/72 (achieves the 
same). Is this possible?


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


Re: [Interest] opengl graphics system status in 4.8.x?

2013-03-19 Thread Samuel Rødal
On 03/18/2013 09:07 PM, Simon St James wrote:
 Hi all,

 I am currently working on emscripten-qt
 (http://vps2.etotheipiplusone.com:30176/redmine/projects/emscripten-qt/wiki/Demos/),
  a project that uses Emscripten
 (https://github.com/kripken/emscripten/wiki) to compile Qt 4.8.x to Javascript
 and run in a browser using an HTML5 canvas for rendering.

 Currently, performance is surprisingly good considering we are still using the
 raster graphics system where everything is plotted pixel by pixel by Qt and
 then flushed to the canvas after pixel format conversion.   However, we 
 suspect
 that we can get significant gains in rendering speed by writing a Qt graphics
 system that uses HTML5 Canvas drawing primitives.

 However however, it has been suggested that maybe using Qt's own opengl
 graphics
 system would be an even more performant approach.  I started investigating
 this by running stock Qt apps with stock Qt packages (on Kubuntu 12.04, Intel
 HD Graphics card) with  -graphicssystem opengl, and every app I tried gave
 only a black window, except for some more visually complex which were mostly
 black with a few coloured rectangles scattered about   When I compiled Qt
 myself and tried with that, I noticed that using KDE's default Oxygen style
 with  -graphicssystem opengl actually triggered an assertion within Qt[1], and
 while forcing the style to plastique no longer triggered it, I still just
 had a black window.  Other OpenGL apps work fine.

 So I was wondering whether using Qt's opengl graphics system is feasible? I
 heard it was experimental and not pixel-perfect, but I've not heard any
 reports that that matched mine, which makes me wonder if I just got very
 unlucky

True, it's experimental and not pixel-perfect, and not really well 
maintained at all for the desktop platforms. You could try to see if 
export QT_GL_SWAPBUFFER_PRESERVE=1 fixes the issue with the black 
windows though.

Were you planning on using WebGL? It might be possible, but I'd probably 
sooner recommend you to use HTML5 Canvas (i.e. a custom paint engine for 
QPainter).

--
Samuel

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


Re: [Interest] scale all fonts

2013-03-19 Thread Bo Thorsen
Den 19-03-2013 11:27, Hamish Moffatt skrev:
 Is it possible to apply a scaling to all font sizes used in an application?

 I can see Qt is doing the right thing by converting point sizes to pixel
 sizes in accordance with the DPI of the display. Now suppose I want to
 override the DPI, or redefine point to be other than 1/72 (achieves the
 same). Is this possible?

Well, yes and no. You can't say a widget uses standard pixel size plus X.

You can set a standard font on QApplication with the size you want:

QFont font;
font.setPixelSize(23);
QApplication::setFont(font);

That part is easy enough.

But in places where you have custom drawing with other sizes, you need 
to do the same kind of thing:

QFont f; // This is the standard font
f.setPixelSize(f.pixelSize() + 3);
setFont(f); // Or use f with the painter

You can listen for font changes with the changeEvent() in widgets. If 
you use the QWidget::setFont(), this is necessary. If you just use it in 
the painter, it's not necessary.

In all text based widgets with rich text, you can use font size=+3 
and then it just works.

With style sheets, you can't do this.

In QML you can do sort of the same things. But I assumed this was a 
QWidget based question.

Bo.

-- 
Bo Thorsen, European Qt Manager, Integrated Computer Solutions
ICS - Delivering World-Class Applications for Embedded  Mobile Devices
http://ics.com/services
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] scale all fonts

2013-03-19 Thread Manuele Conti

Il 19/03/2013 11:27, Hamish Moffatt ha scritto:

Is it possible to apply a scaling to all font sizes used in an application?

I can see Qt is doing the right thing by converting point sizes to pixel
sizes in accordance with the DPI of the display. Now suppose I want to
override the DPI, or redefine point to be other than 1/72 (achieves the
same). Is this possible?


HI I used this way:
I defined a dynamic stylesheet
qApp-setStyleSheet(*[menuHStyle = \480x272\] { font: Bold 8pt 
\Currier New\; }\n


*[menuHStyle = \\]  {  font: Bold 14pt \Helvetica\; 
  }\n

*[menuStyle  = \480x272\ ]  {  font: Bold  6pt \Currier 
New\; }\n

*[menuStyle  = \\]  {  font: Bold 11pt \Helvetica\; 
  }\n

*[voiceStyle = \480x272\]  {  font:   8pt \Currier 
New\; }\n

*[voiceStyle = \\]  {  font:  14pt \Helvetica\; 
  }\n);

Than I match screen size with style, and I set in widget my dynamic style.

 ui-ButNetworkPreferences   -setProperty(menuStyle, 
Monitor::screenSizeName());




thanks
Hamish
___
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] scale all fonts

2013-03-19 Thread Rutledge Shawn

On 19 Mar 2013, at 11:27 AM, Hamish Moffatt wrote:

 Is it possible to apply a scaling to all font sizes used in an application?
 
 I can see Qt is doing the right thing by converting point sizes to pixel 
 sizes in accordance with the DPI of the display. Now suppose I want to 
 override the DPI, or redefine point to be other than 1/72 (achieves the 
 same). Is this possible?

Unless you are on MacOS, you can override the DPI system-wide.  X11 has 
multiple ways (xorg.conf, and startx -- -dpi 72 or whatever); in Windows you 
can do it in the display control panel.
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] gstreamer is not enabled in Qt5

2013-03-19 Thread Ramakanthreddy_Kesireddy
I couldnot find gstreamer 0.10.38..So I installed 0.10.36 as gstreamer should 
be 1.0 but still
getting the same error as mentioned below.

Any pointers to enable gstreamer in configure verbose output?

Br,
Ramakanth

From: 
interest-bounces+ramakanthreddy_kesireddy=mahindrasatyam@qt-project.org 
[interest-bounces+ramakanthreddy_kesireddy=mahindrasatyam@qt-project.org] 
on behalf of Thiago Macieira [thiago.macie...@intel.com]
Sent: Friday, March 15, 2013 8:31 PM
To: interest@qt-project.org
Subject: Re: [Interest] gstreamer is not enabled in Qt5

On sexta-feira, 15 de março de 2013 11.55.30, Ramakanthreddy_Kesireddy wrote:
 Please find the attached configure command line and gstreamer error as
 attached.

Thank you. That was not a cross-compilation. The command that failed and the
error were:

g++ -c -pipe -O2 -Wall -W -fPIE  -I../../../mkspecs/linux-g++ -I. -
I/usr/include/gstreamer-0.10 -I/usr/include/glib-2.0 -I/usr/lib/arm-linux-
gnueabihf/glib-2.0/include -I/usr/include/libxml2 -o gstreamer.o gstreamer.cpp
In file included from gstreamer.cpp:43:0:
/usr/include/gstreamer-0.10/gst/interfaces/propertyprobe.h:20:20: fatal error:
global.h: No such file or directory

Looks like it's a gstreamer error. I have 0.10.38 here and there's no include
to global.h nor a file called global.h.

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



DISCLAIMER:
This email (including any attachments) is intended for the sole use of the 
intended recipient/s and may contain material that is CONFIDENTIAL AND PRIVATE 
COMPANY INFORMATION. Any review or reliance by others or copying or 
distribution or forwarding of any or all of the contents in this message is 
STRICTLY PROHIBITED. If you are not the intended recipient, please contact the 
sender by email and delete all copies; your cooperation in this regard is 
appreciated.
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] qt3D and qt5 status

2013-03-19 Thread Sean Harmer
On Tuesday 19 March 2013 09:20:02 BOUCARD Olivier wrote:
 The last commit from the repository says: 5.2 is the expected release
 version, so set it already.
 
 We have to be a little more patient. ;-)

Apologies I've only just spotted this thread. This was discussed on the 
development@ list back in February. Please take a look at this mail:

http://lists.qt-project.org/pipermail/development/2013-February/009853.html

Hopefully that explains where we are at and what the broad plans are.

Cheers,

Sean

 
 Olivier Boucard.
 
 
 
  De : Alejandro Exojo aex...@modpow.es
 
 À : Interest@qt-project.org
 Envoyé le : Mardi 19 mars 2013 9h30
 Objet : Re: [Interest] qt3D and qt5 status
 
 2013/3/10 qtnext qtn...@gmail.com:
  I wants to port an existing apps from Qt4 to Qt5. I suppose that all is
  easily portable, but I use qt3D c++ scenegraph to render my opengl stuff.
  It seems that qt3D is not included in qt5 trunk, but has anybody tryed
  to compile qt3D C++ with qt5 ? Does it works for basic feature ?
 
 I just want to point out the following post:
 
 http://www.kdab.com/kdab-contributions-to-qt-5-0-part-5/
 
 In which you can read: For Qt 5.1, KDAB is additionally assuming
 maintainership of the Qt3D and QtX11Extras modules.
 
 I don't know exactly if it will be considered stable enough in 5.1. I
 see very little activity in the repository (last commit that seems to
 modify actual code and not just buildsystem, license, typos, etc.,
 seems to be from February 7th), but I don't know if that's any real
 indication of anything or not.
 
 Let's hope for the best.
--
Dr Sean Harmer | sean.har...@kdab.com | Senior Software Engineer
Klarälvdalens Datakonsult AB, a KDAB Group company
Tel. Sweden (HQ) +46-563-540090, USA +1-866-777-KDAB(5322)
KDAB - Qt Experts - Platform-independent software solutions
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] qt3D and qt5 status

2013-03-19 Thread BOUCARD Olivier
I have missed that too. Sounds great to me.

Olivier.





 De : Sean Harmer sean.har...@kdab.com
À : interest@qt-project.org 
Envoyé le : Mardi 19 mars 2013 13h24
Objet : Re: [Interest] qt3D and qt5 status
 
On Tuesday 19 March 2013 09:20:02 BOUCARD Olivier wrote:
 The last commit from the repository says: 5.2 is the expected release
 version, so set it already.
 
 We have to be a little more patient. ;-)

Apologies I've only just spotted this thread. This was discussed on the 
development@ list back in February. Please take a look at this mail:

http://lists.qt-project.org/pipermail/development/2013-February/009853.html

Hopefully that explains where we are at and what the broad plans are.

Cheers,

Sean

 
 Olivier Boucard.
 
 
 
  De : Alejandro Exojo aex...@modpow.es
 
 À : Interest@qt-project.org
 Envoyé le : Mardi 19 mars 2013 9h30
 Objet : Re: [Interest] qt3D and qt5 status
 
 2013/3/10 qtnext qtn...@gmail.com:
  I wants to port an existing apps from Qt4 to Qt5. I suppose that all is
  easily portable, but I use qt3D c++ scenegraph to render my opengl stuff.
  It seems that qt3D is not included in qt5 trunk, but has anybody tryed
  to compile qt3D C++ with qt5 ? Does it works for basic feature ?
 
 I just want to point out the following post:
 
 http://www.kdab.com/kdab-contributions-to-qt-5-0-part-5/
 
 In which you can read: For Qt 5.1, KDAB is additionally assuming
 maintainership of the Qt3D and QtX11Extras modules.
 
 I don't know exactly if it will be considered stable enough in 5.1. I
 see very little activity in the repository (last commit that seems to
 modify actual code and not just buildsystem, license, typos, etc.,
 seems to be from February 7th), but I don't know if that's any real
 indication of anything or not.
 
 Let's hope for the best.
--
Dr Sean Harmer | sean.har...@kdab.com | Senior Software Engineer
Klarälvdalens Datakonsult AB, a KDAB Group company
Tel. Sweden (HQ) +46-563-540090, USA +1-866-777-KDAB(5322)
KDAB - Qt Experts - Platform-independent software solutions
___
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] scale all fonts

2013-03-19 Thread Hamish Moffatt
On 19/03/2013 10:55 PM, Rutledge Shawn wrote:
 On 19 Mar 2013, at 11:27 AM, Hamish Moffatt wrote:

 Is it possible to apply a scaling to all font sizes used in an application?

 I can see Qt is doing the right thing by converting point sizes to pixel
 sizes in accordance with the DPI of the display. Now suppose I want to
 override the DPI, or redefine point to be other than 1/72 (achieves the
 same). Is this possible?
 Unless you are on MacOS, you can override the DPI system-wide.  X11 has 
 multiple ways (xorg.conf, and startx -- -dpi 72 or whatever); in Windows you 
 can do it in the display control panel.

I'd like to do it in the application, not system-wide. Can I override 
the DPI that Qt has detected from the OS somehow?


Hamish

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


Re: [Interest] Qt5 Visual Studio Add-In 1.2.1 RC

2013-03-19 Thread Duane
On 3/19/2013 5:38 AM, Haataja Ismo wrote:
 Hi,

 Release candidate of Qt5 Visual Studio Add-In 1.2.1 in now available for
 download here.

 http://origin.releases.qt-project.org/digia_vsaddin/

 Change list of modifications available here
 http://qt.gitorious.org/qt-labs/vstools/blobs/master/Qt4VS2003/Qt4VSAddin/Changes-1.2.1

 Final version is scheduled to be released after Easter, first week of April.


Thanks, but if I read the mod list properly, this one only gurantees not 
to overwrite an existing Qt4 add-in.  The problem is that we need a Qt4 
add-in that will work with VS 2012.  The current Qt4 add-in only 
supports VS up to 2010.  Or am I missing something here?


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


[Interest] QThread and sleep

2013-03-19 Thread Hugo Drumond Jacob
Hi folks!

Today some doubt has ocurred on my office. Suppose that for some
reason we need to sleep a thread (not the main thread) for some time
(eg. 100 ms). The QThread::wait(int) provides similar functionality
to the POSIX pthread_join() and this don't will sleep the target
thread, but the caller thread.

Call the QThread::wait(int) from the target thread is forbidden
(according to line 651 of qthread_unix.cpp).

Furthermore, is wrong call QThread::wait(int) except for
synchronously thread termination with QThread::terminate() ? ( I know,
isn't so healthy use QThread::terminate() ) QThread::wait(int) is a
busy wait, right?

The attached code illustrate the question.

My immediate solution is: create some MyThread class inherited of
QThread just for expose the QThread::*sleep(unsigned long) methods and
create some slot or Q_INVOKABLE method on Worker to call these exposed
methods. Anyone propose some more elegant solution?

Thanks!

Hugo Drumond Jacob
class Worker : public QObject {

Q_OBJECT

public:
explicit Worker(QObject *parent = 0);
Q_INVOKABLE void doSomething();

};

Worker::Worker(QObject *parent) : QObject(parent) {

}

void Worker::doSomething() {

while(true) {
qDebug()  QDateTime::currentDateTime().toString(Worker: dd/MM/ hh:mm:ss.zzz);
}

}

int main(int argc, char *argv[]) {

QCoreApplication a(argc, argv);

Worker* w = new Worker();

QThread* workerThread = new QThread();

workerThread-start();
w-moveToThread(workerThread);

qDebug()  Main: Calling doSomething with invokeMethod.;
QMetaObject::invokeMethod(w, doSomething, Qt::QueuedConnection);

//This force the main thread to wait
qDebug()  Main: Calling wait(100) of WorkerThread.;
workerThread-wait(100);

qDebug()  Main:  QDateTime::currentDateTime().toString(dd/MM/ hh:mm:ss.zzz);

return a.exec();
}

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


Re: [Interest] how to block run function of QRunnable class

2013-03-19 Thread K. Frank
Hello Tony!

I have something of a side question, below.

On Tue, Mar 19, 2013 at 2:09 AM, Tony Rietwyk t...@rightsoft.com.au wrote:
 Hi Ken,
 ...
 // Hack to get around Qt strictness...

 class TSleepThread: public QThread
 {
 public:
   static void sleep(unsigned long secs) { QThread::sleep(secs); };
   static void msleep(unsigned long msecs) { QThread::msleep(msecs); };
   static void usleep(unsigned long usecs) { QThread::usleep(usecs); };
 };
 ...

I've done this hack before to unprotect QThread::sleep.  But for the
life of me I cannot figure out why QThread:: sleep is protected (or, at
least, why there isn't some other unprotected static sleep somewhere).

A cross-platform sleep (in a cross-platform framework, at that).  What's
not to like?

But seriously, does anyone know what the motivation for making sleep
protected might have been?

 ...
 Regards,
 Tony


Thanks.


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


Re: [Interest] how to block run function of QRunnable class

2013-03-19 Thread André Somers
Op 19-3-2013 14:57, K. Frank schreef:
 Hello Tony!

 I have something of a side question, below.

 On Tue, Mar 19, 2013 at 2:09 AM, Tony Rietwyk t...@rightsoft.com.au wrote:
 Hi Ken,
 ...
 // Hack to get around Qt strictness...

 class TSleepThread: public QThread
 {
 public:
static void sleep(unsigned long secs) { QThread::sleep(secs); };
static void msleep(unsigned long msecs) { QThread::msleep(msecs); };
static void usleep(unsigned long usecs) { QThread::usleep(usecs); };
 };
 ...
 I've done this hack before to unprotect QThread::sleep.  But for the
 life of me I cannot figure out why QThread:: sleep is protected (or, at
 least, why there isn't some other unprotected static sleep somewhere).

 A cross-platform sleep (in a cross-platform framework, at that).  What's
 not to like?

 But seriously, does anyone know what the motivation for making sleep
 protected might have been?
I'm not sure, probably to discourage its usage. Anyway, in Qt 5, there 
now are static public member functions sleep and usleep in QThread.

André


-- 
You like Qt?
I am looking for collegues to join me at i-Optics!

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


Re: [Interest] how to block run function of QRunnable class

2013-03-19 Thread K. Frank
Hi André!

On Tue, Mar 19, 2013 at 10:11 AM, André Somers an...@familiesomers.nl wrote:
 Op 19-3-2013 14:57, K. Frank schreef:
 Hello Tony!

 I have something of a side question, below.
 ...
 A cross-platform sleep (in a cross-platform framework, at that).  What's
 not to like?

 But seriously, does anyone know what the motivation for making sleep
 protected might have been?

 I'm not sure, probably to discourage its usage. Anyway, in Qt 5, there
 now are static public member functions sleep and usleep in QThread.

Thanks, good answer.   I haven't moved to Qt 5 yet, so thanks for noting
that sleep has become unprotected.

For the time being with Qt 4 I guess I'll just keep on unprotecting sleep,
à la Tony, and not feel guilty about it.

 André


Thanks.


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


Re: [Interest] how to block run function of QRunnable class

2013-03-19 Thread Frank Hemer
On Tuesday 19 March 2013 15:11:03 André Somers wrote:
 Op 19-3-2013 14:57, K. Frank schreef:
  Hello Tony!
  
  I have something of a side question, below.
  
  On Tue, Mar 19, 2013 at 2:09 AM, Tony Rietwyk t...@rightsoft.com.au 
wrote:
  Hi Ken,
  ...
  // Hack to get around Qt strictness...
  
  class TSleepThread: public QThread
  {
  
  public:
 static void sleep(unsigned long secs) { QThread::sleep(secs); };
 static void msleep(unsigned long msecs) { QThread::msleep(msecs);
 };
 static void usleep(unsigned long usecs) { QThread::usleep(usecs);
 };
  
  };
  ...
  
  I've done this hack before to unprotect QThread::sleep.  But for the
  life of me I cannot figure out why QThread:: sleep is protected (or, at
  least, why there isn't some other unprotected static sleep somewhere).
  
  A cross-platform sleep (in a cross-platform framework, at that).  What's
  not to like?
  
  But seriously, does anyone know what the motivation for making sleep
  protected might have been?
 
 I'm not sure, probably to discourage its usage. Anyway, in Qt 5, there
 now are static public member functions sleep and usleep in QThread.

Sleep being public tends to make users think it could be called from anywhere 
(not only from within the thread) which might have sideeffects. Thus, 
overwriting QThread implies you're doing sth. non standard and you know what 
you are doing.

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


[Interest] QGridLayout does not update

2013-03-19 Thread Etienne Sandré-Chardonnal
Dear all,

I am encountering the following issue using QGridLayout in a widget.

The QGridLayout is currently used for displaying labels along a grid with
two columns, in a subclassed QWidget. This QWidget was set as the widget of
a QSCrollArea, the QScrollArea is the content of a QDockWidget.


1) In the QWidget constructor, I create the QGridLayout and populate it
with dummy labels for testing. This works:

gridLayout = new QGridLayout(this);
setLayout(gridLayout);

for(int i=0;i15;i++)
{
QLabel * nameWidget = new QLabel(Testing!!, this);
gridLayout-addWidget(nameWidget, i, 0);
QLabel * statusWidget = new QLabel(N/A, this);
gridLayout-addWidget(statusWidget, i, 1);
}


This works as expected, especially the column size is adjusted to the
QLabel widths


2) Then in a setServerNames slot of the QWidget, I do:

QLayoutItem *child;
while ((child = gridLayout-takeAt(0)) != 0) {
delete child-widget();
delete child;
}

if(serverList.size()==0)
return;


for(int i=0;iserverList.size();i++)
{
QLabel * nameWidget = new QLabel(serverList[i], this);
gridLayout-addWidget(nameWidget, i, 0);
QLabel * statusWidget = new QLabel(N/A, this);
gridLayout-addWidget(statusWidget, i, 1);
}





When the slot is called, the layout is not refreshed : the column width
stays as it was adjusted in the constructor, so some of the QLabels are
cropped, while there is still plenty of space on the right.
Worse, if the layout is not populated in the constructor, then when the
slot is called, nothing is displayed, likely because the layout is not
refreshed, and sizes are null.
I'm using Qt 4.8.3 under Windows

Any idea?

Thanks!

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


Re: [Interest] how to block run function of QRunnable class

2013-03-19 Thread K. Frank
Hi Frank!

On Tue, Mar 19, 2013 at 10:24 AM, Frank Hemer fr...@hemer.org wrote:
 On Tuesday 19 March 2013 15:11:03 André Somers wrote:
 Op 19-3-2013 14:57, K. Frank schreef:
  ...
  A cross-platform sleep (in a cross-platform framework, at that).  What's
  not to like?
 
  But seriously, does anyone know what the motivation for making sleep
  protected might have been?

 I'm not sure, probably to discourage its usage. Anyway, in Qt 5, there
 now are static public member functions sleep and usleep in QThread.

 Sleep being public tends to make users think it could be called from anywhere
 (not only from within the thread) which might have sideeffects. Thus,
 overwriting QThread implies you're doing sth. non standard and you know what
 you are doing.

I don't really follow the thinking here.

On both windows and linux I can call the native sleep.  I can call it
from the single main thread of a single-threaded program, from a
QThread, from a pthread, from a windows thread, from a std::thread,
and all it does is pause the thread of execution from which it's called.
I don't see anything I would call side effects.

I would think that Qt's sleep should be just a cross-platform wrapper /
normalizer for the native calls.  (I also don't see why sleep should be
a static member of QThread, rather than a free function, other than
maybe a java-esque desire to use classes rather than namespaces.)

No matter.  Tony's hack works for Qt 4, and sleep is public in Qt 5.
I'm just curious -- sometimes there's a method to the madness ...

 Frank


Thanks for the explanation.


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


Re: [Interest] QGridLayout does not update

2013-03-19 Thread Etienne Sandré-Chardonnal
Tried, with no success.

Surprisingly, if I directly set my QWidget as the QDockWidget content, it
works.
But if I put a QScrollArea as the QDockWidget content, and my QWidget as
QScrollArea content, it does not work.

Something is wrong with the QScrollArea

Etienne

2013/3/19 preeteesh kakkar preeteesh.kak...@gmail.com

 Try calling gridlayout-update() and see if that helps?

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


Re: [Interest] QGridLayout does not update

2013-03-19 Thread Etienne Sandré-Chardonnal
Ah, I think I got an idea from the docs.
Apparently, one cannot modify the layout of a widget after it has been set
as a QScrollArea content. Damned... this prevents me from dynamically
changing the content of the dock without recreating everything at each
update

Etienne

void QScrollArea::setWidget (
QWidgetqthelp://com.trolltech.qt.481/qdoc/qwidget.html
 * *widget* )

Sets the scroll area's *widget*.

The *widget* becomes a child of the scroll area, and will be destroyed when
the scroll area is deleted or when a new widget is set.

The widget's 
autoFillBackgroundqthelp://com.trolltech.qt.481/qdoc/qwidget.html#autoFillBackground-prop
 property will be set to true.

If the scroll area is visible when the *widget* is added, you must
show()qthelp://com.trolltech.qt.481/qdoc/qwidget.html#show
 it explicitly.

Note that You must add the layout of *widget* before you call this
function; if you add it later, the *widget* will not be visible -
regardless of when you
show()qthelp://com.trolltech.qt.481/qdoc/qwidget.html#show
 the scroll area. In this case, you can also
notshow()qthelp://com.trolltech.qt.481/qdoc/qwidget.html#show
 the *widget* later.

*See also *widgetqthelp://com.trolltech.qt.481/qdoc/qscrollarea.html#widget
().





2013/3/19 Etienne Sandré-Chardonnal etienne.san...@m4x.org

 Tried, with no success.

 Surprisingly, if I directly set my QWidget as the QDockWidget content, it
 works.
 But if I put a QScrollArea as the QDockWidget content, and my QWidget as
 QScrollArea content, it does not work.

 Something is wrong with the QScrollArea

 Etienne


 2013/3/19 preeteesh kakkar preeteesh.kak...@gmail.com

 Try calling gridlayout-update() and see if that helps?


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


Re: [Interest] gstreamer is not enabled in Qt5

2013-03-19 Thread Thiago Macieira
On terça-feira, 19 de março de 2013 12.03.48, Ramakanthreddy_Kesireddy wrote:
 I couldnot find gstreamer 0.10.38..So I installed 0.10.36 as gstreamer
 should be 1.0 but still getting the same error as mentioned below.

 Any pointers to enable gstreamer in configure verbose output?

You've already done that. Your gstreamer is broken.

This is not a Qt problem. You need to fix your gstreamer header bugs before it
will compile.

As you can see here:
http://cgit.freedesktop.org/gstreamer/gst-plugins-base/tree/gst-libs/gst/interfaces/propertyprobe.h?id=RELEASE-0.10.36

gst/interfaces/propertyprobe.h in version 0.10.36 does not have an include for
global.h. Your headers are either corrupt or have been modified by someone
else. Track the change down and fix it.
--
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center


signature.asc
Description: This is a digitally signed message part.
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QThread and sleep

2013-03-19 Thread Thiago Macieira
On terça-feira, 19 de março de 2013 10.37.56, Hugo Drumond Jacob wrote:
 Hi folks!

 Today some doubt has ocurred on my office. Suppose that for some
 reason we need to sleep a thread (not the main thread) for some time

Suppose that you're wrong and you came to the wrong solution that sleeping is
the way to go. Try to find a solution that makes you do what you need to do and
not sleep.

 (eg. 100 ms). The QThread::wait(int) provides similar functionality
 to the POSIX pthread_join() and this don't will sleep the target
 thread, but the caller thread.

 Call the QThread::wait(int) from the target thread is forbidden
 (according to line 651 of qthread_unix.cpp).

You were looking for QThread::sleep, not wait. The latter is used to wait for
a thread to finish, with a given timeout. The former suspends and blocks
execution of the calling thread for a given time.

 Furthermore, is wrong call QThread::wait(int) except for
 synchronously thread termination with QThread::terminate() ? ( I know,
 isn't so healthy use QThread::terminate() ) QThread::wait(int) is a
 busy wait, right?

No, it isn't. It's like a pthread_join: it will suspend the execution of the
calling thread until the other thread exits or the timeout happens, whichever
comes first. QThread::wait() is normal use and is, in fact, used even by the
QThread destructor.

QThread::sleep() is, more often than not, a bad choice. Avoid it if you can.
If you can't, redesign your code so you don't need to use it.

 The attached code illustrate the question.

Your example has the main thread waiting for 100 ms for the auxiliary thread
to exit. But your auxiliary thread is busy-looping doing a qDebug and will
never exit. Since it doesn't exit, QThread::wait() will always timeout.

 My immediate solution is: create some MyThread class inherited of
 QThread just for expose the QThread::*sleep(unsigned long) methods and
 create some slot or Q_INVOKABLE method on Worker to call these exposed
 methods. Anyone propose some more elegant solution?

Yes: don't sleep.

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


signature.asc
Description: This is a digitally signed message part.
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QThread and sleep

2013-03-19 Thread Thiago Macieira
On terça-feira, 19 de março de 2013 14.56.47, Hugo Drumond Jacob wrote:
 No problem! In fact, we are using!  It's just a question about
 QThread::wait and QThread::sleep: It's safe use QThread::wait in
 other situation that not synchronously QThread::terminate ? and you
 already answered: yes. Maybe not for this point of our application in
 specific, but is normal usage.

They are two very different methods and do not do remotely the same thing.
Asking about the two together in the same breath would suggest that you do not
understand what they are or what you're trying to do.

Anyway, QThread::wait() is perfectly safe to use. It's QThread::terminate()
that is not safe.

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


signature.asc
Description: This is a digitally signed message part.
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] scale all fonts

2013-03-19 Thread Till Oliver Knoll


Am 19.03.2013 um 14:19 schrieb Hamish Moffatt ham...@risingsoftware.com:

 On 19/03/2013 10:55 PM, Rutledge Shawn wrote:
 On 19 Mar 2013, at 11:27 AM, Hamish Moffatt wrote:
 
 Is it possible to apply a scaling to all font sizes used in an application?
 
 I can see Qt is doing the right thing by converting point sizes to pixel
 sizes in accordance with the DPI of the display. Now suppose I want to
 override the DPI, or redefine point to be other than 1/72 (achieves the
 same). Is this possible?
 Unless you are on MacOS, you can override the DPI system-wide.  X11 has 
 multiple ways (xorg.conf, and startx -- -dpi 72 or whatever); in Windows you 
 can do it in the display control panel.
 I'd like to do it in the application, not system-wide. Can I override 
 the DPI that Qt has detected from the OS somehow?

Did you try 

  http://qt-project.org/doc/qt-5.0/qtwidgets/qapplication.html#styleSheet-prop

and setting the QFont property?

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


Re: [Interest] QThread and sleep

2013-03-19 Thread Hugo Drumond Jacob
2013/3/19 Thiago Macieira thiago.macie...@intel.com:
 On terça-feira, 19 de março de 2013 14.56.47, Hugo Drumond Jacob wrote:
 No problem! In fact, we are using!  It's just a question about
 QThread::wait and QThread::sleep: It's safe use QThread::wait in
 other situation that not synchronously QThread::terminate ? and you
 already answered: yes. Maybe not for this point of our application in
 specific, but is normal usage.

 They are two very different methods and do not do remotely the same thing.
 Asking about the two together in the same breath would suggest that you do not
 understand what they are or what you're trying to do.

 Anyway, QThread::wait() is perfectly safe to use. It's QThread::terminate()
 that is not safe.

Yes! I agree: QThread::wait and QThread::terminate are two very
different methods and do not do remotely the same thing.. I'm asking
about QThread::wait and QThread::sleep, but, Qt documentation suggest
Use QThread::wait() after terminate() for synchronous termination..
Some careless reader can understand ONLY use QThread::wait() after
QThread::terminate(). As you say, it's safe (but not recommended) use
QThread::wait().

Whatever, the doubt was clarified.

Thank you very much 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

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


[Interest] Unable to capture audio with QAudioInput

2013-03-19 Thread pritam.ghang...@gmail.com
Hi

I was trying to capture audio using QAudioInput. But I get nothing in the
output buffer. Please see the attached code. I try to send it to google for
text recognition after recording but buffer itself is empty.

Platform: Ubuntu Linux 32bit 12.10 with Qt5.0

-- 
Regards,
pritam
#include QCoreApplication
#include QtMultimedia
#include QFile
#include QtNetwork
#include QUrl

class GRecognizer : public QObject
{
Q_OBJECT
public:
GRecognizer(QObject *parent = 0)
{
// set up the format you want, eg.
m_format.setSampleRate(8000);
m_format.setChannelCount(1);
m_format.setSampleSize(8);
m_format.setCodec(audio/x-flac);
m_format.setByteOrder(QAudioFormat::LittleEndian);
m_format.setSampleType(QAudioFormat::UnSignedInt);

QAudioDeviceInfo info = QAudioDeviceInfo::defaultInputDevice();
if (!info.isFormatSupported(m_format)) {
qWarning()default format not supported try to use nearest;
m_format = info.nearestFormat(m_format);
}

m_input = new QAudioInput(m_format, this);
m_nam = new QNetworkAccessManager(this);
}

void listen(int duration)
{
QTimer::singleShot(duration*1000, Qt::CoarseTimer, this, SLOT(stopRecording()));
connect(m_input, SIGNAL(stateChanged(QAudio::State)), this, SLOT(onStateChanged(QAudio::State)));
m_input-start(m_audio);
}

void recognize(const QBuffer audio)
{

QUrl url(https://www.google.com/speech-api/v1/recognize;);
QUrlQuery postParams;
postParams.addQueryItem(client, chromium);
postParams.addQueryItem(lang, en-US);

url.setQuery(postParams);
QNetworkRequest request(url);

postParams.clear();
postParams.addQueryItem(Content_type, audio/x-flac; rate=8000);
postParams.addQueryItem(content, audio.buffer());
request.setHeader(QNetworkRequest::ContentTypeHeader, audio/x-flac; rate=8000);
QNetworkReply *reply = m_nam-post(request, postParams.toString(QUrl::FullyEncoded).toUtf8());
connect(reply, SIGNAL(finished()), this, SLOT(onFinished()));
connect(reply, SIGNAL(finished()), reply, SLOT(deleteLater()));
}

private slots:
void onFinished() {
QNetworkReply *reply = (QNetworkReply*)sender();
if (reply-error() != QNetworkReply::NoError)
{
qDebug()  error in reply  reply-errorString();
}
qDebug()  reply-readAll();
}
void stopRecording()
{
qDebug()  calling stop on recording;
m_input-stop();
}

void onStateChanged(QAudio::State state)
{
switch (state)
{
case QAudio::StoppedState:
if (m_input-error() != QAudio::NoError) {
qDebug()  error while recording;
} else {
qDebug()  done recording;
QAudioDeviceInfo info(QAudioDeviceInfo::defaultOutputDevice());
if (!info.isFormatSupported(m_format)) {
qWarning()raw audio format not supported by backend, cannot play audio.;
return;
}

QAudioOutput output(m_input-format());
output.start(m_audio);
//qDebug()  audio.readAll();
recognize(m_audio);
}
break;

case QAudio::ActiveState:
// Started recording - read from IO device
//qDebug()  started recording;
break;

default:
// ... other cases as appropriate
break;
}
}


private:
QNetworkAccessManager *m_nam;
QAudioInput *m_input;
QAudioFormat m_format;
QBuffer m_audio;
};

int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
GRecognizer gr;
gr.listen(3);

return a.exec();
}

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


Re: [Interest] QThread and sleep

2013-03-19 Thread Thiago Macieira
On terça-feira, 19 de março de 2013 15.15.31, Hugo Drumond Jacob wrote:
 2013/3/19 Thiago Macieira thiago.macie...@intel.com:
  On terça-feira, 19 de março de 2013 14.56.47, Hugo Drumond Jacob wrote:
  No problem! In fact, we are using!  It's just a question about
  QThread::wait and QThread::sleep: It's safe use QThread::wait in
  other situation that not synchronously QThread::terminate ? and you
  already answered: yes. Maybe not for this point of our application in
  specific, but is normal usage.
 
  They are two very different methods and do not do remotely the same thing.
  Asking about the two together in the same breath would suggest that you do
  not understand what they are or what you're trying to do.
 
  Anyway, QThread::wait() is perfectly safe to use. It's
  QThread::terminate()
  that is not safe.

 Yes! I agree: QThread::wait and QThread::terminate are two very
 different methods and do not do remotely the same thing.. I'm asking
 about QThread::wait and QThread::sleep

That's what I answered. Sorry if I was not clear.

Besides the fact that both have one parameter containing a time in
milliseconds, they are very different and do not do remotely the same thing.
wait() waits for the started thread to exit up to the timeout amount of
milliseconds, but may return sooner (even immediately) if the thread exits
sooner (or has exited already).

sleep() suspends the execution of the calling thread, whichever that thread
is, for the amount of milliseconds and it cannot be interrupted. But, of
course, it's not precise: the thread may be resumed at a later time, depending
on OS scheduling.

 , but, Qt documentation suggest
 Use QThread::wait() after terminate() for synchronous termination..
 Some careless reader can understand ONLY use QThread::wait() after
 QThread::terminate(). As you say, it's safe (but not recommended) use
 QThread::wait().

Yes, especially if the thread exits by normal means (quit, exit, return from
run()).
--
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center


signature.asc
Description: This is a digitally signed message part.
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest