<?xml version="1.0" encoding="UTF-8"?>

<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">

    
	<channel>

	<title>Qt DevNet forums: C++ Gurus</title>
	<link>http://qt-project.org/forums/viewforum/36/</link>
	<description>RSS feed for latest threads in C++ Gurus</description>
	<copyright>Copyright 2013 Qt Project</copyright>
	<docs>http://www.rssboard.org/rss-specification</docs>
	<generator>ExpressionEngine v2.3.1 http://expressionengine.com/</generator>
	<lastBuildDate>Tue, 04 Jan 2011 18:25:29 GMT</lastBuildDate>
	<atom:link href="http://qt-project.org/feeds/forum/36" rel="self" type="application/rss+xml" />

    

	
        <item>
            <title>Very strange behaviour with QLibrary.</title>
            <link>http://qt-project.org/forums/viewthread/27593</link>
            <author>mrdebug</author>
            <description><![CDATA[In order to get the videocameras list I try to use this function:

	&amp;nbsp; &amp;nbsp; void MainWindow::on_pushButton_clicked&#40;&#41; &#123;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; QLibrary Avicap&#40;&amp;quot;avicap32.dll&amp;quot;&#41;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; typedef bool &#40;*CapGetDriverDescription&#41;&#40;uint wDriverIndex, char *lpszName, int cbName, char *lpszVer, int cbVer&#41;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; CapGetDriverDescription capGetDriverDescription= &#40;CapGetDriverDescription&#41;Avicap.resolve&#40;&amp;quot;capGetDriverDescriptionA&amp;quot;&#41;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if &#40;capGetDriverDescription&#41; &#123;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for &#40;int count= 0; count&amp;lt; 2; count++&#41; &#123;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; char szDeviceName&#91;256&#93;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; char szDeviceVersion&#91;256&#93;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; memset&#40;szDeviceName, &apos;\0&apos;, sizeof&#40;szDeviceName&#41;&#41;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; memset&#40;szDeviceVersion, &apos;\0&apos;, sizeof&#40;szDeviceVersion&#41;&#41;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if &#40;capGetDriverDescription&#40;count, szDeviceName, sizeof&#40;szDeviceName&#41;, szDeviceVersion, sizeof&#40;szDeviceVersion&#41;&#41;&#41; &#123;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ui&#45;&amp;gt;textEdit&#45;&amp;gt;append&#40;QString&#40;szDeviceName&#41;&#41;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &#125; else break;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &#125;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &#125;
&amp;nbsp; &amp;nbsp; &#125;


	But the program goes to crash. A function that works but is very strange and horrible is this:

	&amp;nbsp; &amp;nbsp; for &#40;int count= 0; count&amp;lt; 10; count++&#41; Enumerate&#40;count&#41;;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; void MainWindow::Enumerate&#40;int index&#41; &#123;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; QLibrary Avicap&#40;&amp;quot;avicap32.dll&amp;quot;&#41;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; typedef bool &#40;*CapGetDriverDescription&#41;&#40;uint wDriverIndex, char *lpszName, int cbName, char *lpszVer, int cbVer&#41;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; CapGetDriverDescription capGetDriverDescription= &#40;CapGetDriverDescription&#41;Avicap.resolve&#40;&amp;quot;capGetDriverDescriptionA&amp;quot;&#41;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if &#40;capGetDriverDescription&#41; &#123;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; char szDeviceName&#91;80&#93;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; char szDeviceVersion&#91;80&#93;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; memset&#40;szDeviceName, &apos;\0&apos;, sizeof&#40;szDeviceName&#41;&#41;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; memset&#40;szDeviceVersion, &apos;\0&apos;, sizeof&#40;szDeviceVersion&#41;&#41;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if &#40;capGetDriverDescription&#40;index, szDeviceName, sizeof&#40;szDeviceName&#41;, szDeviceVersion, sizeof&#40;szDeviceVersion&#41;&#41;&#41; &#123;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ui&#45;&amp;gt;textEdit&#45;&amp;gt;append&#40;QString&#40;szDeviceName&#41;+ &amp;quot;, &amp;quot;+ QString&#40;szDeviceVersion&#41;&#41;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Sleep&#40;10&#41;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &#125; else ui&#45;&amp;gt;textEdit&#45;&amp;gt;append&#40;&amp;quot;Error!!!&amp;quot;&#41;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &#125;
&amp;nbsp; &amp;nbsp; &#125;


	Look: you have to query for ten times the function “capGetDriverDescriptionA” defining “QLibrary Avicap(“avicap32.dll”);” each time.
In “Enumerate” function you have to insert “Sleep(10);”.
Very strange but now works.

	What do you think about? There is a bug in QLibrary object?]]></description>
            <guid isPermaLink="false">http://qt-project.org/forums/viewthread/27593</guid>
            <pubDate>Wed, 08 May 2013 23:36:26 GMT</pubDate>
        </item>
	
        <item>
            <title>Creation of .dll file using build option in Qt&#45;Creator</title>
            <link>http://qt-project.org/forums/viewthread/27553</link>
            <author>sandeepv</author>
            <description><![CDATA[Hi

	I have a project which has to create a .dll file when run in debug or release modes. But i see no .dll file is created, but it shows a .exe file created instead. Please help me out how to create a .dll file. Please tell me what is the mistake i&#8217;m making.

	Thank you in advance.

	&#45; Sandeep]]></description>
            <guid isPermaLink="false">http://qt-project.org/forums/viewthread/27553</guid>
            <pubDate>Tue, 07 May 2013 23:45:30 GMT</pubDate>
        </item>
	
        <item>
            <title>Qt Diverge</title>
            <link>http://qt-project.org/forums/viewthread/27497</link>
            <author>Ash001</author>
            <description><![CDATA[Hi Guys, 
I am trying to run a program named Qt Diverge. It is a software used in Evolutionary biology. AFter installation I have the following files in the folder (MSVCIRTD.DLL, MSVCP60D.DLL,MSVCRTD.DLL,qt&#45;mt230nc.dll and application file). My program run for some time and in the middle always it gives me &#8220;the application has requested the runtime to terminate it in an unusal way&#8221; &#8230;..I have installed 1. Microsoft V C++ redistributable 2005, M.SQL server 2005 compaque eddition (ENU), MV C++ 2008 redistributable *86, 9.0.2&#8230;. and 9.0.3&#8230;.MV C++ 2010 redistributable *64 10.0&#8230;.and *86 10.0&#8230;Micro visual J#2 redistributable, My SQL server 5 and MSXML 4 parser&#8230;
I am using window 7 ultimate Hp proBook4530s COREi3. The problem arise when I uninstall 2010 Office and replace it with 2007. Now I once again install 2010 but problem persist. I am not good in computer knowledge therefore i wrote all informations according my knowledge. the program is really important for me to run. If any one can guide me, i will be extremly thankful to them.]]></description>
            <guid isPermaLink="false">http://qt-project.org/forums/viewthread/27497</guid>
            <pubDate>Mon, 06 May 2013 18:56:46 GMT</pubDate>
        </item>
	
        <item>
            <title>Autosave and password protection help?</title>
            <link>http://qt-project.org/forums/viewthread/27025</link>
            <author>hunterallen40</author>
            <description><![CDATA[Hello all, 

	I have a classroom cash program I have been writing for a while. It works really well, but there is one thing I have yet to fix: I need to have the password file set up, and I need to have an autosave file set up. 

	My current password file writes to a text document and encrypts the file with Md5. But, the file can be deleted. If the file is not detected, the software asks the user to make one. This is obviously a HUGE security problem. 

	As for the autosave file, it can be deleted as well. 

	So&#8230; any advice? Any QFile tips for me? Directory suggestions? Any help is much appreciated! Thank you in advance, 

	&#45;Hunter A.]]></description>
            <guid isPermaLink="false">http://qt-project.org/forums/viewthread/27025</guid>
            <pubDate>Mon, 22 Apr 2013 16:10:17 GMT</pubDate>
        </item>
	
        <item>
            <title>Serial port</title>
            <link>http://qt-project.org/forums/viewthread/26698</link>
            <author>JoeMatt</author>
            <description><![CDATA[Hi guys, I&#8217;m apologize for my English, I hope explain well my problem.. I should use C++ to activate the serial port of a microcontrollor which is located on a rover.., and I should be able to communicate with it, sending information and receiving. But I&#8217;ve no idea to start.. Can you help to solve my problem, giving me some advices? Thank you very much]]></description>
            <guid isPermaLink="false">http://qt-project.org/forums/viewthread/26698</guid>
            <pubDate>Sat, 13 Apr 2013 17:04:11 GMT</pubDate>
        </item>
	
        <item>
            <title>Generating words program</title>
            <link>http://qt-project.org/forums/viewthread/26415</link>
            <author>Anticross</author>
            <description><![CDATA[I have some set of chars QSet&amp;lt;QChar&amp;gt;, and some QStringList to store result. I need to write method that depends on int length value generates all possible combinations of char set size of length. I&#8217;ll tried to done this w/o recursion but have failed. I need your help:
void generate&#40;QSet&amp;lt;QChar&amp;gt; &amp;amp; source, QStringList &amp;amp; result, int length&#41;
&#123;
&amp;nbsp; &amp;nbsp; if &#40;length &amp;lt;= 0&#41;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; QString word;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; QSetIterator&amp;lt;QChar&amp;gt; iter&#40;source&#41;;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; while &#40;iter.hasNext&#40;&#41;&#41; &#123;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; word = &amp;quot;&amp;quot;;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; QChar charechter = iter.next&#40;&#41;;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for &#40;int i = 0; i &amp;lt;= length; i++&#41;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; word += charechter;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if &#40;result.contains&#40;word&#41; == false&#41;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; result.append&#40;word&#41;;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int n = 1;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; while &#40;n &amp;lt; length&#41; &#123;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int pos = length;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; while &#40;pos &amp;gt; 0&#41; &#123;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; QSetIterator&amp;lt;QChar&amp;gt; replaceIter&#40;source&#41;;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; while &#40;replaceIter.hasNext&#40;&#41;&#41; &#123;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; QChar replaceChar = replaceIter.next&#40;&#41;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; word.replace&#40;pos, n, replaceChar&#41;;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if &#40;result.contains&#40;word&#41; == false&#41;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; result.append&#40;word&#41;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &#125;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; pos = pos &#45; n;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &#125;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; n++;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &#125;
&amp;nbsp; &amp;nbsp; &#125;
&amp;nbsp;
&#125;]]></description>
            <guid isPermaLink="false">http://qt-project.org/forums/viewthread/26415</guid>
            <pubDate>Fri, 05 Apr 2013 13:08:21 GMT</pubDate>
        </item>
	
        <item>
            <title>[Solved] creating new Object in const method</title>
            <link>http://qt-project.org/forums/viewthread/26335</link>
            <author>Asperamanca</author>
            <description><![CDATA[Ok, I admit, from the title alone, it sounds like &#8220;oh no!&#8221;. But there&#8217;s good reason for my madness.

	The problem in a nutshell:

	Within a &#8216;const&#8217; method, I create a new Object:

	m_pLayoutTextDocument = new QTextDocument&#40;this&#41;;


	which has been declared as &#8216;mutable&#8217;

	mutable QTextDocument* m_pLayoutTextDocument;


	Even though declared as mutable, gcc complains:
error: invalid conversion from &apos;const QObject*&apos; to &apos;QObject*&apos;


	The reason why I am doing this at all is lazy initialization, a pattern I use regularly:
The m_pLayoutTextDocument I create will, for many instances of my class, not be used at all. Since my object can be created often, and only some of them us the TextDocument (for calculation of preferred size, btw.), I want to delay the creation of this object until the last possible time.

	The last possible time (and a very logical one, too) is when the user of the class calls
myclass.getPreferredSize&#40;&#41;;

which is a &#8216;const&#8217; method (otherwise, the user of my class gets into trouble with his const correctness).

	So, within getPreferredSize(), I have
&amp;nbsp; &amp;nbsp; if &#40; ! m_bPreferredSizeValid &#41;
&amp;nbsp; &amp;nbsp; &#123;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; updatePreferredSize&#40;&#41;;
&amp;nbsp; &amp;nbsp; &#125;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; return m_LastPreferredSize;


	so updatePreferredSize() must be &#8216;const&#8217; too, and hence the problem.

	One possible solution would be to cast away my own const&#45;ness in order to call a non&#45;const method creating the object.

	Do you think that it would be safe (while undoubtedly ugly) to do the following:

	CTpeb_GraphicsTextPrivate* thisMutable = const_cast&amp;lt;CTpeb_GraphicsTextPrivate*&amp;gt;&#40;this&#41;;
// Now I can call a non&#45;const method which creates my object
thisMutable&#45;&amp;gt;createLayoutDocument&#40;&#41;;]]></description>
            <guid isPermaLink="false">http://qt-project.org/forums/viewthread/26335</guid>
            <pubDate>Tue, 02 Apr 2013 10:13:31 GMT</pubDate>
        </item>
	
        <item>
            <title>[solved] advanced &quot;divide &amp; conquer&quot; like method</title>
            <link>http://qt-project.org/forums/viewthread/26061</link>
            <author>Nobody&#45;86</author>
            <description><![CDATA[Hi,
I am looking for a advanced / extended &#8220;divide &amp;amp; conquer&#8221; like algorithm for my problem.
I have a function which take a double X and return a double Y. Now I need to know the value of X to receive Y=0. This must be done by iterate multiple values of X. There is no way to perform a analytic study, couse the function differs by previous user input.
By manipulating X in one direction, Y is also moving in one direction (could be positiv or negative but always in one direction). There are no gaps / singularity effect or something like that.
My suggestion was to calculate Y two times, see the direction &#8220;where to move&#8221; and then raise or lower X till Y is 0 (approx). But this seems to be very time consuming, and I hope there is a way to speed it up by &#8220;intelligent guessing&#8221;.

	Thanks,
Nobody&#45;86]]></description>
            <guid isPermaLink="false">http://qt-project.org/forums/viewthread/26061</guid>
            <pubDate>Mon, 25 Mar 2013 19:36:34 GMT</pubDate>
        </item>
	
        <item>
            <title>Incomplete Data When reading Threaded TCP Socket</title>
            <link>http://qt-project.org/forums/viewthread/25885</link>
            <author>carljoans</author>
            <description><![CDATA[I have an http server

	server = new httpserver&#40;this&#41;;
&amp;nbsp; &amp;nbsp; connect&#40;server,SIGNAL&#40;newConnection&#40;&#41;&#41;,this,SLOT&#40;newconnection&#40;&#41;&#41;&#41;;


	reimplemented incomingConnection so that I can create the socket and read it in a new thread.

	void httpserver::incomingConnection&#40; int socketDescriptor &#41; &#123;
&amp;nbsp; &amp;nbsp; DESCRIPTOR = socketDescriptor;
&#125;


	then in newconnection slot:

	void serverapp::newconnection&#40;&#41; &#123;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; processor *process = new processor&#40;server&#45;&amp;gt;DESCRIPTOR, this&#41;;
&amp;nbsp; &amp;nbsp; connect&#40;process, SIGNAL&#40;finished&#40;&#41;&#41;, process, SLOT&#40;deleteLater&#40;&#41;&#41;&#41;;
&amp;nbsp; &amp;nbsp; process&#45;&amp;gt;start&#40;&#41;;
&amp;nbsp;
&#125;


	inside run:

	void processor::run&#40;&#41; &#123;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; QTcpSocket *socket = new QTcpSocket&#40;&#41;;
&amp;nbsp; &amp;nbsp; socket&#45;&amp;gt;setSocketDescriptor&#40;DESCRIPTOR&#41;;
&amp;nbsp; &amp;nbsp; socket&#45;&amp;gt;waitForReadyRead&#40;&#41;;
&amp;nbsp; &amp;nbsp; QByteArray text = socket&#45;&amp;gt;readAll&#40;&#41;;
&amp;nbsp; &amp;nbsp; ...
&amp;nbsp;
&#125;


	When I recieve a POST request it sometimes reads all the data, other times not. It only reads the header info and not the actual content:

	POST /admin HTTP/1.0
Host: abc.com
User&#45;Agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:18.0) Gecko/20100101 Firefox/18.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8
Accept&#45;Language: en&#45;ZA,en&#45;GB;q=0.8,en&#45;US;q=0.5,en;q=0.3
Accept&#45;Encoding: gzip, deflate
Referer: http://abc.com/admin
Content&#45;Type: application/x&#45;www&#45;form&#45;urlencoded
Content&#45;Length: 64
Connection: keep&#45;alive

	NO URL&#45;ENCODED STRING HERE!

	But, when I don&#8217;t thread it or reimplement tcpserver I get all the data with url&#45;encoded content every time.

	QTcpSocket *socket = server&#45;&amp;gt;nextPendingConnection&#40;&#41;;
socket&#45;&amp;gt;waitForReadyRead&#40;&#41;;
QByteArray text = socket&#45;&amp;gt;readAll&#40;&#41;;
print&#40;QString::fromLocal8Bit&#40;text.data&#40;&#41;, text.size&#40;&#41;&#41;&#41;;]]></description>
            <guid isPermaLink="false">http://qt-project.org/forums/viewthread/25885</guid>
            <pubDate>Wed, 20 Mar 2013 15:44:42 GMT</pubDate>
        </item>
	
        <item>
            <title>Best practice for a Preferences dialog..</title>
            <link>http://qt-project.org/forums/viewthread/25774</link>
            <author>rivimey</author>
            <description><![CDATA[Folks,

	I&#8217;m an experienced developer though mostly not in Qt. I am curious as to what structure you would use for the data set in a preferences dialog. For example:

	
		The prefs dialog is a long&#45;lived object that can be queried for values, essentially globally;
		The prefs dialog is short&#45;lived, initialised from and changes another class/object that can be queried by other program code;
		The prefs dialog is short&#45;lived, initialised from code in the main program that reads prefs from other objects into it, displays the dialog, then writes changes back to other (multiple) objects;
		The prefs dialog is short&#45;lived, reads values from some global source &#8211; e.g QSettings &#8211; and writes back there. Other parts of the program always read from the same source;
	

	and many others are I possible&#8230;

	I have seen and implemented several of these and never felt that it was necessarily the &#8220;best&#8221; way. For example:

	The first two ways both split many values (with types that are perhaps not otherwise global) into an object and away from the place they are primarily used. The second way, while seeming to split view from data &#8220;properly&#8221;, also adds to the code that must be maintained although there may be offsetting advantages.

	The third option just invites mistakes of failure to update the prefs setter/getter code properly with changes to the objects. The final way also suffers from that, but also means the translation from QSettings (etc) format to internal format is done in many places and can get out of sync.

	Any thoughts?]]></description>
            <guid isPermaLink="false">http://qt-project.org/forums/viewthread/25774</guid>
            <pubDate>Sun, 17 Mar 2013 18:58:44 GMT</pubDate>
        </item>
	
        <item>
            <title>Empty Class Size</title>
            <link>http://qt-project.org/forums/viewthread/25751</link>
            <author>krishnakvs</author>
            <description><![CDATA[class EmptyClass
&#123;
public:
&#125;;
&amp;nbsp;
&amp;nbsp;
&amp;nbsp;int size = sizeof&#40;a&#41;;
cout&amp;lt;&amp;lt;size&amp;lt;&amp;lt;endl;


	Output is showing 8. Please tell me why?

	Edit: please wrap code between @ tags. Also moved to C++ gurus; Andre]]></description>
            <guid isPermaLink="false">http://qt-project.org/forums/viewthread/25751</guid>
            <pubDate>Sat, 16 Mar 2013 14:41:23 GMT</pubDate>
        </item>
	
        <item>
            <title>Using QtConcurrent::Exception with boost::exception</title>
            <link>http://qt-project.org/forums/viewthread/25750</link>
            <author>zethon</author>
            <description><![CDATA[I want to use an exception hierarchy where the base exception class derives from boost::exception so that I can get the nice and useful diagnostic information that that class has to offer and QtConcurrent::Exception so that I can throw my exceptions across threads.

	Hence, my base exception class looks like:

	class MyException : public QtConcurrent::Exception, public boost::exception
&#123;
public:
&amp;nbsp; &amp;nbsp; MyException&#40;&#41; &#123; &#125;;
&amp;nbsp; &amp;nbsp; virtual ~MyException&#40;&#41; throw&#40;&#41; &#123; &#125;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; // required by QtConcurrent::Exception to be implemented
&amp;nbsp; &amp;nbsp; virtual void raise&#40;&#41; const &#123; throw *this; &#125;
&amp;nbsp; &amp;nbsp; virtual MyException* clone&#40;&#41; const &#123; return new MyException&#40;*this&#41;; &#125;
&#125;;


	Per QtConcurrent::Exception&#8217;s documentation, raise() and clone() must be implemented in any class derived from QtConcurrent::Exception. So, the rest of my code may look something like:

	void foo&#40;&#41;
&#123;
&amp;nbsp; &amp;nbsp; BOOST_THROW_EXCEPTION&#40;MyException&#40;&#41;&#41;;
&#125;
&amp;nbsp;
int main&#40;int argc, char *argv&#91;&#93;&#41;
&#123;
&amp;nbsp; &amp;nbsp; QApplication app&#40;argc, argv&#41;;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; try
&amp;nbsp; &amp;nbsp; &#123;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; foo&#40;&#41;;
&amp;nbsp; &amp;nbsp; &#125;
&amp;nbsp; &amp;nbsp; catch &#40;const MyException&amp;amp; me&#41;
&amp;nbsp; &amp;nbsp; &#123;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; std::cerr &amp;lt;&amp;lt; boost::diagnostic_information&#40;me&#41;;
&amp;nbsp; &amp;nbsp; &#125;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; return 0;
&#125;


	However, using the BOOST_THROW_EXCEPTION() macro causes the following compilation error:

	
		error C2555: &#8216;boost::exception_detail::clone_impl::clone&#8217;: overriding virtual function return type differs and is not covariant from &#8216;MyException::clone&#8217;
	

	I am not entirely sure what this error is telling me (my fault, not the errors, I&#8217;m sure!).

	If I instead use throw MyException(); the code compiles just fine. As I mentioned above, I&#8217;d like to use BOOST_THROW_EXCEPTION() so that I get the diagnostic information in my exceptions.

	I know that one possible work&#45;around could be another class derived from just QtConcurrent::Exception that has a boost::exception member, essentially a container for the actual error. But if possible, I would like to continue to have the MyException class inherit from both QtConcurrent::Exception and boost::exception.

	Can someone offer some insight into what the error is saying? Is there any way to accomplish what I want?]]></description>
            <guid isPermaLink="false">http://qt-project.org/forums/viewthread/25750</guid>
            <pubDate>Sat, 16 Mar 2013 14:07:02 GMT</pubDate>
        </item>
	
        <item>
            <title>Streaming into default&#45;constructed object</title>
            <link>http://qt-project.org/forums/viewthread/25668</link>
            <author>Asperamanca</author>
            <description><![CDATA[I want to create a static constant by streaming into a default&#45;constructed object. However, the compiler cannot locate the streaming operator, although I provide it:

	QMap&amp;lt;float, int&amp;gt;&amp;amp; operator&amp;lt;&amp;lt;&#40;QMap&amp;lt;float, int&amp;gt;&amp;amp; map,
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;const QPair&amp;lt;float, int&amp;gt;&amp;amp; data&#41;
&#123;
&amp;nbsp; &amp;nbsp; &#40;void&#41; map.insert&#40;data.first, data.second&#41;;
&amp;nbsp; &amp;nbsp; return map;
&#125;
&amp;nbsp;
static const QMap&amp;lt;float, int&amp;gt; s_Map
&amp;nbsp; &amp;nbsp; = QMap&amp;lt;float, int&amp;gt;&#40;&#41; &amp;lt;&amp;lt; QPair&amp;lt;float,int&amp;gt;&#40;1.0,0&#41;;


	For contrast, the following code compiles (&#8220;works&#8221; would be too strong a word)

	QMap&amp;lt;float, int&amp;gt;&amp;amp; operator&amp;lt;&amp;lt;&#40;QMap&amp;lt;float, int&amp;gt;&amp;amp; map,
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;const QPair&amp;lt;float, int&amp;gt;&amp;amp; data&#41;
&#123;
&amp;nbsp; &amp;nbsp; &#40;void&#41; map.insert&#40;data.first, data.second&#41;;
&amp;nbsp; &amp;nbsp; return map;
&#125;
&amp;nbsp;
// Intermediate variable
static QMap&amp;lt;float, int&amp;gt; s_tempMap;
&amp;nbsp;
static const QMap&amp;lt;float, int&amp;gt; s_Map
&amp;nbsp; &amp;nbsp; = s_tempMap &amp;lt;&amp;lt; QPair&amp;lt;float,int&amp;gt;&#40;1.0,0&#41;;


	Why doesn&#8217;t the first version compile?

	I&#8217;m using the MinGW provided with Qt 4.8 (4.4.0)

	EDIT:
Completely forgot to post the error message:
error: no match for &#8216;operator&amp;lt;&amp;lt;&#8217; in &#8216;QMap&amp;lt;float, int&amp;gt;() &amp;lt;&amp;lt; QPair&amp;lt;float, int&amp;gt;(((const float&amp;amp;)((const float*)(&amp;amp;1.0e+0f))), ((const int&amp;amp;)((const int*)(&amp;amp;0))))&#8217;
candidates are: QMap&amp;lt;float, int&amp;gt;&amp;amp; operator&amp;lt;&amp;lt;(QMap&amp;lt;float, int&amp;gt;&amp;amp;, const QPair&amp;lt;float, int&amp;gt;&amp;amp;)]]></description>
            <guid isPermaLink="false">http://qt-project.org/forums/viewthread/25668</guid>
            <pubDate>Wed, 13 Mar 2013 14:02:21 GMT</pubDate>
        </item>
	
        <item>
            <title>[SOLVED]MinGW 4.7.2 casting problems</title>
            <link>http://qt-project.org/forums/viewthread/25478</link>
            <author>Jake007</author>
            <description><![CDATA[Hi!

	I&#8217;ve recently upgraded my compilers to MinGW 4.7.2.
It&#8217;s maybe a little harsh if I say that it doesn&#8217;t know how to calculate any more, but I feel almost like that.
I&#8217;m aware that when calculating in binary there are some offsets and also in casting.
But the following is unacceptable in my opinion.

	A few example of my outputs:
// Note pow returns double
cout &amp;lt;&amp;lt; &#40;int&#41;&#40;pow&#40;5, 3&#41;&#41; &amp;lt;&amp;lt; endl; // prints: 124, correct: 125
cout &amp;lt;&amp;lt; &#40;int&#41;&#40;pow&#40;10, 9&#41;&#41; &amp;lt;&amp;lt; endl; // prints: 999 999 999, correct: 1 000 000 000
cout &amp;lt;&amp;lt; &#40;int&#41;&#40;52.4*pow&#40;10, 1&#41;&#41; &amp;lt;&amp;lt; endl; // prints: 523, correct: 524. If I get rid of pow works ok


	I&#8217;ve done tests on W7 &#215;86 and x64 and on W8 &#215;64, on 3 different processors. All the same.
It&#8217;s also the same if I use pure C or if I use C++ static_cast&amp;lt;in&amp;gt; option.
MS C++ compiler works perfectly fine, as do older MinGW compilers.

	Is someone experiencing similar issues or maybe knows a solution?
I&#8217;m using default settings and flags.

	Regards,
Jake

	EDIT: Added missing closing parenthesis]]></description>
            <guid isPermaLink="false">http://qt-project.org/forums/viewthread/25478</guid>
            <pubDate>Wed, 06 Mar 2013 18:25:40 GMT</pubDate>
        </item>
	
        <item>
            <title>Opinion on this paradigm please</title>
            <link>http://qt-project.org/forums/viewthread/25430</link>
            <author>GrahamL</author>
            <description><![CDATA[Hi
I have just started working on  a new project and have come across this class and I dont really like the paradigm@@ used to implement the getters and setters.
Has anyone seen this method before?
Is it good?
is it bad?

	Header File:
class Tool
&#123;
public:
&amp;nbsp; &amp;nbsp; Tool&#40;&#41;;
&amp;nbsp; &amp;nbsp; virtual ~Tool&#40;&#41;;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; bool setName&#40;const std::string &amp;amp;name&#41;;
&amp;nbsp; &amp;nbsp; bool setMechanicalSerialNumber&#40;const std::string &amp;amp;serialNumber&#41;;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; bool getName&#40;std::string &amp;amp;name&#41; const;
&amp;nbsp; &amp;nbsp; bool getMechanicalSerialNumber&#40;std::string &amp;amp;serialNumber&#41; const;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; void clearName&#40;&#41;;
&amp;nbsp; &amp;nbsp; void clearMechanicalSerialNumber&#40;&#41;;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; virtual void clearAll&#40;&#41; = 0;
&amp;nbsp;
protected:
&amp;nbsp;
private:
&amp;nbsp; &amp;nbsp; std::string m_name;
&amp;nbsp; &amp;nbsp; bool m_nameSet;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; std::string m_mechanicalSerialNumber;
&amp;nbsp; &amp;nbsp; bool m_mechanicalSerialNumberSet;
&#125;;


	cpp file:
#include &amp;quot;Tool.h&amp;quot;
&amp;nbsp;
Tool::Tool&#40;&#41;
: m_name&#40;&amp;quot;&amp;quot;&#41;
, m_nameSet&#40;false&#41;
, m_mechanicalSerialNumber&#40;&amp;quot;&amp;quot;&#41;
, m_mechanicalSerialNumberSet&#40;false&#41;
&#123;
&#125;
&amp;nbsp;
&amp;nbsp;
Tool::~Tool&#40;&#41;
&#123;
&#125;
&amp;nbsp;
&amp;nbsp;
bool Tool::setName&#40;const std::string &amp;amp;name&#41;
&#123;
&amp;nbsp; &amp;nbsp; m_name = name;
&amp;nbsp; &amp;nbsp; m_nameSet = true;
&amp;nbsp; &amp;nbsp; return &#40;m_nameSet&#41;;
&#125;
bool Tool::setMechanicalSerialNumber&#40;const std::string &amp;amp;serialNumber&#41;
&#123;
&amp;nbsp; &amp;nbsp; m_mechanicalSerialNumber = serialNumber;
&amp;nbsp; &amp;nbsp; m_mechanicalSerialNumberSet = true;
&amp;nbsp; &amp;nbsp; return &#40;m_mechanicalSerialNumberSet&#41;;
&#125;
&amp;nbsp;
&amp;nbsp;
bool Tool::getName&#40;std::string &amp;amp;name&#41; const
&#123;
&amp;nbsp; &amp;nbsp; bool success = false;
&amp;nbsp; &amp;nbsp; if &#40;m_nameSet&#41;
&amp;nbsp; &amp;nbsp; &#123;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; name = m_name;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; success = true;
&amp;nbsp; &amp;nbsp; &#125;
&amp;nbsp; &amp;nbsp; return &#40;success&#41;;
&#125;
bool Tool::getMechanicalSerialNumber&#40;std::string &amp;amp;serialNumber&#41; const
&#123;
&amp;nbsp; &amp;nbsp; bool success = false;
&amp;nbsp; &amp;nbsp; if &#40;m_mechanicalSerialNumberSet&#41;
&amp;nbsp; &amp;nbsp; &#123;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; serialNumber = m_mechanicalSerialNumber;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; success = true;
&amp;nbsp; &amp;nbsp; &#125;
&amp;nbsp; &amp;nbsp; return &#40;success&#41;;
&#125;
&amp;nbsp;
&amp;nbsp;
void Tool::clearName&#40;&#41;
&#123;
&amp;nbsp; &amp;nbsp; m_name = &amp;quot;&amp;quot;;
&amp;nbsp; &amp;nbsp; m_nameSet = false;
&#125;
void Tool::clearMechanicalSerialNumber&#40;&#41;
&#123;
&amp;nbsp; &amp;nbsp; m_mechanicalSerialNumber = &amp;quot;&amp;quot;;
&amp;nbsp; &amp;nbsp; m_mechanicalSerialNumberSet = false;
&#125;
&amp;nbsp;
&amp;nbsp;
void Tool::clearAll&#40;&#41;
&#123;
&amp;nbsp; &amp;nbsp; clearName&#40;&#41;;
&amp;nbsp; &amp;nbsp; clearMechanicalSerialNumber&#40;&#41;;
&#125;]]></description>
            <guid isPermaLink="false">http://qt-project.org/forums/viewthread/25430</guid>
            <pubDate>Tue, 05 Mar 2013 13:09:31 GMT</pubDate>
        </item>
	

	</channel>
</rss>