[Interest] Adding custom qmake directives?

2013-08-30 Thread Soroush Rabiei
I would like to introduce new directives to qmake of target system. I have
a toolkit made up of a set of libraries and templated code-bases. It should
be possible to easily include / exclude its modules to Qt project. A
project file may look like this :

# users_application.pro
QT   += core gui sql
AGT  += core acl security # This like
TARGET = my_application
TEMPLATE = app
SOURCES += main.cpp ...

The second line should be expanded to:

LIBS += -lagt_code -lagt_acl -lagt_security -lagt_crypto -lpthread # and /
or other dependencies
INCLUDEPATH += concluded include dirs

I guess doing things like this requires modifying Qt's configuration files.
Of course it should be possible to revert back all changes on uninstall.
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Qt::Alignment and MetaObject System

2013-08-30 Thread Martin Koller
On Thursday 29 August 2013 19:09:52 Giuseppe D'Angelo wrote:
 Il 29/08/2013 17:11, Martin Koller ha scritto:
  However how can I do the same with this Qt::AlignmentFlag enum which is not 
  defined inside a QObject ?
 
 There's a trick in place in qnamespace.h:
 
 http://code.woboq.org/qt5/qtbase/src/corelib/global/qnamespace.h.html#50
 
 So: most(all?) enums under the Qt namespace gets actually extracted by 
 moc, and placed in a special metaobject, accessible in any QObject 
 subclass (it's protected): QObject::staticQtMetaObject.
 
 So you can use something like
 
   int index = staticQtMetaObject.indexOfEnumerator(Alignment);
   QMetaEnum me = staticQtMetaObject.enumerator(index);
   ...
 
 in a QObject subclass to get the meta information about Qt::Alignment.

Thanks to this trick - works great!

A pitty it's not documented ...

-- 
Best regards/Schöne Grüße

Martin
A: Because it breaks the logical sequence of discussion
Q: Why is top posting bad?

()  ascii ribbon campaign - against html e-mail 
/\  www.asciiribbon.org   - against proprietary attachments

Geschenkideen, Accessoires, Seifen, Kulinarisches: www.bibibest.at
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Bluetooth Qt Connectivity module(5.1 Qt SDK)

2013-08-30 Thread Blasche Alexander
Hi,

Couple of questions:

1.) What branch of qtconnectivity are you using? Maybe add the SHA?

2.) What does gdb tell you when you interrupt the hanging process? Where is it 
stuck (aka what does the bt look like).


--

Alex


From: interest-bounces+alexander.blasche=digia@qt-project.org 
[interest-bounces+alexander.blasche=digia@qt-project.org] on behalf of 
Ramakanthreddy Kesireddy [ramakanthreddy.kesire...@techmahindra.com]
Sent: Thursday, August 29, 2013 18:10
To: interest@qt-project.org
Subject: Re: [Interest] Bluetooth Qt Connectivity module(5.1 Qt SDK)

Hi,

I tried to unset compiz and then run BTtransfer example application.
However, once the device is found(after pairing is completed) and shown in 
dialog, the application freezes though there is no Compiz error.

Please let me know if there are any clues in this regard.

Thanks and Regards,
Ramakanth



From: Ramakanthreddy Kesireddy
Sent: Monday, August 19, 2013 11:50 AM
To: interest@qt-project.org
Subject: Bluetooth Qt Connectivity module(5.1 Qt SDK)

Hi,

Am using Qt 5.1 Offline installer for Linux Ubuntu 12.04 X86 32 bit sdk.
I installed libblueooth3.

I built Qt connectivity module from qt repository and tried to execute the 
btfiletransfer/btchat examples so as to verify
Bt communication using OBEX/SPP profiles.

However, these examples are not working fine and crashes while the transfer is 
initiated with compiz terminated unexpectedly.
The system needs reboot after this.

Please let me know if am missing anything in this regard.

Thanks and Regards,
Ramakanth









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


[Interest] Generate key press events in c++ for a Quick2-application?

2013-08-30 Thread Ola Røer Thorsen
I need to generate key press events in c++ (based on packets received 
via udp), so that these behave like regular key presses in a 
Quick2-based application. The target platform has a rather specialized 
non-standard keyboard.

I have found some examples on how to do this with widgets, but these 
don't seem to work with Quick2.

Is this possible at all? Does any of you know how to do it?

Thanks!


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


[Interest] Flat directory structure for Qt 5.2 documentation

2013-08-30 Thread Pasion Jerome
Hello all,

For Qt 5.2, we plan to deliver the online documentation (qt-project.org/doc)
using a flat documentation structure. Currently, the online documentation
is using the modularized structure.

By default, Qt 5 source builds will still use the modularized structure and only
the online Qt documentation (qt-project.org/doc/qt-5) will receive the single-
directory documentation. The snapshots (doc-snapshot.qt-project.org) will serve
as testing ground for the single-directory documentation.

Snapshot: http://doc-snapshot.qt-project.org/qt5-nosubdir/
***Please don't spread this link because this is for testing only.
I will remove it once 'dev' is merged to 'stable'.***

So, it is even more important that the HTML filenames are unique. We're going
through the list of warnings produced by QDoc and most of the duplicate file
warnings are about example names. Try to employ meaningful example names in the
context of Qt, not just within that module.

Current QDoc warnings: https://bugreports.qt-project.org/browse/QTBUG-32580

More information about the specifications and guidelines is available at:
http://qt-project.org/wiki/QtWritingGuidelines

There are other plans regarding how the redirects work once the single-directory
documentation is more mature and those will be communicated later. As well,
we are improving the usability and navigation of the content in reference
documentation ('dev' branches).

Cheers,
Jerome Pasion
Documentation Engineer - Digia, Qt
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Generate key press events in c++ for a Quick2-application?

2013-08-30 Thread Tomasz Olszak
2013/8/30 Ola Røer Thorsen o...@silentwings.no

 I need to generate key press events in c++ (based on packets received
 via udp), so that these behave like regular key presses in a
 Quick2-based application. The target platform has a rather specialized
 non-standard keyboard.

 I have found some examples on how to do this with widgets, but these
 don't seem to work with Quick2.

 Is this possible at all? Does any of you know how to do it?

 Thanks!


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


See for example:
https://qt.gitorious.org/qt/qtquickcontrols/source/c304d741a27b5822a35d1fb83f8f5e65719907ce:tests/auto/applicationwindow/tst_applicationwindow.cpp

-- 
regards / pozdrawiam, Tomasz Olszak
Qt for Tizen | http://qt-project.org/wiki/Tizen
Qt Certified Developer | http://qt-project.org
http://linkedin.com/in/tolszak
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Generate key press events in c++ for a Quick2-application?

2013-08-30 Thread Ola Røer Thorsen

Brilliant, it works, thanks :-)


Den 2013-08-30 14:24, skrev Tomasz Olszak:
2013/8/30 Ola Røer Thorsen o...@silentwings.no 
mailto:o...@silentwings.no


I need to generate key press events in c++ (based on packets received
via udp), so that these behave like regular key presses in a
Quick2-based application. The target platform has a rather specialized
non-standard keyboard.

I have found some examples on how to do this with widgets, but these
don't seem to work with Quick2.

Is this possible at all? Does any of you know how to do it?

Thanks!


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


See for example:
https://qt.gitorious.org/qt/qtquickcontrols/source/c304d741a27b5822a35d1fb83f8f5e65719907ce:tests/auto/applicationwindow/tst_applicationwindow.cpp

--
regards / pozdrawiam, Tomasz Olszak
Qt for Tizen | http://qt-project.org/wiki/Tizen
Qt Certified Developer | http://qt-project.org http://qt-project.org/
http://linkedin.com/in/tolszak


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


[Interest] My First approach with QT 5.1 on MacOS : very disappointing

2013-08-30 Thread Vincent R.
Hi,

it's been a long time since I tried QT and I read some very interesting 
articles about new version
of QT, QTQuick 2.x, desktop controls, better QTCreator, ...
So I have downloaded the latest version of QT (5.1) on MacOS mountain 
Lion and I tried to find an good tutorial.
I found this one :
http://www.ics.com/blog/integrating-c-qml?page=1

I have downloaded the source code, started Creator and clicked on the 
Debug button but of course it doesn't
work and I get the following errors :

/Users/j.doe/Developer/Qt5.1.0/5.1.0/clang_64/include/QtCore/qlist.h:52: 
erreur : 'initializer_list' file not found
#include initializer_list
  ^

Ok So I found the following thread on SO :
http://stackoverflow.com/questions/15446207/compile-error-when-trying-to-compile-a-qt-project

So I have edited the file qmlc++.pro to add -stdlib=libc+ and CONFIG 
+=c++11 (as shown below)

qmlc++.pro:
--
lessThan(QT_MAJOR_VERSION, 5): error(This project requires Qt 5 or 
later)

# Needed by g++ for C++11 support. Adjust as needed for other 
compilers.
QMAKE_CXXFLAGS += -std=c++0x -stdlib=libc+
CONFIG +=c++11

TEMPLATE = app
TARGET = qmlc++
QT += qml quick widgets
HEADERS += KeyGenerator.h
SOURCES += main.cpp KeyGenerator.cpp
OTHER_FILES += main.qml
---

So now everything compiles fine, I only have the following warnings:
directory not found for option 
'-F/Users/j.doe/Developer/Qt5.1.0//5.1.0/clang_64/qtdeclarative/lib'
directory not found for option 
'-F/Users/j.doe/Developer/Qt5.1.0//5.1.0/clang_64/qtbase/lib'
directory not found for option 
'-F/Users/j.doe/Developer/Qt5.1.0//5.1.0/clang_64/qtjsbackend/lib'

Then when I try to run the application it cannot find the main qml file 
:

Démarrage de 
/Users/j.doe/Downloads/build-qmlc++-Desktop_Qt_5_1_0_clang_64bit-Debug/qmlc++.app/Contents/MacOS/qmlc++...QML
 
debugging is enabled. Only use this in a safe environment.
file:///Users/j.doe/Downloads/build-qmlc++-Desktop_Qt_5_1_0_clang_64bit-Debug/qmlc++.app/Contents/MacOS/main.qml:-1
 
File not found

/Users/j.doe/Downloads/build-qmlc++-Desktop_Qt_5_1_0_clang_64bit-Debug/qmlc++.app/Contents/MacOS/qmlc++
 
a quitté avec le code 255

So I finally gave up for now and I tried to create a new hello world 
application, then I wanted to see the option to import an external 
library
into the project so I right-clicked on the project - Add library... 
then a dialog appeared but in the mean time I changed my mind and I 
wanted to do something else before inserting a libray BUT WHERE IS THE 
CANCEL BUTTON ? I have to launch process explorer to quit this dialog.


UPDATE : I found that to quit the import lib dialog I can press Esc key 
but to me this is ugly, it shouldn't be difficult to rename the Go 
back button into Cancel when you are on the first state of the 
dialog...

I am a bit disappointed.

I found this problem withing 10 minutes so now I am a bit afraid to 
keep on testing.





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


Re: [Interest] OT: Elop as candidate for Microsoft CEO?

2013-08-30 Thread Charley Bay
On Thu, Aug 29, 2013 at 9:13 PM, K. Frank kfrank2...@gmail.com wrote:

 Hello List!

 There is speculation that Elop is in the running for Microsoft
 CEO.  See, for example:


 http://www.bloomberg.com/news/2013-08-28/microsoft-ceo-hunt-a-tough-bet-as-web-gamblers-favor-elop.html

 It would be ironic, at least if there were any reality to it.


 Happy Hacking!


 K. Frank


Hasn't he been a Microsoft executive the whole time?  ;-)

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


Re: [Interest] My First approach with QT 5.1 on MacOS : very disappointing

2013-08-30 Thread Alejandro Exojo
2013/8/30 Vincent R. foru...@smartmobili.com:
 Lion and I tried to find an good tutorial.
 I found this one :
 http://www.ics.com/blog/integrating-c-qml?page=1

I haven't read it, and I have in good consideration ICS guys, but you
make it sound like is hard to find a tutorial.

From the welcome screen in Qt Creator you have a clear link to a bunch of them.

 I have downloaded the source code, started Creator and clicked on the
 Debug button but of course it doesn't
 work and I get the following errors :

 /Users/j.doe/Developer/Qt5.1.0/5.1.0/clang_64/include/QtCore/qlist.h:52:
 erreur : 'initializer_list' file not found
 #include initializer_list
   ^

So, you used a project that uses C++11, and the compiler doesn't
enable C++11 by default. That's not Qt's fault.

 Démarrage de
 /Users/j.doe/Downloads/build-qmlc++-Desktop_Qt_5_1_0_clang_64bit-Debug/qmlc++.app/Contents/MacOS/qmlc++...QML
 debugging is enabled. Only use this in a safe environment.
 file:///Users/j.doe/Downloads/build-qmlc++-Desktop_Qt_5_1_0_clang_64bit-Debug/qmlc++.app/Contents/MacOS/main.qml:-1
 File not found

 /Users/j.doe/Downloads/build-qmlc++-Desktop_Qt_5_1_0_clang_64bit-Debug/qmlc++.app/Contents/MacOS/qmlc++
 a quitté avec le code 255

Hard to say which the problem is if you provide some messages in
French and no code at all...

 So I finally gave up for now and I tried to create a new hello world
 application, then I wanted to see the option to import an external
 library
 into the project so I right-clicked on the project - Add library...
 then a dialog appeared but in the mean time I changed my mind and I
 wanted to do something else before inserting a libray BUT WHERE IS THE
 CANCEL BUTTON ? I have to launch process explorer to quit this dialog.

I have a cancel button (on LInux). I don't know if it follows some Mac
convention of not having a Cancel button.

Is not that is going to kill a kitten if you go forward in the dialog,
anyways. At the end you have a summary page that tells you exactly
what is going to be done, and at least in my case, the chance to
cancel or finish the dialog.

 I am a bit disappointed.

 I found this problem withing 10 minutes so now I am a bit afraid to
 keep on testing.

If you feel disappointed by that, I have bad news for you. This is the
least problematic thing you are going to face while programming.

-- 
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] Interest Digest, Vol 23, Issue 76

2013-08-30 Thread Danny Price
 
 
 Message: 5
 Date: Fri, 30 Aug 2013 16:03:49 +0200
 From: Vincent R. foru...@smartmobili.com
 Subject: [Interest] My First approach with QT 5.1 on MacOS : very
   disappointing
 To: interest@qt-project.org
 Message-ID: e7e13b42c24a503970fa2b62f60d3...@smartmobili.com
 Content-Type: text/plain; charset=UTF-8; format=flowed
 
 Hi,
 
 it's been a long time since I tried QT and I read some very interesting 
 articles about new version
 of QT, QTQuick 2.x, desktop controls, better QTCreator, …

I consider Qt Quick on the desktop to be experimental at best. QML is designed 
for mobile and it shows.

They've just added desktop components to the distribution but its missing 
critical things like tree views and there are no plans to add them.

I've tried it a few times and gone through the examples but from the number of 
errors, I get the impression that no-one has really tried it on mac.

It's pretty easy to add animation (if you really, really need it) to 
traditional widgets thanks to QStateMachine and QGraphicsView is pretty awesome.

 So I have downloaded the latest version of QT (5.1) on MacOS mountain 
 Lion and I tried to find an good tutorial.
 I found this one :
 http://www.ics.com/blog/integrating-c-qml?page=1

That's not even an official Qt tutorial.

 I have downloaded the source code, started Creator and clicked on the 
 Debug button but of course it doesn't
 work and I get the following errors :
 
 /Users/j.doe/Developer/Qt5.1.0/5.1.0/clang_64/include/QtCore/qlist.h:52: 
 erreur : 'initializer_list' file not found
 #include initializer_list
  ^
 

Simply add CONFIG += C++11. Those other articles are out of date.

 Ok So I found the following thread on SO :
 http://stackoverflow.com/questions/15446207/compile-error-when-trying-to-compile-a-qt-project
 
 So I have edited the file qmlc++.pro to add -stdlib=libc+ and CONFIG 
 +=c++11 (as shown below)
 
 qmlc++.pro:
 --
 lessThan(QT_MAJOR_VERSION, 5): error(This project requires Qt 5 or 
 later)
 
 # Needed by g++ for C++11 support. Adjust as needed for other 
 compilers.
 QMAKE_CXXFLAGS += -std=c++0x -stdlib=libc+
 CONFIG +=c++11
 
 TEMPLATE = app
 TARGET = qmlc++
 QT += qml quick widgets
 HEADERS += KeyGenerator.h
 SOURCES += main.cpp KeyGenerator.cpp
 OTHER_FILES += main.qml
 ---
 
 So now everything compiles fine, I only have the following warnings:
 directory not found for option 
 '-F/Users/j.doe/Developer/Qt5.1.0//5.1.0/clang_64/qtdeclarative/lib'
 directory not found for option 
 '-F/Users/j.doe/Developer/Qt5.1.0//5.1.0/clang_64/qtbase/lib'
 directory not found for option 
 '-F/Users/j.doe/Developer/Qt5.1.0//5.1.0/clang_64/qtjsbackend/lib'


This is QTBUG-28336 and is supposed to be fixed in 5.1.1. There is a simple 
work around for earlier versions in the comments:
https://bugreports.qt-project.org/browse/QTBUG-28336

 
 Then when I try to run the application it cannot find the main qml file 
 :
 
 D?marrage de 
 /Users/j.doe/Downloads/build-qmlc++-Desktop_Qt_5_1_0_clang_64bit-Debug/qmlc++.app/Contents/MacOS/qmlc++...QML
  
 debugging is enabled. Only use this in a safe environment.
 file:///Users/j.doe/Downloads/build-qmlc++-Desktop_Qt_5_1_0_clang_64bit-Debug/qmlc++.app/Contents/MacOS/main.qml:-1
  
 File not found
 
 /Users/j.doe/Downloads/build-qmlc++-Desktop_Qt_5_1_0_clang_64bit-Debug/qmlc++.app/Contents/MacOS/qmlc++
  
 a quitt? avec le code 255
 

Can't help you there. See my previous comment regarding Qt Quick.

 So I finally gave up for now and I tried to create a new hello world 
 application, then I wanted to see the option to import an external 
 library
 into the project so I right-clicked on the project - Add library... 
 then a dialog appeared but in the mean time I changed my mind and I 
 wanted to do something else before inserting a libray BUT WHERE IS THE 
 CANCEL BUTTON ? I have to launch process explorer to quit this dialog.
 
 UPDATE : I found that to quit the import lib dialog I can press Esc key 
 but to me this is ugly, it shouldn't be difficult to rename the Go 
 back button into Cancel when you are on the first state of the 
 dialog…

Or you could have just closed the dialog with the standard red button in the 
title….

 I am a bit disappointed.
 
 I found this problem withing 10 minutes so now I am a bit afraid to 
 keep on testing.

Qt has come a long way on the mac recently. Qt/Mac has gone from being the poor 
relation (shitty installer, slow widgets) to actually being
pretty decent, especially with the LLVM and LLDB integration. Of course I'm 
referring to Qt with widgets via C++.

See previous comment regarding Qt Quick.___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] Undocumented? QDBusMessage as a catch-all slot signature

2013-08-30 Thread Alejandro Exojo
Hi.

My first attempts with QtDBus were a bit bad due to one simple thing:
I was unable to connect properly a DBus signal with my slot. The
problem turned out to be a simple signature mismatch.

Then I peeked in the qdbusviewer source code (great app, BTW), and I
saw that to connect to arbitrary DBus signals it had a QDBusMessage as
only parameter.

My question is: is this a warrantied behavior? Because is not
documented in QDBusConnection::connect, and it was tremendously
helpful to me. I think is worth it to mention in the docs.

Thank you.
Regards.

-- 
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] Converting std::string.c_str() code to use QString methods

2013-08-30 Thread Scott Aron Bloom
I use toUtf8()... Though it wouldn't surprise me if Thiago scolds me for it :)

Note, If you are using a variatic function (printf), you need to use 
toUtf8().data()

toUtf() returns a QbyteArray which has a conversion operator to char *... 

Scott

-Original Message-
From: interest-bounces+scott.bloom=onshorecs@qt-project.org 
[mailto:interest-bounces+scott.bloom=onshorecs@qt-project.org] On Behalf Of 
Michael Jackson
Sent: Friday, August 30, 2013 12:09 PM
To: interest@qt-project.org
Subject: [Interest] Converting std::string.c_str() code to use QString methods

I have a large code base that we are migrating to more fully utilize Qt 
classes. Many places in the code have lines like the following:

std::string path(/path/to/foo.txt);
FILE* f = fopen(path.c_str(), wb);

If the path variable is now declared as a QString which QString method would 
be me the equivalent as the c_str() of std::string?

Not sure if I should be using toASCII() or data() or toUtf8() or what 
exactly.

Google didn't really give me a definitive answer.

Many Thanks
--
Mike Jackson
imikejackson  gmail * com

___
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] Converting std::string.c_str() code to use QString methods

2013-08-30 Thread Michael Jackson
I have a large code base that we are migrating to more fully utilize Qt 
classes. Many places in the code have lines like the following:

std::string path(/path/to/foo.txt);
FILE* f = fopen(path.c_str(), wb);

If the path variable is now declared as a QString which QString method would 
be me the equivalent as the c_str() of std::string?

Not sure if I should be using toASCII() or data() or toUtf8() or what 
exactly.

Google didn't really give me a definitive answer.

Many Thanks
--
Mike Jackson
imikejackson  gmail * com

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


Re: [Interest] Converting std::string.c_str() code to use QString methods

2013-08-30 Thread Andreas Pakulat
Hi,

On Fri, Aug 30, 2013 at 9:08 PM, Michael Jackson imikejack...@gmail.comwrote:

 I have a large code base that we are migrating to more fully utilize Qt
 classes. Many places in the code have lines like the following:

 std::string path(/path/to/foo.txt);
 FILE* f = fopen(path.c_str(), wb);

 If the path variable is now declared as a QString which QString method
 would be me the equivalent as the c_str() of std::string?

 Not sure if I should be using toASCII() or data() or toUtf8() or
 what exactly.

 Google didn't really give me a definitive answer.


In this particular case you want QFile::encode(path).data() to get the
string encoded in a way that fopen can handle - assuming the path actually
comes from the user originally. Otherwise
http://qt-project.org/doc/qt-4.8/qfile.html#encodeName says all hardcoded
paths should be ascii anyway so you could use toAscii().data().

In other places you may need other function, depending on what encoding the
function the char* is passed to expects. For example for the various
print-functions you'd usually use toLocal8Bit().data() to make sure that
the text is printed in the users current locale. Beyond that you'll have to
consult the documentation/implementation of whatever function you want to
pass the string data to wether it expects a certain encoding or requires
ascii etc.

The only thing to watch out for is that toUtf8() gives you a temporary
ByteArray and hence calling data() on it yields a char-pointer to a
temporary memory location. So if you pass this to a function that holds
onto the data beyond its execution you'll need to use something like this
to keep the QByteArray around long enough:

QString path(...);
QByteArray ba = path.toUtf8();
functionThatKeepsReferenceToChar(ba.data());
...

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


Re: [Interest] Converting std::string.c_str() code to use QString methods

2013-08-30 Thread Constantin Makshin
According to the documentation, toStdString() converts characters using
toAscii(). That means non-ASCII characters (ones with codes above 127)
will get messed up unless you explicitly set codec by calling
QTextCodec::setCodecForCStrings().

On 08/30/2013 11:33 PM, Michael Jackson wrote:
 So maybe I should go with .toStdString().c_str() to remain as compatible as 
 possible.
 
 --
 MJ.
 
 On Aug 30, 2013, at 3:26 PM, Constantin Makshin cmaks...@gmail.com wrote:
 
 std::string is more like QByteArray than QString because it's just a
 dynamically-resizeable version of classic C strings, i.e. it doesn't
 know anything about encodings. On the other hand, internally QString
 always is UTF-16 and therefore knows how to convert its contents to
 other encodings.

 That means there's no single answer to your question.
 As for your example, on *nix toUtf8().constData() will likely do the
 trick, on Windows it's better to use utf16() together with _wfopen().

 On 08/30/2013 11:08 PM, Michael Jackson wrote:
 I have a large code base that we are migrating to more fully utilize Qt 
 classes. Many places in the code have lines like the following:

 std::string path(/path/to/foo.txt);
 FILE* f = fopen(path.c_str(), wb);

 If the path variable is now declared as a QString which QString method 
 would be me the equivalent as the c_str() of std::string?

 Not sure if I should be using toASCII() or data() or toUtf8() or what 
 exactly.

 Google didn't really give me a definitive answer.

 Many Thanks
 --
 Mike Jackson
 imikejackson  gmail * com



signature.asc
Description: OpenPGP digital signature
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Converting std::string.c_str() code to use QString methods

2013-08-30 Thread Paul Miller
On 8/30/13 2:08 PM, Michael Jackson wrote:
 I have a large code base that we are migrating to more fully utilize Qt 
 classes. Many places in the code have lines like the following:

 std::string path(/path/to/foo.txt);
 FILE* f = fopen(path.c_str(), wb);

 If the path variable is now declared as a QString which QString method 
 would be me the equivalent as the c_str() of std::string?

 Not sure if I should be using toASCII() or data() or toUtf8() or what 
 exactly.

Like Scott I use toUf8() when I need to do that (be kind, Thiago!). But 
instead of using FILE * you should prefer a QFile instead if you are able.

I find myself using QtCore more and more to build little command-line 
tools now, at the expense of a 10MB executable.
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QtLinuxFB no mouse or keyboard

2013-08-30 Thread yahoo pers
My keyboard is detected as /dev/input/event0   and my  mouse  as /dev/input/mice
In my app i have a QLineEdit and when it starts i can see the cursor blinking 
in it.
I tried:
export QT_QPA_EVDEV_KEYBOARD_PARAMETERS=/dev/input/event0 
sudo ./app -platform linuxfb

but still no keyboard.


then i tried:
./app -platform linuxfb -plugin EvdevKeyboard:/dev/input/event0
but still no keyboard.




 From: Knight Andrew andrew.kni...@digia.com
To: yahoo pers yours_p...@yahoo.com; interest@qt-project.org 
interest@qt-project.org 
Sent: Friday, August 30, 2013 7:43 AM
Subject: RE: [Interest] QtLinuxFB no mouse or keyboard
 

 A also wrote on the forum and i got help to build qt5 and run the app but 
 couldn't get help about the mouse and keyboard problem.

Some QPA plugins, like LinuxFB, don't load their own input handlers, so you 
need to do this yourself by passing additional -plugin arguments when you start 
your app. These are called generic plugins and can be found in 
qtbase/src/plugins/generic. For example:

./myapp -platform linuxfb -plugin EvdevMouse -plugin EvdevKeyboard

Those plugins will automatically try to open the first mouse/keyboard in 
/dev/input. Make sure the user has read permissions for those devices (you 
should see warning messages if opening fails). For specifying additional 
parameters that get passed to the plugin(s), please consult each individual 
plugin's source code.

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


Re: [Interest] Converting std::string.c_str() code to use QString methods

2013-08-30 Thread Michael Jackson

On Aug 30, 2013, at 3:45 PM, Andreas Pakulat ap...@gmx.de wrote:

 Hi,
 
 On Fri, Aug 30, 2013 at 9:08 PM, Michael Jackson imikejack...@gmail.com 
 wrote:
 I have a large code base that we are migrating to more fully utilize Qt 
 classes. Many places in the code have lines like the following:
 
 std::string path(/path/to/foo.txt);
 FILE* f = fopen(path.c_str(), wb);
 
 If the path variable is now declared as a QString which QString method 
 would be me the equivalent as the c_str() of std::string?
 
 Not sure if I should be using toASCII() or data() or toUtf8() or what 
 exactly.
 
 Google didn't really give me a definitive answer.
 
 In this particular case you want QFile::encode(path).data() to get the string 
 encoded in a way that fopen can handle - assuming the path actually comes 
 from the user originally. Otherwise 
 http://qt-project.org/doc/qt-4.8/qfile.html#encodeName says all hardcoded 
 paths should be ascii anyway so you could use toAscii().data().
 
 In other places you may need other function, depending on what encoding the 
 function the char* is passed to expects. For example for the various 
 print-functions you'd usually use toLocal8Bit().data() to make sure that the 
 text is printed in the users current locale. Beyond that you'll have to 
 consult the documentation/implementation of whatever function you want to 
 pass the string data to wether it expects a certain encoding or requires 
 ascii etc.
 
 The only thing to watch out for is that toUtf8() gives you a temporary 
 ByteArray and hence calling data() on it yields a char-pointer to a temporary 
 memory location. So if you pass this to a function that holds onto the data 
 beyond its execution you'll need to use something like this to keep the 
 QByteArray around long enough:
 
 QString path(...);
 QByteArray ba = path.toUtf8();
 functionThatKeepsReferenceToChar(ba.data());
 ...
 
 Andreas

Thanks for the nice explanations. In some places we use FILE*, some iostream, 
some custom file. There are other places that we use the HDF5 library and it is 
C based and takes char* for all of its string type arguments. Was hoping 
for a nice global search and replace but I'll have to take it line by line.

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


[Interest] Compiler Error from moc_MainWindow.cpp

2013-08-30 Thread Mitchell Verter
I am getting errors when the Makefile tries to compile moc_MainWindow.o
from moc_MainWindow.cpp.

moc_MainWindow.cpp is a generated file so I'm not clear why I am not seeing
any errors in previous code.

I am using Qt5.1.1

The errors are:
moc_MainWindow.cpp:104:50: error: expected unqualified-id before ‘int’
moc_MainWindow.cpp:104:50: error: expected ‘}’ before ‘int’
moc_MainWindow.cpp:104:50: error: expected ‘,’ or ‘;’ before ‘int’
moc_MainWindow.cpp:111:1: error: expected declaration before ‘}’ token


Below is the function that generates the errors.  I have added line numbers.

static const uint qt_meta_data_MainWindow[] = {

 // content:
   7,   // revision
   0,   // classname
   0,0, // classinfo
  13,   14, // methods
   0,0, // properties
   0,0, // enums/sets
   0,0, // constructors
   0,   // flags
   1,   // signalCount

 // signals: name, argc, parameters, tag, flags
   1,1,   79,2, 0x05,

 // slots: name, argc, parameters, tag, flags
   3,0,   82,2, 0x08,
   4,1,   83,2, 0x08,
   5,1,   86,2, 0x08,
   6,1,   89,2, 0x08,
   8,0,   92,2, 0x08,
   9,0,   93,2, 0x08,
  10,1,   94,2, 0x08,
  12,2,   97,2, 0x08,
  13,2,  102,2, 0x08,
  14,2,  107,2, 0x08,
  16,0,  112,2, 0x08,
  17,0,  113,2, 0x08,

 // signals: parameters
QMetaType::Void, QMetaType::QString,2,

 // slots: parameters
QMetaType::Void,
QMetaType::Void, QMetaType::Int,2,
QMetaType::Void, QMetaType::Int,2,
QMetaType::Void, QMetaType::QString,7,
QMetaType::Void,
QMetaType::Void,
103:QMetaType::Void, 0x8000 | 11,2,
104:QMetaType::Void, QMetaType::UInt, QMetaType::Bool,2,2,
105:QMetaType::Void, QMetaType::UInt, QMetaType::QString,2,2,
106:   QMetaType::Void, QMetaType::UInt, 0x8000 | 15,2,2,
107:QMetaType::Void,
108:QMetaType::Void,
109:
110:  0// eod
111: };
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QNAM::get() spawns three processess and opens file descriptors which I am unable to close

2013-08-30 Thread Thiago Macieira
On quarta-feira, 28 de agosto de 2013 17:11:22, gsmember gs wrote:
 Hi,I wrote a desktop app on Debian5. Right after the first manager-get() I
 opened pstree and htop:root@kvm2:~# pstree | grep votebotserver
 |-screen---votebotserver---4*[{votebotserver}] htop shows me 4 running
 processess as well.

Those are threads. Don't kill them.

 And after 2 hours, running many
 requests, I hit the user limit of open file descriptors. 

Please show us a small, self-contained, compilable example of the problem. I 
have never heard of file descriptor leakage in Qt.

 lsof | grep resrv gave me a bunch of open fd's:[...]
 resrv 12701  root   13r FIFO0,8  0t0 319902 pipe
 resrv 12701  root   14w FIFO0,8  0t0 319902 pipe

Those are pipes. They aren't related to QNAM, since QNAM doesn't use pipes.

It could be because of the threads. Each thread that you start consumes 2 file 
descriptors in the form of pipes (until Qt 5.1 or until a recent enough glib2 
in your system, then it's only one). But you said that the number of threads 
running was only 3, so that doesn't explain.

-- 
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] Adding custom qmake directives?

2013-08-30 Thread Thiago Macieira
On sexta-feira, 30 de agosto de 2013 10:53:49, Soroush Rabiei wrote:
 I would like to introduce new directives to qmake of target system. I have
 a toolkit made up of a set of libraries and templated code-bases. It should
 be possible to easily include / exclude its modules to Qt project. A
 project file may look like this :
 
 # users_application.pro
 QT   += core gui sql
 AGT  += core acl security # This like
 TARGET = my_application
 TEMPLATE = app
 SOURCES += main.cpp ...
 
 The second line should be expanded to:
 
 LIBS += -lagt_code -lagt_acl -lagt_security -lagt_crypto -lpthread # and /
 or other dependencies
 INCLUDEPATH += concluded include dirs
 
 I guess doing things like this requires modifying Qt's configuration files.
 Of course it should be possible to revert back all changes on uninstall.

You need to do the following:

1) add to that source there: CONFIG += agt
   The CONFIG += qt  part is automatic

2) add an agt.prf file to qmake's mkspecs/features dir

3) in that agt.prf file, interpret the $$AGT variable and add to LIBS and 
INCLUDEPATH as needed

-- 
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] My First approach with QT 5.1 on MacOS : very disappointing

2013-08-30 Thread Thiago Macieira
On sexta-feira, 30 de agosto de 2013 16:03:49, Vincent R. wrote:
 I found this one :
 http://www.ics.com/blog/integrating-c-qml?page=1
 
 I have downloaded the source code, started Creator and clicked on the
 Debug button but of course it doesn't
 work and I get the following errors :
 
 /Users/j.doe/Developer/Qt5.1.0/5.1.0/clang_64/include/QtCore/qlist.h:52:
 erreur : 'initializer_list' file not found
 #include initializer_list
   ^

The error above is caused by using clang with C++11 and without libc++. C++11 
is not enabled by default.

 So I have edited the file qmlc++.pro to add -stdlib=libc+ and CONFIG
 +=c++11 (as shown below)
 
 qmlc++.pro:
 --
 lessThan(QT_MAJOR_VERSION, 5): error(This project requires Qt 5 or
 later)
 
 # Needed by g++ for C++11 support. Adjust as needed for other
 compilers.
 QMAKE_CXXFLAGS += -std=c++0x -stdlib=libc+
 CONFIG +=c++11

Why is the -std=c++0x flag there? And was it there before you started following 
questionable advice from Stack Overflow?

Can you post the .pro file that creates the original error message above?

-- 
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] My First approach with QT 5.1 on MacOS : very disappointing

2013-08-30 Thread Thiago Macieira
On sexta-feira, 30 de agosto de 2013 19:18:31, Alejandro Exojo wrote:
  /Users/j.doe/Developer/Qt5.1.0/5.1.0/clang_64/include/QtCore/qlist.h:52:
  erreur : 'initializer_list' file not found
  #include initializer_list
 
^
 
 So, you used a project that uses C++11, and the compiler doesn't
 enable C++11 by default. That's not Qt's fault.

To be quite clear: the problem is that C++11 was improperly enabled. Qt 
supports both C++98 mode and *proper* C++11 mode.

See my other email.
-- 
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] Undocumented? QDBusMessage as a catch-all slot signature

2013-08-30 Thread Thiago Macieira
On sexta-feira, 30 de agosto de 2013 19:35:07, Alejandro Exojo wrote:
 My question is: is this a warrantied behavior? Because is not
 documented in QDBusConnection::connect, and it was tremendously
 helpful to me. I think is worth it to mention in the docs.

Yeah, it's been there since before QtDBus was called QtDBus. It was the only 
way of receiving messages before I added the code that searched for slots in 
your meta object :-)

So yeah, you can use it.

Also, you're the first person ever to say qdbusviewer is a great app. It's my 
first -- and so far, only, and you can see why -- attempt at a GUI app...

-- 
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] Converting std::string.c_str() code to use QString methods

2013-08-30 Thread Thiago Macieira
On sexta-feira, 30 de agosto de 2013 19:17:58, Scott Aron Bloom wrote:
 I use toUtf8()... Though it wouldn't surprise me if Thiago scolds me for it

If you're on Unix, that's fine. It's fine because if your Unix system uses a 
locale different from UTF-8, you *really* should be scolded :-)

If you're on Windows, you shouldn't use fopen in the first place.
-- 
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] Converting std::string.c_str() code to use QString methods

2013-08-30 Thread Thiago Macieira
On sexta-feira, 30 de agosto de 2013 16:00:17, Michael Jackson wrote:
 Thanks for the nice explanations. In some places we use FILE*, some
 iostream, some custom file. There are other places that we use the HDF5
 library and it is C based and takes char* for all of its string type
 arguments. Was hoping for a nice global search and replace but I'll have
 to take it line by line.

As I said in the other email, if you're going to run this code on Windows, you 
should stop using fopen and iostreams. You can continue using _wfopen, which 
is a Windows-specific function.

-- 
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] Compiler Error from moc_MainWindow.cpp

2013-08-30 Thread Thiago Macieira
On sexta-feira, 30 de agosto de 2013 16:41:12, Mitchell Verter wrote:
 moc_MainWindow.cpp:104:50: error: expected unqualified-id before ‘int’
 moc_MainWindow.cpp:104:50: error: expected ‘}’ before ‘int’

 104:QMetaType::Void, QMetaType::UInt, QMetaType::Bool,2,2,

Note how there's no int on that line.

Whenever you get an error that doesn't make sense, it's likely to be a 
preprocessor problem.

My guess:
#define Bool int

Solution:
get a big axe and apply to the C header that does such things

If you need booleans in C code, use this:

#ifndef __cplusplus
#  include stdbool.h
#endif

Then use regular bool.
-- 
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] Converting std::string.c_str() code to use QString methods

2013-08-30 Thread Syam
On 31-Aug-2013 6:28 AM, Thiago Macieira thiago.macie...@intel.com wrote:

 On sexta-feira, 30 de agosto de 2013 19:17:58, Scott Aron Bloom wrote:
  I use toUtf8()... Though it wouldn't surprise me if Thiago scolds me
for it

 If you're on Unix, that's fine. It's fine because if your Unix system
uses a
 locale different from UTF-8, you *really* should be scolded :-)

On Linux, whenever I need a const char* from a QString, I always do
toLatin1().constData().

Earlier I used toAscii(), but then some discussion on Qt5 suggested that
toLatin1() is more appropriate.

Am I right here? Of course, the assumption is that the original QString is
simple English text.

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