<?xml version="1.0" encoding="utf-8"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>Qt Centre Forum - Newbie</title>
		<link>http://www.qtcentre.org/</link>
		<description>Newbie to Qt? Ask your questions here.</description>
		<language>en</language>
		<lastBuildDate>Mon, 20 May 2013 02:47:11 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>15</ttl>
		<image>
			<url>http://www.qtcentre.org/images/misc/rss.png</url>
			<title>Qt Centre Forum - Newbie</title>
			<link>http://www.qtcentre.org/</link>
		</image>
		<item>
			<title>How to make a such button? Need help quick</title>
			<link>http://www.qtcentre.org/threads/54624-How-to-make-a-such-button-Need-help-quick?goto=newpost</link>
			<pubDate>Sun, 19 May 2013 20:37:53 GMT</pubDate>
			<description>Hey everyone  
I have some kind of a project in my mind and i need some advice to be able to program it. So all i need to do create 1 basic button....</description>
			<content:encoded><![CDATA[<div>Hey everyone <br />
I have some kind of a project in my mind and i need some advice to be able to program it. So all i need to do create 1 basic button. When people click the button, the button will move horizontally back and forth (kinda like a wave) for some certain amount of time. I watched many tutorials but i couldnt find anything similar so if you guys have any ideas how to build something like this it would be so great if you would share some ideas with me. <br />
Anyway thank you and have a nice day :)</div>

]]></content:encoded>
			<category domain="http://www.qtcentre.org/forums/4-Newbie">Newbie</category>
			<dc:creator>bcdurak</dc:creator>
			<guid isPermaLink="true">http://www.qtcentre.org/threads/54624-How-to-make-a-such-button-Need-help-quick</guid>
		</item>
		<item>
			<title>Client/server application not woirking properly</title>
			<link>http://www.qtcentre.org/threads/54605-Client-server-application-not-woirking-properly?goto=newpost</link>
			<pubDate>Thu, 16 May 2013 16:03:09 GMT</pubDate>
			<description><![CDATA[Hi there, I've created this client/server app. It's basically a chat app. The client and server work perfectly fine on a localHost (i.e if I open up...]]></description>
			<content:encoded><![CDATA[<div>Hi there, I've created this client/server app. It's basically a chat app. The client and server work perfectly fine on a localHost (i.e if I open up my server and two clients on the same computer, I can send messages from one client to the server and the server relays the message to the other client). Okay, here is my problem, When I install my client program on another computer that is connected to the internet,and then run the server program on another computer, my client program does not connect to the server at all. Both the server computer and the client computer are connected to the internet. here is my code below.<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code"><pre class="qt" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339900;">#ifndef MYSOCKET_H</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339900;">#define MYSOCKET_H</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339900;">#include &lt;QTcpSocket&gt;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339900;">#include &lt;QThread&gt;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">class MySocket <span style="color: #000000;">:</span> <span style="color: #0000ff;">public</span> <a href="http://qt-project.org/doc/qt-4.8/qtcpsocket.html"><span style="">QTcpSocket</span></a></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="font-weight: bold;">Q_OBJECT</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">public</span><span style="color: #000000;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">explicit</span> MySocket<span style="color: #000000;">&#40;</span><span style="color: #0000ff;">int</span> descriptor<span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">void</span> connectThread<span style="color: #000000;">&#40;</span><a href="http://qt-project.org/doc/qt-4.8/qthread.html"><span style="">QThread</span></a> <span style="color: #000000;">&amp;</span>thread<span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">signals</span><span style="color: #000000;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">void</span> sendData<span style="color: #000000;">&#40;</span><a href="http://qt-project.org/doc/qt-4.8/qbytearray.html"><span style="">QByteArray</span></a><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">slots</span><span style="color: #000000;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">void</span> setupSocket<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">void</span> readSocket<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">void</span> writeSocket<span style="color: #000000;">&#40;</span><a href="http://qt-project.org/doc/qt-4.8/qbytearray.html"><span style="">QByteArray</span></a><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">void</span> disconnected<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">void</span> connecte_d<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">private</span><span style="color: #000000;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">int</span> socketDescriptor;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#125;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339900;">#endif // MYSOCKET_H</span></div></li></ol></pre></code><hr />
</div><div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code"><pre class="qt" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339900;">#include &quot;mysocket.h&quot;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">MySocket<span style="color: #000000;">::</span><span style="color: #009900;">MySocket</span><span style="color: #000000;">&#40;</span><span style="color: #0000ff;">int</span> descriptor<span style="color: #000000;">&#41;</span> <span style="color: #000000;">:</span>socketDescriptor<span style="color: #000000;">&#40;</span>descriptor<span style="color: #000000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    this<span style="color: #000000;">-</span>&gt;setSocketDescriptor<span style="color: #000000;">&#40;</span>descriptor<span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">void</span> MySocket<span style="color: #000000;">::</span><span style="color: #009900;">connectThread</span><span style="color: #000000;">&#40;</span><a href="http://qt-project.org/doc/qt-4.8/qthread.html"><span style="">QThread</span></a> <span style="color: #000000;">&amp;</span>thread<span style="color: #000000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">connect</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&amp;</span>thread, <span style="color: #0000ff;">SIGNAL</span><span style="color: #000000;">&#40;</span>started<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>, <span style="color: #009900;">this</span>, <span style="color: #0000ff;">SLOT</span><span style="color: #000000;">&#40;</span>setupSocket<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">void</span> MySocket<span style="color: #000000;">::</span><span style="color: #009900;">setupSocket</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">connect</span><span style="color: #000000;">&#40;</span><span style="color: #009900;">this</span>, <span style="color: #0000ff;">SIGNAL</span><span style="color: #000000;">&#40;</span>readyRead<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>, <span style="color: #009900;">this</span>, <span style="color: #0000ff;">SLOT</span><span style="color: #000000;">&#40;</span>readSocket<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">connect</span><span style="color: #000000;">&#40;</span><span style="color: #009900;">this</span>, <span style="color: #0000ff;">SIGNAL</span><span style="color: #000000;">&#40;</span>connected<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>, <span style="color: #009900;">this</span>, <span style="color: #0000ff;">SLOT</span><span style="color: #000000;">&#40;</span>connecte_d<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">connect</span><span style="color: #000000;">&#40;</span><span style="color: #009900;">this</span>, <span style="color: #0000ff;">SIGNAL</span><span style="color: #000000;">&#40;</span>disconnected<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>, <span style="color: #009900;">this</span>, <span style="color: #0000ff;">SLOT</span><span style="color: #000000;">&#40;</span>disconnected<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">void</span> MySocket<span style="color: #000000;">::</span><span style="color: #009900;">readSocket</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <a href="http://qt-project.org/doc/qt-4.8/qbytearray.html"><span style="">QByteArray</span></a> buffer;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    buffer.<span style="color: #009900;">clear</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    buffer.<span style="color: #009900;">append</span><span style="color: #000000;">&#40;</span>this<span style="color: #000000;">-</span>&gt;readAll<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    qDebug<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> &lt;&lt; buffer;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    emit sendData<span style="color: #000000;">&#40;</span>buffer<span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">void</span> MySocket<span style="color: #000000;">::</span><span style="color: #009900;">writeSocket</span><span style="color: #000000;">&#40;</span><a href="http://qt-project.org/doc/qt-4.8/qbytearray.html"><span style="">QByteArray</span></a> data<span style="color: #000000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    this<span style="color: #000000;">-</span>&gt;write<span style="color: #000000;">&#40;</span>data<span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">void</span> MySocket<span style="color: #000000;">::</span><span style="color: #009900;">connecte_d</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    qDebug<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> &lt;&lt; socketDescriptor &lt;&lt; <span style="color: #666666;">&quot; connected&quot;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">void</span> MySocket<span style="color: #000000;">::</span><span style="color: #009900;">disconnected</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    qDebug<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> &lt;&lt; socketDescriptor &lt;&lt; <span style="color: #666666;">&quot; Disconnected&quot;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#125;</span></div></li></ol></pre></code><hr />
</div><div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code"><pre class="qt" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339900;">#ifndef MSEVER_H</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339900;">#define MSEVER_H</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339900;">#include &lt;QTcpServer&gt;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339900;">#include &lt;QDebug&gt;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339900;">#include &lt;QThreadPool&gt;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339900;">#include &lt;QList&gt;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339900;">#include &lt;QString&gt;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339900;">#include &lt;QThread&gt;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339900;">#include &lt;QTcpSocket&gt;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339900;">#include &lt;QHash&gt;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339900;">#include &quot;mysocket.h&quot;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">class MServer <span style="color: #000000;">:</span> <span style="color: #0000ff;">public</span> <a href="http://qt-project.org/doc/qt-4.8/qtcpserver.html"><span style="">QTcpServer</span></a></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="font-weight: bold;">Q_OBJECT</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">public</span><span style="color: #000000;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">explicit</span> MServer<span style="color: #000000;">&#40;</span><a href="http://qt-project.org/doc/qt-4.8/qobject.html"><span style="">QObject</span></a> <span style="color: #000000;">*</span>parent <span style="color: #000000;">=</span> <span style="color: #0000dd;">0</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    ~MServer<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">signals</span><span style="color: #000000;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">void</span> sendD<span style="color: #000000;">&#40;</span><a href="http://qt-project.org/doc/qt-4.8/qbytearray.html"><span style="">QByteArray</span></a><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">slots</span><span style="color: #000000;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #0000ff;">void</span> dataRec<span style="color: #000000;">&#40;</span><a href="http://qt-project.org/doc/qt-4.8/qbytearray.html"><span style="">QByteArray</span></a><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">protected</span><span style="color: #000000;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">void</span> incomingConnection<span style="color: #000000;">&#40;</span><span style="color: #0000ff;">int</span> handle<span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">private</span><span style="color: #000000;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    MySocket<span style="color: #000000;">*</span> mSocket;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    QList&lt;QThread<span style="color: #000000;">*</span>&gt;<span style="color: #000000;">*</span> myThreads;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    QThreadPool<span style="color: #000000;">*</span> threadPool;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">int</span> counter;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#125;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339900;">#endif // MSEVER_H</span></div></li></ol></pre></code><hr />
</div><div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code"><pre class="qt" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339900;">#include &quot;msever.h&quot;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">int</span> MServer<span style="color: #000000;">::</span><span style="color: #009900;">counter</span> <span style="color: #000000;">=</span> <span style="color: #0000dd;">0</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">MServer<span style="color: #000000;">::</span><span style="color: #009900;">MServer</span><span style="color: #000000;">&#40;</span><a href="http://qt-project.org/doc/qt-4.8/qobject.html"><span style="">QObject</span></a> <span style="color: #000000;">*</span>parent<span style="color: #000000;">&#41;</span> <span style="color: #000000;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <a href="http://qt-project.org/doc/qt-4.8/qtcpserver.html"><span style="">QTcpServer</span></a><span style="color: #000000;">&#40;</span>parent<span style="color: #000000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">if</span><span style="color: #000000;">&#40;</span>this<span style="color: #000000;">-</span>&gt;listen<span style="color: #000000;">&#40;</span><a href="http://qt-project.org/doc/qt-4.8/qhostaddress.html"><span style="">QHostAddress</span></a><span style="color: #000000;">::</span><span style="color: #009900;">Any</span>, <span style="color: #0000dd;">1234</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        qDebug<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> &lt;&lt; <span style="color: #666666;">&quot;Listening...&quot;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">else</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        qDebug<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> &lt;&lt; <span style="color: #666666;">&quot;Server failed to start&quot;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    myThreads <span style="color: #000000;">=</span> <span style="color: #009900;">new</span> QList&lt;QThread<span style="color: #000000;">*</span>&gt;<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">for</span><span style="color: #000000;">&#40;</span><span style="color: #0000ff;">int</span> i <span style="color: #000000;">=</span> <span style="color: #0000dd;">0</span>; i &lt;<span style="color: #000000;">=</span> <span style="color: #0000dd;">5</span>; i<span style="color: #000000;">++</span><span style="color: #000000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <a href="http://qt-project.org/doc/qt-4.8/qthread.html"><span style="">QThread</span></a><span style="color: #000000;">*</span> thread <span style="color: #000000;">=</span> <span style="color: #009900;">new</span> <a href="http://qt-project.org/doc/qt-4.8/qthread.html"><span style="">QThread</span></a><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        myThreads<span style="color: #000000;">-</span>&gt;append<span style="color: #000000;">&#40;</span>thread<span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000000;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">MServer<span style="color: #000000;">::</span>~MServer<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">for</span><span style="color: #000000;">&#40;</span><span style="color: #0000ff;">int</span> i <span style="color: #000000;">=</span> <span style="color: #0000dd;">0</span>; i &lt;<span style="color: #000000;">=</span> <span style="color: #0000dd;">5</span>; i<span style="color: #000000;">++</span><span style="color: #000000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        myThreads<span style="color: #000000;">-</span>&gt;at<span style="color: #000000;">&#40;</span>i<span style="color: #000000;">&#41;</span><span style="color: #000000;">-</span>&gt;deleteLater<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">void</span> MServer<span style="color: #000000;">::</span><span style="color: #009900;">incomingConnection</span><span style="color: #000000;">&#40;</span><span style="color: #0000ff;">int</span> handle<span style="color: #000000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    qDebug<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> &lt;&lt; handle &lt;&lt; <span style="color: #666666;">&quot; Connected&quot;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    mSocket <span style="color: #000000;">=</span> <span style="color: #009900;">new</span> MySocket<span style="color: #000000;">&#40;</span>handle<span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    mSocket<span style="color: #000000;">-</span>&gt;writeSocket<span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;Welcome to Ayanda's Server&quot;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">connect</span><span style="color: #000000;">&#40;</span>mSocket, <span style="color: #0000ff;">SIGNAL</span><span style="color: #000000;">&#40;</span>sendData<span style="color: #000000;">&#40;</span><a href="http://qt-project.org/doc/qt-4.8/qbytearray.html"><span style="">QByteArray</span></a><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>, <span style="color: #009900;">this</span>, <span style="color: #0000ff;">SLOT</span><span style="color: #000000;">&#40;</span>dataRec<span style="color: #000000;">&#40;</span><a href="http://qt-project.org/doc/qt-4.8/qbytearray.html"><span style="">QByteArray</span></a><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">connect</span><span style="color: #000000;">&#40;</span><span style="color: #009900;">this</span>, <span style="color: #0000ff;">SIGNAL</span><span style="color: #000000;">&#40;</span>sendD<span style="color: #000000;">&#40;</span><a href="http://qt-project.org/doc/qt-4.8/qbytearray.html"><span style="">QByteArray</span></a><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>, mSocket, <span style="color: #0000ff;">SLOT</span><span style="color: #000000;">&#40;</span>writeSocket<span style="color: #000000;">&#40;</span><a href="http://qt-project.org/doc/qt-4.8/qbytearray.html"><span style="">QByteArray</span></a><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    mSocket<span style="color: #000000;">-</span>&gt;connectThread<span style="color: #000000;">&#40;</span><span style="color: #000000;">*</span><span style="color: #000000;">&#40;</span>myThreads<span style="color: #000000;">-</span>&gt;at<span style="color: #000000;">&#40;</span>counter<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    mSocket<span style="color: #000000;">-</span>&gt;moveToThread<span style="color: #000000;">&#40;</span>myThreads<span style="color: #000000;">-</span>&gt;at<span style="color: #000000;">&#40;</span>counter<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    myThreads<span style="color: #000000;">-</span>&gt;at<span style="color: #000000;">&#40;</span>counter<span style="color: #000000;">&#41;</span><span style="color: #000000;">-</span>&gt;start<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    counter<span style="color: #000000;">++</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">void</span> MServer<span style="color: #000000;">::</span><span style="color: #009900;">dataRec</span><span style="color: #000000;">&#40;</span><a href="http://qt-project.org/doc/qt-4.8/qbytearray.html"><span style="">QByteArray</span></a> data<span style="color: #000000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    emit sendD<span style="color: #000000;">&#40;</span>data<span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#125;</span></div></li></ol></pre></code><hr />
</div><div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code"><pre class="qt" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339900;">#include &lt;QtCore/QCoreApplication&gt;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339900;">#include &quot;msever.h&quot;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">int</span> main<span style="color: #000000;">&#40;</span><span style="color: #0000ff;">int</span> argc, <span style="color: #0000ff;">char</span> <span style="color: #000000;">*</span>argv<span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <a href="http://qt-project.org/doc/qt-4.8/qcoreapplication.html"><span style="">QCoreApplication</span></a> a<span style="color: #000000;">&#40;</span>argc, argv<span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    MServer Server;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">return</span> a.<span style="color: #009900;">exec</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#125;</span></div></li></ol></pre></code><hr />
</div>And the following code is for my client program.<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code"><pre class="qt" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339900;">#ifndef ASIXOXE_UI_H</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339900;">#define ASIXOXE_UI_H</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339900;">#include &lt;QMainWindow&gt;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339900;">#include &lt;QUdpSocket&gt;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339900;">#include &lt;QTcpSocket&gt;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339900;">#include &lt;QThread&gt;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339900;">#include &lt;QInputDialog&gt;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339900;">#include &lt;QString&gt;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">namespace</span> Ui <span style="color: #000000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    class AsiXoxe_ui;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">class AsiXoxe_ui <span style="color: #000000;">:</span> <span style="color: #0000ff;">public</span> <a href="http://qt-project.org/doc/qt-4.8/qmainwindow.html"><span style="">QMainWindow</span></a></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="font-weight: bold;">Q_OBJECT</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">public</span><span style="color: #000000;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">explicit</span> AsiXoxe_ui<span style="color: #000000;">&#40;</span><a href="http://qt-project.org/doc/qt-4.8/qwidget.html"><span style="">QWidget</span></a> <span style="color: #000000;">*</span>parent <span style="color: #000000;">=</span> <span style="color: #0000dd;">0</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    ~AsiXoxe_ui<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">signals</span><span style="color: #000000;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">void</span> sendMsg<span style="color: #000000;">&#40;</span><a href="http://qt-project.org/doc/qt-4.8/qstring.html"><span style="">QString</span></a><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">slots</span><span style="color: #000000;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">void</span> displayMsg<span style="color: #000000;">&#40;</span><a href="http://qt-project.org/doc/qt-4.8/qbytearray.html"><span style="">QByteArray</span></a><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">void</span> readMsg<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">void</span> sendMsg<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">void</span> connectedMsg<span style="color: #000000;">&#40;</span><a href="http://qt-project.org/doc/qt-4.8/qstring.html"><span style="">QString</span></a><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">void</span> connectedMsg_2<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">private</span><span style="color: #000000;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    Ui<span style="color: #000000;">::</span><span style="color: #009900;">AsiXoxe_ui</span> <span style="color: #000000;">*</span>ui;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <a href="http://qt-project.org/doc/qt-4.8/qtcpsocket.html"><span style="">QTcpSocket</span></a><span style="color: #000000;">*</span> socket;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <a href="http://qt-project.org/doc/qt-4.8/qthread.html"><span style="">QThread</span></a><span style="color: #000000;">*</span> thread;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <a href="http://qt-project.org/doc/qt-4.8/qstring.html"><span style="">QString</span></a> nickName;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">private</span> <span style="color: #0000ff;">slots</span><span style="color: #000000;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">void</span> on_pushButton_2_clicked<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">void</span> on_lineEdit_returnPressed<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">void</span> on_pushButton_clicked<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#125;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339900;">#endif // ASIXOXE_UI_H</span></div></li></ol></pre></code><hr />
</div><div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code"><pre class="qt" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339900;">#include &quot;asixoxe_ui.h&quot;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339900;">#include &quot;ui_asixoxe_ui.h&quot;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">AsiXoxe_ui<span style="color: #000000;">::</span><span style="color: #009900;">AsiXoxe_ui</span><span style="color: #000000;">&#40;</span><a href="http://qt-project.org/doc/qt-4.8/qwidget.html"><span style="">QWidget</span></a> <span style="color: #000000;">*</span>parent<span style="color: #000000;">&#41;</span> <span style="color: #000000;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <a href="http://qt-project.org/doc/qt-4.8/qmainwindow.html"><span style="">QMainWindow</span></a><span style="color: #000000;">&#40;</span>parent<span style="color: #000000;">&#41;</span>,</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    ui<span style="color: #000000;">&#40;</span><span style="color: #009900;">new</span> Ui<span style="color: #000000;">::</span><span style="color: #009900;">AsiXoxe_ui</span><span style="color: #000000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    ui<span style="color: #000000;">-</span>&gt;setupUi<span style="color: #000000;">&#40;</span><span style="color: #009900;">this</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    socket <span style="color: #000000;">=</span> <span style="color: #009900;">new</span> <a href="http://qt-project.org/doc/qt-4.8/qtcpsocket.html"><span style="">QTcpSocket</span></a><span style="color: #000000;">&#40;</span><span style="color: #009900;">this</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <a href="http://qt-project.org/doc/qt-4.8/qhostaddress.html"><span style="">QHostAddress</span></a> hAddr;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    hAddr.<span style="color: #009900;">setAddress</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;192.168.43.78&quot;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    socket<span style="color: #000000;">-</span>&gt;connectToHost<span style="color: #000000;">&#40;</span>hAddr, <span style="color: #0000dd;">1234</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    socket<span style="color: #000000;">-</span>&gt;waitForConnected<span style="color: #000000;">&#40;</span><span style="color: #0000dd;">30000</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">connect</span><span style="color: #000000;">&#40;</span>socket, <span style="color: #0000ff;">SIGNAL</span><span style="color: #000000;">&#40;</span>readyRead<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>, <span style="color: #009900;">this</span>, <span style="color: #0000ff;">SLOT</span><span style="color: #000000;">&#40;</span>readMsg<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">connect</span><span style="color: #000000;">&#40;</span>socket, <span style="color: #0000ff;">SIGNAL</span><span style="color: #000000;">&#40;</span>connected<span style="color: #000000;">&#40;</span><a href="http://qt-project.org/doc/qt-4.8/qstring.html"><span style="">QString</span></a><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>,<span style="color: #009900;">this</span>, <span style="color: #0000ff;">SLOT</span><span style="color: #000000;">&#40;</span>connectedMsg<span style="color: #000000;">&#40;</span><a href="http://qt-project.org/doc/qt-4.8/qstring.html"><span style="">QString</span></a><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">AsiXoxe_ui<span style="color: #000000;">::</span>~AsiXoxe_ui<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #009900;">delete</span> ui;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    thread<span style="color: #000000;">-</span>&gt;deleteLater<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">void</span> AsiXoxe_ui<span style="color: #000000;">::</span><span style="color: #009900;">displayMsg</span><span style="color: #000000;">&#40;</span><a href="http://qt-project.org/doc/qt-4.8/qbytearray.html"><span style="">QByteArray</span></a> sentMsg<span style="color: #000000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <a href="http://qt-project.org/doc/qt-4.8/qstring.html"><span style="">QString</span></a> msg <span style="color: #000000;">=</span> <a href="http://qt-project.org/doc/qt-4.8/qstring.html"><span style="">QString</span></a><span style="color: #000000;">&#40;</span>sentMsg.<span style="color: #009900;">data</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    ui<span style="color: #000000;">-</span>&gt;textBrowser<span style="color: #000000;">-</span>&gt;append<span style="color: #000000;">&#40;</span>msg<span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">void</span> AsiXoxe_ui<span style="color: #000000;">::</span><span style="color: #009900;">on_pushButton_clicked</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    sendMsg<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">void</span> AsiXoxe_ui<span style="color: #000000;">::</span><span style="color: #009900;">sendMsg</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <a href="http://qt-project.org/doc/qt-4.8/qbytearray.html"><span style="">QByteArray</span></a> buffer;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    buffer.<span style="color: #009900;">append</span><span style="color: #000000;">&#40;</span>nickName<span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    buffer.<span style="color: #009900;">append</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;: &quot;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    buffer.<span style="color: #009900;">append</span><span style="color: #000000;">&#40;</span>ui<span style="color: #000000;">-</span>&gt;lineEdit<span style="color: #000000;">-</span>&gt;text<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    socket<span style="color: #000000;">-</span>&gt;write<span style="color: #000000;">&#40;</span>buffer<span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    ui<span style="color: #000000;">-</span>&gt;lineEdit<span style="color: #000000;">-</span>&gt;clear<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">void</span> AsiXoxe_ui<span style="color: #000000;">::</span><span style="color: #009900;">readMsg</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    thread <span style="color: #000000;">=</span> <span style="color: #009900;">new</span> <a href="http://qt-project.org/doc/qt-4.8/qthread.html"><span style="">QThread</span></a><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    ui<span style="color: #000000;">-</span>&gt;textBrowser<span style="color: #000000;">-</span>&gt;append<span style="color: #000000;">&#40;</span>socket<span style="color: #000000;">-</span>&gt;readAll<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    socket<span style="color: #000000;">-</span>&gt;flush<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    socket<span style="color: #000000;">-</span>&gt;waitForBytesWritten<span style="color: #000000;">&#40;</span><span style="color: #0000dd;">3000</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    socket<span style="color: #000000;">-</span>&gt;moveToThread<span style="color: #000000;">&#40;</span>thread<span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    thread<span style="color: #000000;">-</span>&gt;start<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">void</span> AsiXoxe_ui<span style="color: #000000;">::</span><span style="color: #009900;">on_lineEdit_returnPressed</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    sendMsg<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">void</span> AsiXoxe_ui<span style="color: #000000;">::</span><span style="color: #009900;">connectedMsg</span><span style="color: #000000;">&#40;</span><a href="http://qt-project.org/doc/qt-4.8/qstring.html"><span style="">QString</span></a> c<span style="color: #000000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">void</span> AsiXoxe_ui<span style="color: #000000;">::</span><span style="color: #009900;">connectedMsg_2</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">void</span> AsiXoxe_ui<span style="color: #000000;">::</span><span style="color: #009900;">on_pushButton_2_clicked</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    nickName <span style="color: #000000;">=</span> <a href="http://qt-project.org/doc/qt-4.8/qinputdialog.html"><span style="">QInputDialog</span></a><span style="color: #000000;">::</span><span style="color: #009900;">getText</span><span style="color: #000000;">&#40;</span><span style="color: #009900;">this</span>, <span style="color: #666666;">&quot;Name input,&quot;</span> <span style="color: #666666;">&quot;Name or Nickname&quot;</span>, <span style="color: #0000dd;">0</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#125;</span></div></li></ol></pre></code><hr />
</div><div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code"><pre class="qt" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339900;">#include &lt;QtGui/QApplication&gt;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339900;">#include &quot;asixoxe_ui.h&quot;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">int</span> main<span style="color: #000000;">&#40;</span><span style="color: #0000ff;">int</span> argc, <span style="color: #0000ff;">char</span> <span style="color: #000000;">*</span>argv<span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <a href="http://qt-project.org/doc/qt-4.8/qapplication.html"><span style="">QApplication</span></a> a<span style="color: #000000;">&#40;</span>argc, argv<span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    AsiXoxe_ui w;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    w.<span style="color: #009900;">show</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">return</span> a.<span style="color: #009900;">exec</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#125;</span></div></li></ol></pre></code><hr />
</div></div>

]]></content:encoded>
			<category domain="http://www.qtcentre.org/forums/4-Newbie">Newbie</category>
			<dc:creator>ayanda83</dc:creator>
			<guid isPermaLink="true">http://www.qtcentre.org/threads/54605-Client-server-application-not-woirking-properly</guid>
		</item>
		<item>
			<title>QT QTimer</title>
			<link>http://www.qtcentre.org/threads/54601-QT-QTimer?goto=newpost</link>
			<pubDate>Thu, 16 May 2013 06:43:41 GMT</pubDate>
			<description>How to pause and resume QTimer?</description>
			<content:encoded><![CDATA[<div>How to pause and resume QTimer?</div>

]]></content:encoded>
			<category domain="http://www.qtcentre.org/forums/4-Newbie">Newbie</category>
			<dc:creator>sonulohani</dc:creator>
			<guid isPermaLink="true">http://www.qtcentre.org/threads/54601-QT-QTimer</guid>
		</item>
		<item>
			<title>How to create this button</title>
			<link>http://www.qtcentre.org/threads/54600-How-to-create-this-button?goto=newpost</link>
			<pubDate>Thu, 16 May 2013 05:27:41 GMT</pubDate>
			<description>Attachment 9040 (http://www.qtcentre.org/attachment.php?attachmentid=9040) 
How to create this type of button after clicking which shows the custom...</description>
			<content:encoded><![CDATA[<div><a href="http://www.qtcentre.org/attachment.php?attachmentid=9040&amp;d=1368681975"  title="Name:  Untitled.png
Views: 24
Size:  3.0 KB">Untitled.png</a><br />
How to create this type of button after clicking which shows the custom menu like this:-<br />
<a href="http://www.qtcentre.org/attachment.php?attachmentid=9041&amp;d=1368682052"  title="Name:  Untitled1.png
Views: 8
Size:  3.5 KB">Untitled1.png</a></div>

]]></content:encoded>
			<category domain="http://www.qtcentre.org/forums/4-Newbie">Newbie</category>
			<dc:creator>sonulohani</dc:creator>
			<guid isPermaLink="true">http://www.qtcentre.org/threads/54600-How-to-create-this-button</guid>
		</item>
		<item>
			<title>How do I read shared memory data written by Qt using boost ?</title>
			<link>http://www.qtcentre.org/threads/54587-How-do-I-read-shared-memory-data-written-by-Qt-using-boost?goto=newpost</link>
			<pubDate>Wed, 15 May 2013 05:10:57 GMT</pubDate>
			<description><![CDATA[I'm writing a string into QSharedMemory and after writing, I need to read it from boost program. I tried this, but didn't work. 
I read the data in...]]></description>
			<content:encoded><![CDATA[<div>I'm writing a string into QSharedMemory and after writing, I need to read it from boost program. I tried this, but didn't work.<br />
I read the data in shared memory from the same Qt program, and I see the string.<br />
<br />
Below is Qt program, from which I'm writing into shared memory with key <b><i>ShrdMem</i></b><div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code"><pre class="qt" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff0000;">// Slot, which is invoked on click of button.</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">void</span> CDialog<span style="color: #000000;">::</span><span style="color: #009900;">loadString</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">if</span><span style="color: #000000;">&#40;</span>sharedMemory.<span style="color: #009900;">isAttached</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #0000ff;">if</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">!</span>sharedMemory.<span style="color: #009900;">detach</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #000000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            lbl<span style="color: #000000;">-</span>&gt;setText<span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;Unable to detach from Shared Memory&quot;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #0000ff;">return</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #000000;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000000;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">char</span> sString<span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> <span style="color: #000000;">=</span> <span style="color: #666666;">&quot;my string&quot;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <a href="http://qt-project.org/doc/qt-4.8/qbuffer.html"><span style="">QBuffer</span></a> buffer;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    buffer.<span style="color: #009900;">open</span><span style="color: #000000;">&#40;</span><a href="http://qt-project.org/doc/qt-4.8/qbuffer.html"><span style="">QBuffer</span></a><span style="color: #000000;">::</span><span style="color: #009900;">ReadWrite</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <a href="http://qt-project.org/doc/qt-4.8/qdatastream.html"><span style="">QDataStream</span></a> out<span style="color: #000000;">&#40;</span><span style="color: #000000;">&amp;</span>buffer<span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    out &lt;&lt; sString;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">int</span> size <span style="color: #000000;">=</span> buffer.<span style="color: #009900;">size</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    qDebug<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> &lt;&lt; size;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">if</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">!</span>sharedMemory.<span style="color: #009900;">create</span><span style="color: #000000;">&#40;</span>size<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        lbl<span style="color: #000000;">-</span>&gt;setText<span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;Unable to create shared memory segment&quot;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        qDebug<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> &lt;&lt; lbl<span style="color: #000000;">-</span>&gt;text<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000000;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    sharedMemory.<span style="color: #009900;">lock</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">char</span> <span style="color: #000000;">*</span>to <span style="color: #000000;">=</span> <span style="color: #000000;">&#40;</span><span style="color: #0000ff;">char</span> <span style="color: #000000;">*</span><span style="color: #000000;">&#41;</span> sharedMemory.<span style="color: #009900;">data</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">const</span> <span style="color: #0000ff;">char</span> <span style="color: #000000;">*</span>from <span style="color: #000000;">=</span> buffer.<span style="color: #009900;">data</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #009900;">memcpy</span><span style="color: #000000;">&#40;</span>to, from, qMin<span style="color: #000000;">&#40;</span>sharedMemory.<span style="color: #009900;">size</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>, size<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    sharedMemory.<span style="color: #009900;">unlock</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">char</span> <span style="color: #000000;">*</span> str;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <a href="http://qt-project.org/doc/qt-4.8/qdatastream.html"><span style="">QDataStream</span></a> in<span style="color: #000000;">&#40;</span><span style="color: #000000;">&amp;</span>buffer<span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    sharedMemory.<span style="color: #009900;">lock</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    buffer.<span style="color: #009900;">setData</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #0000ff;">char</span> <span style="color: #000000;">*</span><span style="color: #000000;">&#41;</span>sharedMemory.<span style="color: #009900;">constData</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>, sharedMemory.<span style="color: #009900;">size</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    buffer.<span style="color: #009900;">open</span><span style="color: #000000;">&#40;</span><a href="http://qt-project.org/doc/qt-4.8/qbuffer.html"><span style="">QBuffer</span></a><span style="color: #000000;">::</span><span style="color: #009900;">ReadOnly</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    in &gt;&gt; str;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    sharedMemory.<span style="color: #009900;">unlock</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    qDebug<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> &lt;&lt; str;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#125;</span></div></li></ol></pre></code><hr />
</div>I'm trying to read the <b><i>ShrdMem</i></b> using Boost as shown below.<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code"><pre class="qt" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff0000;">//NQShrdMem.cpp</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">int</span> main<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  boost<span style="color: #000000;">::</span><span style="color: #009900;">interprocess</span><span style="color: #000000;">::</span><span style="color: #009900;">shared_memory_object</span> shdmem<span style="color: #000000;">&#40;</span>boost<span style="color: #000000;">::</span><span style="color: #009900;">interprocess</span><span style="color: #000000;">::</span><span style="color: #009900;">open_only</span>, <span style="color: #666666;">&quot;ShrdMem&quot;</span>, boost<span style="color: #000000;">::</span><span style="color: #009900;">interprocess</span><span style="color: #000000;">::</span><span style="color: #009900;">read_only</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  boost<span style="color: #000000;">::</span><span style="color: #009900;">interprocess</span><span style="color: #000000;">::</span><span style="color: #009900;">offset_t</span> size; </div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">if</span> <span style="color: #000000;">&#40;</span>shdmem.<span style="color: #009900;">get_size</span><span style="color: #000000;">&#40;</span>size<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> </div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    std<span style="color: #000000;">::</span><span style="color: #009900;">cout</span> &lt;&lt; <span style="color: #666666;">&quot;Shared Mem Size: &quot;</span> &lt;&lt; size &lt;&lt; std<span style="color: #000000;">::</span><span style="color: #009900;">endl</span>; </div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  boost<span style="color: #000000;">::</span><span style="color: #009900;">interprocess</span><span style="color: #000000;">::</span><span style="color: #009900;">mapped_region</span> region2<span style="color: #000000;">&#40;</span>shdmem, boost<span style="color: #000000;">::</span><span style="color: #009900;">interprocess</span><span style="color: #000000;">::</span><span style="color: #009900;">read_only</span><span style="color: #000000;">&#41;</span>; </div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">char</span> <span style="color: #000000;">*</span>i2 <span style="color: #000000;">=</span> static_cast&lt;char <span style="color: #000000;">*</span>&gt;<span style="color: #000000;">&#40;</span>region2.<span style="color: #009900;">get_address</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>; </div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  std<span style="color: #000000;">::</span><span style="color: #009900;">cout</span> &lt;&lt; i2 &lt;&lt; std<span style="color: #000000;">::</span><span style="color: #009900;">endl</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">return</span> <span style="color: #0000dd;">0</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#125;</span></div></li></ol></pre></code><hr />
</div><br />
I'm compiling the Boost program in cygwin, using g++:<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code"><pre class="qt" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">g<span style="color: #000000;">++</span> <span style="color: #000000;">-</span>I <span style="color: #000000;">/</span>cygdrive<span style="color: #000000;">/</span>c<span style="color: #000000;">/</span>boost<span style="color: #000000;">/</span>boost_1_53_0<span style="color: #000000;">/</span> NQShrdMem.<span style="color: #009900;">cpp</span> <span style="color: #000000;">-</span>o NQShrdMem <span style="color: #000000;">/</span>cygdrive<span style="color: #000000;">/</span>c<span style="color: #000000;">/</span>boost_lib<span style="color: #000000;">/</span>boost<span style="color: #000000;">/</span>bin.<span style="color: #009900;">v2</span><span style="color: #000000;">/</span>libs<span style="color: #000000;">/</span>date_time<span style="color: #000000;">/</span>build<span style="color: #000000;">/</span>gcc<span style="color: #000000;">-</span>mingw<span style="color: #000000;">-</span>4.7.2<span style="color: #000000;">/</span>release<span style="color: #000000;">/</span>link<span style="color: #000000;">-</span><span style="color: #0000ff;">static</span><span style="color: #000000;">/</span>threading<span style="color: #000000;">-</span>multi<span style="color: #000000;">/</span>libboost_date_time<span style="color: #000000;">-</span>mgw47<span style="color: #000000;">-</span>mt<span style="color: #000000;">-</span><span style="color: #0000dd;">1</span>_53.<span style="color: #009900;">a</span></div></li></ol></pre></code><hr />
</div><br />
Kindly help me. Thank you.</div>

]]></content:encoded>
			<category domain="http://www.qtcentre.org/forums/4-Newbie">Newbie</category>
			<dc:creator>rawfool</dc:creator>
			<guid isPermaLink="true">http://www.qtcentre.org/threads/54587-How-do-I-read-shared-memory-data-written-by-Qt-using-boost</guid>
		</item>
		<item>
			<title>Switching between two windows</title>
			<link>http://www.qtcentre.org/threads/54586-Switching-between-two-windows?goto=newpost</link>
			<pubDate>Wed, 15 May 2013 04:40:29 GMT</pubDate>
			<description>I am very much new to Qt and I have a simple doubt on switching between the windows. 
 
I have a main window and I am creating a secondary window...</description>
			<content:encoded><![CDATA[<div>I am very much new to Qt and I have a simple doubt on switching between the windows.<br />
<br />
I have a main window and I am creating a secondary window using a different class. I am hiding the primary window using hide( ) function and only the second window belonging to different class is visible. When the user presses the close button I have to show back the first window. My code looks something like this.<br />
<br />
main.cpp<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code"><pre class="qt" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339900;">#include &quot;FirstWindow.h&quot;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">int</span> main<span style="color: #000000;">&#40;</span><span style="color: #0000ff;">int</span> argc, <span style="color: #0000ff;">char</span> <span style="color: #000000;">*</span>argv<span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">	<a href="http://qt-project.org/doc/qt-4.8/qapplication.html"><span style="">QApplication</span></a> a<span style="color: #000000;">&#40;</span>argc, argv<span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">	FirstWindow w;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">	w.<span style="color: #009900;">setAttribute</span><span style="color: #000000;">&#40;</span> Qt <span style="color: #000000;">::</span> <span style="color: #009900;">WA_QuitOnClose</span> <span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">	w.<span style="color: #009900;">show</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">	<span style="color: #0000ff;">return</span> a.<span style="color: #009900;">exec</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#125;</span></div></li></ol></pre></code><hr />
</div><br />
Important lines belonging to FirstWindow.h.<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code"><pre class="qt" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339900;">#include &quot;SecondWindow.h&quot;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">class FirstWindow <span style="color: #000000;">:</span> <span style="color: #0000ff;">public</span> <a href="http://qt-project.org/doc/qt-4.8/qdialog.html"><span style="">QDialog</span></a></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">	<span style="font-weight: bold;">Q_OBJECT</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">             <span style="color: #0000ff;">private</span><span style="color: #000000;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                    SecondWindow <span style="color: #000000;">*</span> window2;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">	<span style="color: #0000ff;">public</span><span style="color: #000000;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                   <span style="color: #0000ff;">void</span> some_function<span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                             <span style="color: #009900;">this</span> <span style="color: #000000;">-</span>&gt; hide<span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                             window2 <span style="color: #000000;">=</span> <span style="color: #009900;">new</span> SecondWindow<span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                             window2 <span style="color: #000000;">-</span>&gt; displayTheWindow<span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                   <span style="color: #000000;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#125;</span></div></li></ol></pre></code><hr />
</div><br />
Important lines belonging to SecondWindow.h<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code"><pre class="qt" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">class SecondWindow <span style="color: #000000;">:</span> <span style="color: #0000ff;">public</span> <a href="http://qt-project.org/doc/qt-4.8/qdialog.html"><span style="">QDialog</span></a></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">	<span style="font-weight: bold;">Q_OBJECT</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">	<span style="color: #0000ff;">private</span><span style="color: #000000;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">		<a href="http://qt-project.org/doc/qt-4.8/qdialog.html"><span style="">QDialog</span></a> <span style="color: #000000;">*</span> dialog;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">slot</span><span style="color: #000000;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                         <span style="color: #0000ff;">void</span> startFirstWindow<span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #0000ff;">public</span><span style="color: #000000;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                  SecondWindow<span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                      dialog <span style="color: #000000;">=</span> <span style="color: #009900;">new</span> <a href="http://qt-project.org/doc/qt-4.8/qdialog.html"><span style="">QDialog</span></a><span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                      <span style="color: #0000ff;">connect</span><span style="color: #000000;">&#40;</span> <span style="color: #009900;">this</span>, <span style="color: #0000ff;">SIGNAL</span><span style="color: #000000;">&#40;</span> rejected<span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>, <span style="color: #009900;">this</span>, <span style="color: #0000ff;">SLOT</span><span style="color: #000000;">&#40;</span> startFirstWindow<span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                  <span style="color: #000000;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#125;</span></div></li></ol></pre></code><hr />
</div><br />
<br />
Can anybody please help me how should I write the slot of startFirstWindow( ). I just want to make the first window visible again. Or is there another approach to this without much changes. <br />
<br />
Thanks in advance for the help.</div>

]]></content:encoded>
			<category domain="http://www.qtcentre.org/forums/4-Newbie">Newbie</category>
			<dc:creator>Prasad_</dc:creator>
			<guid isPermaLink="true">http://www.qtcentre.org/threads/54586-Switching-between-two-windows</guid>
		</item>
		<item>
			<title>Two different methods of using QBrush with QPainter - why is only one working?</title>
			<link>http://www.qtcentre.org/threads/54584-Two-different-methods-of-using-QBrush-with-QPainter-why-is-only-one-working?goto=newpost</link>
			<pubDate>Tue, 14 May 2013 22:15:34 GMT</pubDate>
			<description><![CDATA[Hi everybody, 
 
I just managed to complete a long untouched work on a widget I want to use in one of my projects. It is a "circular progress bar",...]]></description>
			<content:encoded><![CDATA[<div>Hi everybody,<br />
<br />
I just managed to complete a long untouched work on a widget I want to use in one of my projects. It is a &quot;circular progress bar&quot;, simply drawn with QPainter::drawPie().<br />
<br />
<a href="http://www.qtcentre.org/attachment.php?attachmentid=9037&amp;d=1368569936"  title="Name:  pie.png
Views: 6
Size:  11.5 KB">pie.png</a><br />
<br />
During development, I have learned that I cannot assign a pointer to a QBrush to QPainter::setBrush() and then change some values of the brush to use different painting styles (well, actually I can - but in this case, all the area of the ellipse is painted black instead of only the pie itself). Instead, I have to create an all-new QBrush everytime I want to change the drawing style.<br />
<br />
Here is some code to explain the problem:<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code"><pre class="qt" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff0000;">//[... somewhere in the widget's header ...]</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <a href="http://qt-project.org/doc/qt-4.8/qpen.html"><span style="">QPen</span></a> <span style="color: #000000;">*</span>_foreGround;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <a href="http://qt-project.org/doc/qt-4.8/qbrush.html"><span style="">QBrush</span></a> <span style="color: #000000;">*</span>_backGround;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff0000;">//[... somewhere in the widget's initialization process ...]</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    _foreGround <span style="color: #000000;">=</span> <span style="color: #009900;">new</span> <a href="http://qt-project.org/doc/qt-4.8/qpen.html"><span style="">QPen</span></a><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    _foreGround<span style="color: #000000;">-</span>&gt;setCosmetic<span style="color: #000000;">&#40;</span><span style="color: #0000ff;">true</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    _foreGround<span style="color: #000000;">-</span>&gt;setWidth<span style="color: #000000;">&#40;</span><span style="color: #0000dd;">3</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    _backGround <span style="color: #000000;">=</span> <span style="color: #009900;">new</span> <a href="http://qt-project.org/doc/qt-4.8/qbrush.html"><span style="">QBrush</span></a><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    _backGround<span style="color: #000000;">-</span>&gt;setColor<span style="color: #000000;">&#40;</span><a href="http://qt-project.org/doc/qt-4.8/qcolor.html"><span style="">QColor</span></a><span style="color: #000000;">&#40;</span>qRgba<span style="color: #000000;">&#40;</span><span style="color: #0000dd;">0</span>,<span style="color: #0000dd;">0</span>,<span style="color: #0000dd;">0</span>,<span style="color: #0000dd;">0</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff0000;">//[...]</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">void</span> QtProgressPie<span style="color: #000000;">::</span><span style="color: #009900;">paintEvent</span><span style="color: #000000;">&#40;</span><a href="http://qt-project.org/doc/qt-4.8/qpaintevent.html"><span style="">QPaintEvent</span></a> <span style="color: #000000;">*</span>e<span style="color: #000000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff0000;">// recalculate the value according to the conditions of QPainter::drawPie</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff0000;">// step 1: subtract _minimum from _value (so the calculation base is always 0)</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff0000;">// step 2: calculate the percentage of value (value/max * 100)</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff0000;">// step 3: translate it to circular conditions (value/max * [100 * 3.6 * 16]) [...] = _FULLCIRCLE</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff0000;">// step 4: take it times -1 (QPainter::drawPie works counter-clockwise with positive values)</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">int</span> _painterValue <span style="color: #000000;">=</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>_value <span style="color: #000000;">-</span> _minimum<span style="color: #000000;">&#41;</span> <span style="color: #000000;">/</span> <span style="color: #0000ff;">double</span><span style="color: #000000;">&#40;</span>_maximum <span style="color: #000000;">-</span> _minimum<span style="color: #000000;">&#41;</span> <span style="color: #000000;">*</span> _FULLCIRCLE<span style="color: #000000;">&#41;</span> <span style="color: #000000;">*</span> <span style="color: #000000;">-</span><span style="color: #0000dd;">1</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <a href="http://qt-project.org/doc/qt-4.8/qpainter.html"><span style="">QPainter</span></a> p;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    p.<span style="color: #009900;">begin</span><span style="color: #000000;">&#40;</span><span style="color: #009900;">this</span><span style="color: #000000;">&#41;</span>;  <span style="color: #ff0000;">// Begin drawing on the widget</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff0000;">// make sure that the widget appears always as a circle, not as an ellipse</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">int</span> _squaredSize <span style="color: #000000;">=</span> qMin<span style="color: #000000;">&#40;</span>this<span style="color: #000000;">-</span>&gt;width<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>, this<span style="color: #000000;">-</span>&gt;height<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    p.<span style="color: #009900;">setViewport</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>this<span style="color: #000000;">-</span>&gt;width<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">-</span> _squaredSize<span style="color: #000000;">&#41;</span> <span style="color: #000000;">/</span> <span style="color: #0000dd;">2</span>,<span style="color: #000000;">&#40;</span>this<span style="color: #000000;">-</span>&gt;height<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">-</span> _squaredSize<span style="color: #000000;">&#41;</span> <span style="color: #000000;">/</span> <span style="color: #0000dd;">2</span>,</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                  _squaredSize, _squaredSize<span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff0000;">// subtract the width of the pen (&quot;the border width&quot;) from the widget's rect() to get the drawable area</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">int</span> _borderWidth <span style="color: #000000;">=</span> _foreGround<span style="color: #000000;">-</span>&gt;width<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <a href="http://qt-project.org/doc/qt-4.8/qrect.html"><span style="">QRect</span></a> drawableArea<span style="color: #000000;">&#40;</span><span style="color: #0000dd;">0</span> <span style="color: #000000;">+</span> _borderWidth, <span style="color: #0000dd;">0</span> <span style="color: #000000;">+</span> _borderWidth,</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                       this<span style="color: #000000;">-</span>&gt;width<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">-</span> _borderWidth <span style="color: #000000;">*</span> <span style="color: #0000dd;">2</span>, this<span style="color: #000000;">-</span>&gt;height<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">-</span> _borderWidth <span style="color: #000000;">*</span> <span style="color: #0000dd;">2</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    p.<span style="color: #009900;">setRenderHint</span><span style="color: #000000;">&#40;</span><a href="http://qt-project.org/doc/qt-4.8/qpainter.html"><span style="">QPainter</span></a><span style="color: #000000;">::</span><span style="color: #009900;">HighQualityAntialiasing</span>, <span style="color: #0000ff;">true</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    p.<span style="color: #009900;">setPen</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">*</span>_foreGround<span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff0000;">//p.setBrush(*_backGround); &lt;--- DOESN'T WORK</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff0000;">// draw surrounding circle</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff0000;">// _backGround-&gt;setStyle(Qt::NoBrush); &lt;--- DOESN'T WORK</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    p.<span style="color: #009900;">setBrush</span><span style="color: #000000;">&#40;</span><a href="http://qt-project.org/doc/qt-4.8/qbrush.html"><span style="">QBrush</span></a><span style="color: #000000;">&#40;</span><a href="http://qt-project.org/doc/qt-4.8/qcolor.html"><span style="">QColor</span></a><span style="color: #000000;">&#40;</span>qRgba<span style="color: #000000;">&#40;</span><span style="color: #0000dd;">0</span>,<span style="color: #0000dd;">0</span>,<span style="color: #0000dd;">0</span>,<span style="color: #0000dd;">0</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>,Qt<span style="color: #000000;">::</span><span style="color: #009900;">NoBrush</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>; <span style="color: #ff0000;">// &lt;--- WORKS!</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    p.<span style="color: #009900;">drawEllipse</span><span style="color: #000000;">&#40;</span>drawableArea<span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff0000;">// draw pie if value &lt; 0</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">if</span> <span style="color: #000000;">&#40;</span>_painterValue &lt; <span style="color: #0000dd;">0</span><span style="color: #000000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #ff0000;">//_backGround-&gt;setStyle(Qt::SolidPattern); &lt;--- DOESN'T WORK</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        p.<span style="color: #009900;">setBrush</span><span style="color: #000000;">&#40;</span><a href="http://qt-project.org/doc/qt-4.8/qbrush.html"><span style="">QBrush</span></a><span style="color: #000000;">&#40;</span><a href="http://qt-project.org/doc/qt-4.8/qcolor.html"><span style="">QColor</span></a><span style="color: #000000;">&#40;</span>qRgba<span style="color: #000000;">&#40;</span><span style="color: #0000dd;">0</span>,<span style="color: #0000dd;">0</span>,<span style="color: #0000dd;">0</span>,<span style="color: #0000dd;">0</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>,Qt<span style="color: #000000;">::</span><span style="color: #009900;">SolidPattern</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>; <span style="color: #ff0000;">// &lt;--- WORKS!</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        p.<span style="color: #009900;">drawPie</span><span style="color: #000000;">&#40;</span>drawableArea, _OFFSET, _painterValue<span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #ff0000;">// _OFFSET = 1/4 of _FULLCIRCLE (transition from 3 o'clock (drawPie's base) to 12 o'clock)</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000000;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    p.<span style="color: #009900;">end</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;    <span style="color: #ff0000;">// Drawing finished</span></div></li></ol></pre></code><hr />
</div><br />
So, my question is: why can't I use the &quot;more elegant&quot; solution with the pointer variable?<br />
<br />
Greetings,<br />
Markus<br />
<br />
<font size="1">EDIT: picture added, futher explanation of what goes wrong when using a pointer.</font></div>

]]></content:encoded>
			<category domain="http://www.qtcentre.org/forums/4-Newbie">Newbie</category>
			<dc:creator>EMKAH</dc:creator>
			<guid isPermaLink="true">http://www.qtcentre.org/threads/54584-Two-different-methods-of-using-QBrush-with-QPainter-why-is-only-one-working</guid>
		</item>
		<item>
			<title>Scaling the image in GraphicsView and Scene is cutting the right border of image</title>
			<link>http://www.qtcentre.org/threads/54583-Scaling-the-image-in-GraphicsView-and-Scene-is-cutting-the-right-border-of-image?goto=newpost</link>
			<pubDate>Tue, 14 May 2013 21:20:48 GMT</pubDate>
			<description>Hi, 
 
I’m trying to scale a image to fit in the QGraphicView. Sometimes it works, but for example, if I load a image of size 1500×900, the resized...</description>
			<content:encoded><![CDATA[<div>Hi,<br />
<br />
I’m trying to scale a image to fit in the QGraphicView. Sometimes it works, but for example, if I load a image of size 1500×900, the resized image is cut a bit in the right border, even with the scrool activated. What is wrong in the code below? <br />
<br />
   <div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code"><pre class="qt" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">int</span> sceneWidth <span style="color: #000000;">=</span> <span style="color: #0000dd;">800</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">int</span> sceneHeight <span style="color: #000000;">=</span> <span style="color: #0000dd;">600</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    ui<span style="color: #000000;">-</span>&gt;graphicsView<span style="color: #000000;">-</span>&gt;setFixedWidth<span style="color: #000000;">&#40;</span>sceneWidth<span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    ui<span style="color: #000000;">-</span>&gt;graphicsView<span style="color: #000000;">-</span>&gt;setFixedHeight<span style="color: #000000;">&#40;</span>sceneHeight<span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff0000;">// mScene is a subclass of QGraphicsScene</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    mScene<span style="color: #000000;">-</span>&gt;clear<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">!</span>imageQt.<span style="color: #009900;">isNull</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span> <span style="color: #ff0000;">// imageQt is QImage</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <a href="http://qt-project.org/doc/qt-4.8/qpixmap.html"><span style="">QPixmap</span></a> originalImage <span style="color: #000000;">=</span> <a href="http://qt-project.org/doc/qt-4.8/qpixmap.html"><span style="">QPixmap</span></a><span style="color: #000000;">::</span><span style="color: #009900;">fromImage</span><span style="color: #000000;">&#40;</span>imageQt<span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <a href="http://qt-project.org/doc/qt-4.8/qpixmap.html"><span style="">QPixmap</span></a> scaledImage <span style="color: #000000;">=</span> <a href="http://qt-project.org/doc/qt-4.8/qpixmap.html"><span style="">QPixmap</span></a><span style="color: #000000;">&#40;</span>originalImage.<span style="color: #009900;">scaledToHeight</span><span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#40;</span><span style="color: #0000ff;">int</span><span style="color: #000000;">&#41;</span> mScene<span style="color: #000000;">-</span>&gt;height<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>, Qt<span style="color: #000000;">::</span><span style="color: #009900;">SmoothTransformation</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        ui<span style="color: #000000;">-</span>&gt;graphicsView<span style="color: #000000;">-</span>&gt;setFixedWidth<span style="color: #000000;">&#40;</span> scaledImage.<span style="color: #009900;">width</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        ui<span style="color: #000000;">-</span>&gt;graphicsView<span style="color: #000000;">-</span>&gt;setFixedHeight<span style="color: #000000;">&#40;</span> scaledImage.<span style="color: #009900;">height</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        mScene<span style="color: #000000;">-</span>&gt;addPixmap<span style="color: #000000;">&#40;</span>scaledImage<span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        ui<span style="color: #000000;">-</span>&gt;graphicsView<span style="color: #000000;">-</span>&gt;setScene<span style="color: #000000;">&#40;</span>mScene<span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        ui<span style="color: #000000;">-</span>&gt;graphicsView<span style="color: #000000;">-</span>&gt;setSceneRect<span style="color: #000000;">&#40;</span>scaledImage.<span style="color: #009900;">rect</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        ui<span style="color: #000000;">-</span>&gt;graphicsView<span style="color: #000000;">-</span>&gt;fitInView<span style="color: #000000;">&#40;</span>mScene<span style="color: #000000;">-</span>&gt;itemsBoundingRect<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> , Qt<span style="color: #000000;">::</span><span style="color: #009900;">KeepAspectRatio</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        ui<span style="color: #000000;">-</span>&gt;graphicsView<span style="color: #000000;">-</span>&gt;show<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div></li></ol></pre></code><hr />
</div></div>

]]></content:encoded>
			<category domain="http://www.qtcentre.org/forums/4-Newbie">Newbie</category>
			<dc:creator>icedecker</dc:creator>
			<guid isPermaLink="true">http://www.qtcentre.org/threads/54583-Scaling-the-image-in-GraphicsView-and-Scene-is-cutting-the-right-border-of-image</guid>
		</item>
		<item>
			<title>Printing from TextEdit | QPrinter | QPrintDialog</title>
			<link>http://www.qtcentre.org/threads/54575-Printing-from-TextEdit-QPrinter-QPrintDialog?goto=newpost</link>
			<pubDate>Tue, 14 May 2013 06:27:05 GMT</pubDate>
			<description><![CDATA[Hi, 
 
I am trying to get printing service to work in my simple program. I am doing it in this way: 
 
<div class="bbcode_container"> 
	<div...]]></description>
			<content:encoded><![CDATA[<div>Hi,<br />
<br />
I am trying to get printing service to work in my simple program. I am doing it in this way:<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code"><pre class="qt" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339900;">#include &lt;QtPrintSupport/QPrintDialog&gt;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339900;">#include &lt;QtPrintSupport/QPrinter&gt;</span></div></li></ol></pre></code><hr />
</div><br />
And than I get the code in my print button.<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code"><pre class="qt" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">void</span> MainWindow<span style="color: #000000;">::</span><span style="color: #009900;">on_printButton_clicked</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <a href="http://qt-project.org/doc/qt-4.8/qprinter.html"><span style="">QPrinter</span></a> printer;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <a href="http://qt-project.org/doc/qt-4.8/qprintdialog.html"><span style="">QPrintDialog</span></a> printDialog<span style="color: #000000;">&#40;</span><span style="color: #000000;">&amp;</span>printer, <span style="color: #009900;">this</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">if</span> <span style="color: #000000;">&#40;</span>printDialog.<span style="color: #009900;">exec</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">==</span> <a href="http://qt-project.org/doc/qt-4.8/qdialog.html"><span style="">QDialog</span></a><span style="color: #000000;">::</span><span style="color: #009900;">Accepted</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">       ui<span style="color: #000000;">-</span>&gt;textBox<span style="color: #000000;">-</span>&gt;print<span style="color: #000000;">&#40;</span><span style="color: #000000;">&amp;</span>printer<span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000000;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#125;</span></div></li></ol></pre></code><hr />
</div><br />
I get a lot of &quot;undefined reference&quot; errors to QPrintDialog and QPrinter. <br />
If You could drop me some hint.</div>

]]></content:encoded>
			<category domain="http://www.qtcentre.org/forums/4-Newbie">Newbie</category>
			<dc:creator>Noob</dc:creator>
			<guid isPermaLink="true">http://www.qtcentre.org/threads/54575-Printing-from-TextEdit-QPrinter-QPrintDialog</guid>
		</item>
		<item>
			<title>C++_Qml integrating</title>
			<link>http://www.qtcentre.org/threads/54572-C-_Qml-integrating?goto=newpost</link>
			<pubDate>Mon, 13 May 2013 19:07:01 GMT</pubDate>
			<description>hi, 
 
 i am using qml for ui and c++ for database...how to get retrieve data from c++ to qml...please tell me... 
 
thanks and advance...</description>
			<content:encoded><![CDATA[<div>hi,<br />
<br />
 i am using qml for ui and c++ for database...how to get retrieve data from c++ to qml...please tell me...<br />
<br />
thanks and advance...</div>

]]></content:encoded>
			<category domain="http://www.qtcentre.org/forums/4-Newbie">Newbie</category>
			<dc:creator>ganeshgladish</dc:creator>
			<guid isPermaLink="true">http://www.qtcentre.org/threads/54572-C-_Qml-integrating</guid>
		</item>
		<item>
			<title>No such slot</title>
			<link>http://www.qtcentre.org/threads/54568-No-such-slot?goto=newpost</link>
			<pubDate>Mon, 13 May 2013 15:16:41 GMT</pubDate>
			<description><![CDATA[I am obtaining the following error when I run this program: 
 
"QObject::connect: No such slot MainWindow::read_deck(const QString &fileName) in...]]></description>
			<content:encoded><![CDATA[<div>I am obtaining the following error when I run this program:<br />
<br />
&quot;QObject::connect: No such slot MainWindow::read_deck(const QString &amp;fileName) in ../Card_Probability_Calc/mainwindow.cpp:232<br />
The program has unexpectedly finished.&quot;<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code"><pre class="qt" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">void</span> MainWindow<span style="color: #000000;">::</span><span style="color: #009900;">create_actions</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    readAction <span style="color: #000000;">=</span> <span style="color: #009900;">new</span> <a href="http://qt-project.org/doc/qt-4.8/qaction.html"><span style="">QAction</span></a><span style="color: #000000;">&#40;</span>tr<span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;Read new deck&quot;</span><span style="color: #000000;">&#41;</span>, <span style="color: #009900;">this</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <a href="http://qt-project.org/doc/qt-4.8/qobject.html"><span style="">QObject</span></a><span style="color: #000000;">::</span><span style="color: #0000ff;">connect</span><span style="color: #000000;">&#40;</span>readAction, <span style="color: #0000ff;">SIGNAL</span><span style="color: #000000;">&#40;</span>triggered<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>, <span style="color: #009900;">this</span>, <span style="color: #0000ff;">SLOT</span><span style="color: #000000;">&#40;</span>read_deck<span style="color: #000000;">&#40;</span><span style="color: #0000ff;">const</span> <a href="http://qt-project.org/doc/qt-4.8/qstring.html"><span style="">QString</span></a> <span style="color: #000000;">&amp;</span>fileName<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>; <span style="color: #000000;">***</span> point of error</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    refreshAction <span style="color: #000000;">=</span> <span style="color: #009900;">new</span> <a href="http://qt-project.org/doc/qt-4.8/qaction.html"><span style="">QAction</span></a><span style="color: #000000;">&#40;</span>tr<span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;Reload current deck&quot;</span><span style="color: #000000;">&#41;</span>, <span style="color: #009900;">this</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <a href="http://qt-project.org/doc/qt-4.8/qobject.html"><span style="">QObject</span></a><span style="color: #000000;">::</span><span style="color: #0000ff;">connect</span><span style="color: #000000;">&#40;</span>refreshAction, <span style="color: #0000ff;">SIGNAL</span><span style="color: #000000;">&#40;</span>triggered<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>, <span style="color: #009900;">this</span>, <span style="color: #0000ff;">SLOT</span><span style="color: #000000;">&#40;</span>refresh_deck<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff0000;">//saveAction = new QAction(tr(&quot;Save results to file&quot;), this);</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">   <span style="color: #ff0000;">// QObject::connect(saveAction, SIGNAL(triggered()), this, SLOT(save_analysis()));</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    analyzeAction <span style="color: #000000;">=</span> <span style="color: #009900;">new</span> <a href="http://qt-project.org/doc/qt-4.8/qaction.html"><span style="">QAction</span></a><span style="color: #000000;">&#40;</span>tr<span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;Perform deck analysis&quot;</span><span style="color: #000000;">&#41;</span>, <span style="color: #009900;">this</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <a href="http://qt-project.org/doc/qt-4.8/qobject.html"><span style="">QObject</span></a><span style="color: #000000;">::</span><span style="color: #0000ff;">connect</span><span style="color: #000000;">&#40;</span>analyzeAction, <span style="color: #0000ff;">SIGNAL</span><span style="color: #000000;">&#40;</span>triggered<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>, <span style="color: #009900;">this</span>, <span style="color: #0000ff;">SLOT</span><span style="color: #000000;">&#40;</span>analyze_deck<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <a href="http://qt-project.org/doc/qt-4.8/qobject.html"><span style="">QObject</span></a><span style="color: #000000;">::</span><span style="color: #0000ff;">connect</span><span style="color: #000000;">&#40;</span>exitAction,<span style="color: #0000ff;">SIGNAL</span><span style="color: #000000;">&#40;</span>triggered<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>, <span style="color: #009900;">qApp</span>, <span style="color: #0000ff;">SLOT</span><span style="color: #000000;">&#40;</span>quit<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <a href="http://qt-project.org/doc/qt-4.8/qobject.html"><span style="">QObject</span></a><span style="color: #000000;">::</span><span style="color: #0000ff;">connect</span><span style="color: #000000;">&#40;</span>btns_a<span style="color: #000000;">&#91;</span><span style="color: #0000dd;">0</span><span style="color: #000000;">&#93;</span>, <span style="color: #0000ff;">SIGNAL</span><span style="color: #000000;">&#40;</span><a href="http://qt-project.org/doc/qt-4.8/qpushbutton.html"><span style="">QPushButton</span></a><span style="color: #000000;">::</span><span style="color: #009900;">clicked</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>, <span style="color: #009900;">this</span>, <span style="color: #0000ff;">SLOT</span><span style="color: #000000;">&#40;</span>m_b<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <a href="http://qt-project.org/doc/qt-4.8/qobject.html"><span style="">QObject</span></a><span style="color: #000000;">::</span><span style="color: #0000ff;">connect</span><span style="color: #000000;">&#40;</span>btns_a<span style="color: #000000;">&#91;</span><span style="color: #0000dd;">1</span><span style="color: #000000;">&#93;</span>, <span style="color: #0000ff;">SIGNAL</span><span style="color: #000000;">&#40;</span><a href="http://qt-project.org/doc/qt-4.8/qpushbutton.html"><span style="">QPushButton</span></a><span style="color: #000000;">::</span><span style="color: #009900;">clicked</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>, <span style="color: #009900;">this</span>, <span style="color: #0000ff;">SLOT</span><span style="color: #000000;">&#40;</span>m_g<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <a href="http://qt-project.org/doc/qt-4.8/qobject.html"><span style="">QObject</span></a><span style="color: #000000;">::</span><span style="color: #0000ff;">connect</span><span style="color: #000000;">&#40;</span>btns_a<span style="color: #000000;">&#91;</span><span style="color: #0000dd;">2</span><span style="color: #000000;">&#93;</span>, <span style="color: #0000ff;">SIGNAL</span><span style="color: #000000;">&#40;</span><a href="http://qt-project.org/doc/qt-4.8/qpushbutton.html"><span style="">QPushButton</span></a><span style="color: #000000;">::</span><span style="color: #009900;">clicked</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>, <span style="color: #009900;">this</span>, <span style="color: #0000ff;">SLOT</span><span style="color: #000000;">&#40;</span>b_m<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <a href="http://qt-project.org/doc/qt-4.8/qobject.html"><span style="">QObject</span></a><span style="color: #000000;">::</span><span style="color: #0000ff;">connect</span><span style="color: #000000;">&#40;</span>btns_a<span style="color: #000000;">&#91;</span><span style="color: #0000dd;">3</span><span style="color: #000000;">&#93;</span>, <span style="color: #0000ff;">SIGNAL</span><span style="color: #000000;">&#40;</span><a href="http://qt-project.org/doc/qt-4.8/qpushbutton.html"><span style="">QPushButton</span></a><span style="color: #000000;">::</span><span style="color: #009900;">clicked</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>, <span style="color: #009900;">this</span>, <span style="color: #0000ff;">SLOT</span><span style="color: #000000;">&#40;</span>b_g<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <a href="http://qt-project.org/doc/qt-4.8/qobject.html"><span style="">QObject</span></a><span style="color: #000000;">::</span><span style="color: #0000ff;">connect</span><span style="color: #000000;">&#40;</span>btns_a<span style="color: #000000;">&#91;</span><span style="color: #0000dd;">4</span><span style="color: #000000;">&#93;</span>, <span style="color: #0000ff;">SIGNAL</span><span style="color: #000000;">&#40;</span><a href="http://qt-project.org/doc/qt-4.8/qpushbutton.html"><span style="">QPushButton</span></a><span style="color: #000000;">::</span><span style="color: #009900;">clicked</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>, <span style="color: #009900;">this</span>, <span style="color: #0000ff;">SLOT</span><span style="color: #000000;">&#40;</span>g_m<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <a href="http://qt-project.org/doc/qt-4.8/qobject.html"><span style="">QObject</span></a><span style="color: #000000;">::</span><span style="color: #0000ff;">connect</span><span style="color: #000000;">&#40;</span>btns_a<span style="color: #000000;">&#91;</span><span style="color: #0000dd;">5</span><span style="color: #000000;">&#93;</span>, <span style="color: #0000ff;">SIGNAL</span><span style="color: #000000;">&#40;</span><a href="http://qt-project.org/doc/qt-4.8/qpushbutton.html"><span style="">QPushButton</span></a><span style="color: #000000;">::</span><span style="color: #009900;">clicked</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>, <span style="color: #009900;">this</span>, <span style="color: #0000ff;">SLOT</span><span style="color: #000000;">&#40;</span>g_b<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#125;</span></div></li></ol></pre></code><hr />
</div><br />
<br />
slot:<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code"><pre class="qt" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">void</span> MainWindow<span style="color: #000000;">::</span><span style="color: #009900;">read_deck</span><span style="color: #000000;">&#40;</span><span style="color: #0000ff;">const</span> <a href="http://qt-project.org/doc/qt-4.8/qstring.html"><span style="">QString</span></a> <span style="color: #000000;">&amp;</span>fileName<span style="color: #000000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    list_sizes<span style="color: #000000;">&#91;</span><span style="color: #0000dd;">0</span><span style="color: #000000;">&#93;</span> <span style="color: #000000;">=</span> <span style="color: #0000dd;">0</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    list_sizes<span style="color: #000000;">&#91;</span><span style="color: #0000dd;">1</span><span style="color: #000000;">&#93;</span> <span style="color: #000000;">=</span> <span style="color: #0000dd;">0</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    list_sizes<span style="color: #000000;">&#91;</span><span style="color: #0000dd;">2</span><span style="color: #000000;">&#93;</span> <span style="color: #000000;">=</span> <span style="color: #0000dd;">0</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">int</span> monster_count <span style="color: #000000;">=</span> <span style="color: #0000dd;">0</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">int</span> spell_count <span style="color: #000000;">=</span> <span style="color: #0000dd;">0</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">int</span> trap_count <span style="color: #000000;">=</span> <span style="color: #0000dd;">0</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    current_file <span style="color: #000000;">=</span> fileName;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    std<span style="color: #000000;">::</span><span style="color: #009900;">string</span> <span style="color: #0000ff;">file</span> <span style="color: #000000;">=</span> fileName.<span style="color: #009900;">toStdString</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    std<span style="color: #000000;">::</span><span style="color: #009900;">string</span> current_card;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <a href="http://qt-project.org/doc/qt-4.8/qstring.html"><span style="">QString</span></a> current_card_q;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    std<span style="color: #000000;">::</span><span style="color: #009900;">ifstream</span> infile<span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;file.txt&quot;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">int</span> passed_main <span style="color: #000000;">=</span> <span style="color: #0000dd;">0</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    std<span style="color: #000000;">::</span><span style="color: #009900;">string</span> line;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">while</span><span style="color: #000000;">&#40;</span>std<span style="color: #000000;">::</span><span style="color: #009900;">getline</span><span style="color: #000000;">&#40;</span>infile, line<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #0000ff;">if</span><span style="color: #000000;">&#40;</span>line <span style="color: #000000;">==</span> <span style="color: #666666;">&quot;#main&quot;</span><span style="color: #000000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #000000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            passed_main<span style="color: #000000;">++</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #000000;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #0000ff;">else</span> <span style="color: #0000ff;">if</span><span style="color: #000000;">&#40;</span>line <span style="color: #000000;">==</span> <span style="color: #666666;">&quot;#extra&quot;</span><span style="color: #000000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #000000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            passed_main<span style="color: #000000;">++</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #000000;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #0000ff;">else</span> <span style="color: #0000ff;">if</span><span style="color: #000000;">&#40;</span>passed_main <span style="color: #000000;">==</span> <span style="color: #0000dd;">1</span><span style="color: #000000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #000000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            current_card <span style="color: #000000;">=</span> read_name<span style="color: #000000;">&#40;</span>line<span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            current_card_q <span style="color: #000000;">=</span> <a href="http://qt-project.org/doc/qt-4.8/qstring.html"><span style="">QString</span></a><span style="color: #000000;">::</span><span style="color: #009900;">fromUtf8</span><span style="color: #000000;">&#40;</span>current_card.<span style="color: #009900;">c_str</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <a href="http://qt-project.org/doc/qt-4.8/qlistwidgetitem.html"><span style="">QListWidgetItem</span></a> <span style="color: #000000;">*</span>new_item <span style="color: #000000;">=</span> <span style="color: #009900;">new</span> <a href="http://qt-project.org/doc/qt-4.8/qlistwidgetitem.html"><span style="">QListWidgetItem</span></a>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            new_item<span style="color: #000000;">-</span>&gt;setText<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>current_card_q<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            mn_lst<span style="color: #000000;">-</span>&gt;QListWidget<span style="color: #000000;">::</span><span style="color: #009900;">addItem</span><span style="color: #000000;">&#40;</span>new_item<span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            list_sizes<span style="color: #000000;">&#91;</span><span style="color: #0000dd;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">++</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            read_type<span style="color: #000000;">&#40;</span>current_card<span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #000000;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000000;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#125;</span></div></li></ol></pre></code><hr />
</div><br />
<br />
slots def.<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code"><pre class="qt" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">class MainWindow <span style="color: #000000;">:</span> <span style="color: #0000ff;">public</span> <a href="http://qt-project.org/doc/qt-4.8/qmainwindow.html"><span style="">QMainWindow</span></a></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="font-weight: bold;">Q_OBJECT</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">public</span><span style="color: #000000;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    MainWindow<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    std<span style="color: #000000;">::</span><span style="color: #009900;">string</span> read_name<span style="color: #000000;">&#40;</span><span style="color: #0000ff;">const</span> std<span style="color: #000000;">::</span><span style="color: #009900;">string</span> idnum<span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">int</span> read_number<span style="color: #000000;">&#40;</span><span style="color: #0000ff;">const</span> std<span style="color: #000000;">::</span><span style="color: #009900;">string</span> idnum<span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">int</span> read_type<span style="color: #000000;">&#40;</span><span style="color: #0000ff;">const</span> std<span style="color: #000000;">::</span><span style="color: #009900;">string</span> idnum<span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <a href="http://qt-project.org/doc/qt-4.8/qlistwidgetitem.html"><span style="">QListWidgetItem</span></a> <span style="color: #000000;">*</span>items_a<span style="color: #000000;">&#91;</span><span style="color: #0000dd;">10</span><span style="color: #000000;">&#93;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">   <span style="color: #ff0000;">// void save_analysis(const std::string &amp;fileName);</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">slots</span><span style="color: #000000;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">void</span> analyze_deck<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">void</span> read_deck<span style="color: #000000;">&#40;</span><span style="color: #0000ff;">const</span> <a href="http://qt-project.org/doc/qt-4.8/qstring.html"><span style="">QString</span></a> <span style="color: #000000;">&amp;</span>fileName<span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">void</span> refresh_deck<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">void</span> m_b<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">void</span> m_g<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">void</span> b_m<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">void</span> b_g<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">void</span> g_m<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">void</span> g_b<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">.</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">.</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">.</div></li></ol></pre></code><hr />
</div><br />
<br />
I have already forced the _moc file to be redone.<br />
<br />
<div style="padding: 0px;">
<hr style="height: 1px; background-color: rgb(196,196,196); border: 0; margin-bottom: 2px; display: block;" /><i>Added after 28 minutes:</i>
</div><br />
<br />
Additionally,  all of the connects for the pushbuttons are also non-functional</div>

]]></content:encoded>
			<category domain="http://www.qtcentre.org/forums/4-Newbie">Newbie</category>
			<dc:creator>ABZB</dc:creator>
			<guid isPermaLink="true">http://www.qtcentre.org/threads/54568-No-such-slot</guid>
		</item>
		<item>
			<title>Qt video</title>
			<link>http://www.qtcentre.org/threads/54565-Qt-video?goto=newpost</link>
			<pubDate>Mon, 13 May 2013 13:29:08 GMT</pubDate>
			<description>hi , 
  
i have written code for running the video using Qt c++...everything works fine....my question is how to play that video via qml from Qt...</description>
			<content:encoded><![CDATA[<div>hi ,<br />
 <br />
i have written code for running the video using Qt c++...everything works fine....my question is how to play that video via qml from Qt c++....<br />
<br />
thanks and advance....</div>

]]></content:encoded>
			<category domain="http://www.qtcentre.org/forums/4-Newbie">Newbie</category>
			<dc:creator>ganeshgladish</dc:creator>
			<guid isPermaLink="true">http://www.qtcentre.org/threads/54565-Qt-video</guid>
		</item>
		<item>
			<title>simple problem, not sure what I did:</title>
			<link>http://www.qtcentre.org/threads/54563-simple-problem-not-sure-what-I-did?goto=newpost</link>
			<pubDate>Mon, 13 May 2013 12:52:56 GMT</pubDate>
			<description><![CDATA[Hello, 
 
I declared in my mainwindow.h file: 
 
    QListWidgetItem *items_a[10]; 
 
under private variables. 
 
I have a member function]]></description>
			<content:encoded><![CDATA[<div>Hello,<br />
<br />
I declared in my mainwindow.h file:<br />
<br />
    QListWidgetItem *items_a[10];<br />
<br />
under private variables.<br />
<br />
I have a member function<br />
<br />
void analyze_deck()<br />
{<br />
    double total_cards = monster_count + spell_count + trap_count;<br />
    //no monsters:<br />
    double no_m = nfomf(total_cards - monster_count, total_cards,6);<br />
    //no spells<br />
    double no_s = nfomf(total_cards - spell_count, total_cards,6);<br />
    //no traps<br />
    double no_t = nfomf(total_cards - trap_count, total_cards,6);<br />
    //at least 1 good<br />
    double al1g = 1 - nfomf(total_cards - list_sizes[2], total_cards, 6);<br />
    //all bad<br />
    double al1b = 1 - nfomf(total_cards - list_sizes[1], total_cards, 6);<br />
<br />
***    items_a[1]-&gt;setText(QString(&quot;%1&quot;).arg(no_m));<br />
    items_a[3]-&gt;setText(QString(&quot;%1&quot;).arg(no_s));<br />
    items_a[5]-&gt;setText(QString(&quot;%1&quot;).arg(no_t));<br />
    items_a[7]-&gt;setText(QString(&quot;%1&quot;).arg(al1b));<br />
    items_a[9]-&gt;setText(QString(&quot;%1&quot;).arg(al1g));<br />
}<br />
<br />
implemented in mainwindow.cpp<br />
<br />
<br />
the compiler is returning &quot;items_a was not declared in this scope&quot; at the line marked ***. (if i comment out that line, the error occurs at the next line down)<br />
<br />
I initialize the items_a[0...9] and add them to the appropriate listwidget further down in the file:<br />
<br />
void MainWindow::createV_bx_rslt() //creates a vbox for outputing the data in<br />
{<br />
    v_rslt_p = new QVBoxLayout;<br />
<br />
    QListWidget *rslt_lst = new QListWidget(this);<br />
    v_rslt_p-&gt;QVBoxLayout::addWidget(rslt_lst);<br />
<br />
    for(int i = 0; i &lt; 10; i++)<br />
    {<br />
        items_a[i] = new QListWidgetItem;<br />
        rslt_lst-&gt;addItem(items_a[i]);<br />
    }<br />
<br />
    items_a[0]-&gt;setText(tr(&quot;Probability of starting with no Monster cards&quot;));<br />
  <br />
    items_a[2]-&gt;setText(tr(&quot;Probability of starting with no Spell cards&quot;));<br />
   <br />
    items_a[4]-&gt;setText((&quot;Probability of starting with no trap cards&quot;));<br />
    <br />
    items_a[6]-&gt;setText((&quot;Probability of starting with a dead hand&quot;));<br />
    <br />
    items_a[8]-&gt;setText(tr(&quot;Probability of at least one key card in opening hand&quot;));<br />
    <br />
}<br />
<br />
Thank you in advance for your advice.<br />
<br />
-ABZB<br />
<br />
edit: I attached the .h and .cpp files in question</div>


	<div style="padding:10px">

	

	

	

	
		<fieldset class="fieldset">
			<legend>Attached Files</legend>
			<ul>
			<li>
	<img class="inlineimg" src="/h.gif" alt="File Type: h" />
	<a href="http://www.qtcentre.org/attachment.php?attachmentid=9031&amp;d=1368452592">mainwindow.h&lrm;</a> 
(2.6 KB)
</li><li>
	<img class="inlineimg" src="/cpp.gif" alt="File Type: cpp" />
	<a href="http://www.qtcentre.org/attachment.php?attachmentid=9032&amp;d=1368452593" target="_blank">mainwindow.cpp&lrm;</a> 
(7.9 KB)
</li>
			</ul>
		</fieldset>
	

	</div>
]]></content:encoded>
			<category domain="http://www.qtcentre.org/forums/4-Newbie">Newbie</category>
			<dc:creator>ABZB</dc:creator>
			<guid isPermaLink="true">http://www.qtcentre.org/threads/54563-simple-problem-not-sure-what-I-did</guid>
		</item>
		<item>
			<title>Getting 1073741502 exit code</title>
			<link>http://www.qtcentre.org/threads/54557-Getting-1073741502-exit-code?goto=newpost</link>
			<pubDate>Mon, 13 May 2013 09:50:48 GMT</pubDate>
			<description>Hi, 
 
I am getting 1073741502 exit code when I try to run the application.  
Sometime rebuilding the application works but now a days this error is...</description>
			<content:encoded><![CDATA[<div>Hi,<br />
<br />
I am getting 1073741502 exit code when I try to run the application. <br />
Sometime rebuilding the application works but now a days this error is occurring very frequently.<br />
<br />
Can you guide me resolving this problem?</div>

]]></content:encoded>
			<category domain="http://www.qtcentre.org/forums/4-Newbie">Newbie</category>
			<dc:creator>ujwala</dc:creator>
			<guid isPermaLink="true">http://www.qtcentre.org/threads/54557-Getting-1073741502-exit-code</guid>
		</item>
		<item>
			<title>Getting superscript of arbitrary number to use in a QString</title>
			<link>http://www.qtcentre.org/threads/54552-Getting-superscript-of-arbitrary-number-to-use-in-a-QString?goto=newpost</link>
			<pubDate>Sun, 12 May 2013 21:08:20 GMT</pubDate>
			<description><![CDATA[Hello, 
 
I have some QGraphicsItems onto which text is drawn from a QString, as well as some buttons whose title again is set from a QString. I 'd...]]></description>
			<content:encoded><![CDATA[<div>Hello,<br />
<br />
I have some QGraphicsItems onto which text is drawn from a QString, as well as some buttons whose title again is set from a QString. I 'd like that to include superscripts. Hard-coding it like this<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code"><pre class="qt" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><a href="http://qt-project.org/doc/qt-4.8/qstring.html"><span style="">QString</span></a> text<span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;σ²&quot;</span><span style="color: #000000;">&#41;</span>;</div></li></ol></pre></code><hr />
</div><br />
works, but I 'd like to superscript an arbitrary number. Ie say there was such a function Qsup then ideally I 'd do something like this:<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code"><pre class="qt" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><a href="http://qt-project.org/doc/qt-4.8/qstring.html"><span style="">QString</span></a> text<span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;σ&quot;</span> <span style="color: #000000;">+</span> Qsup<span style="color: #000000;">&#40;</span>x<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;</div></li></ol></pre></code><hr />
</div><br />
What would be the best approach? Is it possible to use one of qt formats that employ html tags and convert that to a QString? If so a short example would be appreciated.<br />
<br />
As an aside, it 'd be ideal to load the text data from a file. But I have trouble loading superscript characters from a plain *.txt file (which is what I 'm using now), no matter what encoding I choose. Any hints about that would also be great.<br />
<br />
Thanks.</div>

]]></content:encoded>
			<category domain="http://www.qtcentre.org/forums/4-Newbie">Newbie</category>
			<dc:creator>Durkin</dc:creator>
			<guid isPermaLink="true">http://www.qtcentre.org/threads/54552-Getting-superscript-of-arbitrary-number-to-use-in-a-QString</guid>
		</item>
	</channel>
</rss>
