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

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

  <channel>

  
  <title>Qt DevNet forums: Language Bindings 1330758651**  </title>
  <link>http://qt-project.org/forums/viewforum/15/</link>
  <description>RSS feed for latest posts in Language Bindings</description>
  <copyright>Copyright 2013 Qt Project</copyright>
  <docs>http://www.rssboard.org/rss-specification</docs>
  <generator>ExpressionEngine v2.3.1 http://expressionengine.com/</generator>
  <lastBuildDate>Sat, 03 Mar 2012 09:10:51 GMT</lastBuildDate>
  <atom:link href="http://qt-project.org/feeds/all_forums/15" rel="self" type="application/rss+xml" />
  
  
  
        <item>
            <title>how to reflect download progress onto QtableView or QtableWidget ?</title>
            <link>http://qt-project.org/forums/viewthread/27934</link>
            <author>redstoneleo</author>
            <description><![CDATA[I want to make a download tool .I use the following part code for downloading 

	from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.QtNetwork &amp;nbsp;import *
import sys
class DownloadTask&#40;QObject&#41;:
&amp;nbsp; &amp;nbsp; @staticmethod 
&amp;nbsp; &amp;nbsp; def speed&#40;byte&#41;:
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if byte&amp;lt;1024:
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; unit = &amp;quot;B/S&amp;quot;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; elif byte &amp;lt; 1024*1024:
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; byte //= 1024;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; unit = &amp;quot;KB/S&amp;quot;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else :
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;byte//= 1024*1024
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;unit = &amp;quot;MB/S&amp;quot;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return &apos;&#123;&#125; &#123;&#125;&apos;.format&#40;byte,unit&#41;
&amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; def __init__&#40;self, downloadLink&#41;:
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; super&#40;DownloadTask, self&#41;.__init__&#40;&#41;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; self.manager=QNetworkAccessManager &#40;&#41;
# &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;self.bytesReceived = 0
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; self.bytesLastReceived =0
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; self.speedRate=&apos;0 KB/S&apos;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; self.downloadPart=0
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; self.bytesReceived=0
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; url=QUrl&#40;downloadLink&#41;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; self.request=QNetworkRequest &#40;url&#41;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; self.request.setRawHeader&#40;&amp;quot;User&#45;Agent&amp;quot; ,&apos;Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.57 Safari/537.17 SE 2.X MetaSr 1.0&apos;&#41;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; self.currentDownload=self.manager.get&#40;self.request&#41;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; self.downloadTime = QTimer&#40;&#41;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; self.downloadTime.timeout.connect&#40;self.showSpeed&#41;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; self.downloadTime.start&#40;1000&#41;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; fileInfo = QFileInfo&#40;url.path&#40;&#41;&#41;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; fileName = fileInfo.fileName&#40;&#41;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; self.output=QFile&#40;fileName&#41;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; self.output.open&#40;QIODevice.WriteOnly&#41;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; self.progressBar=QProgressBar&#40;&#41;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; self.progressBar.setValue&#40;0&#41;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; self.currentDownload.downloadProgress.connect&#40;self.downloadProgress&#41;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; self.currentDownload.finished.connect&#40;self.downloadFinished&#41;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; self.currentDownload.readyRead.connect&#40;self.downloadReadyRead&#41;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; def downloadProgress&#40;self, bytesReceived, bytesTotal&#41;:
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; self.downloadPart=bytesReceived/bytesTotal#&apos;&#123;:.0%&#125;&apos;.format()
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; self.bytesReceived=bytesReceived
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&amp;nbsp;
# &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;self.__updateInfoLabel()
&amp;nbsp; &amp;nbsp; def showSpeed&#40;self&#41;:
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; self.progressBar.setValue&#40;self.downloadPart&#41;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; br=self.bytesReceived&#45;self.bytesLastReceived 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; self.bytesLastReceived = self.bytesReceived
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; self.speedRate=self.__class__.speed&#40;br&#41;
# &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;print(self.downloadPart, self.speedRate)
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; def downloadFinished&#40;self&#41;:
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print&#40;&apos;done!!!!!&apos;&#41;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; self.output.close&#40;&#41;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; self.currentDownload.deleteLater&#40;&#41;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; startNextDownload();
&amp;nbsp;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; def downloadReadyRead&#40;self&#41;:
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; self.output.write&#40;self.currentDownload.readAll&#40;&#41;&#41;


	now I am facing a problem :I don’t know how to reflect download progress onto QtableView or QtableWidget ?especially downloading 2 or more files at the same time .
for instance ,how to reflect download progress onto this QtableView ?

	http://postimg.org/image/7hr2xewof/

	here is 2 download audio link for test

	http://down.51voa.com/201305/syrian&#45;strife&#45;spilling&#45;over&#45;infecting&#45;region.mp3
http://down.51voa.com/201305/us&#45;military&#45;sex&#45;abuse&#45;problem.mp3

	anyone can give a little sample ? thanks in advance  !!!]]></description>
            <guid isPermaLink="false">998db82b299df849a710e1330063ad56</guid>
            <pubDate>Sun, 19 May 2013 16:57:09 GMT</pubDate>
        </item>
  
        <item>
            <title>QUiLoader not loading layouts from .ui file</title>
            <link>http://qt-project.org/forums/viewthread/27833</link>
            <author>scaron</author>
            <description><![CDATA[I recently posted this on stackoverflow.com but I didn&#8217;t get any response so I am trying here. Original stackoverflow post&#8230;

	http://stackoverflow.com/questions/16492540/quiloader&#45;not&#45;loading&#45;layouts&#45;from&#45;ui&#45;file [stackoverflow.com]

	I have a plugin for an application which provides the ability to use PyQt4 to create widgets which they can use to make their own tools for the application. The QApplication is maintained by a C++ plugin and an &#8216;anchor&#8217; widget is parented to the host application&#8217;s window handle. Then the user can create their own widgets and use this &#8216;anchor&#8217; to be the parent widget. This works very well for PyQt4. Recently, I have been attempting to provide support for PySide and this too is working well right up until I need to create widgets from .ui files. It seems that when I use QUiLoader to load my .ui file the my resulting widget doesn&#8217;t look the same as in PyQt4. It looks as if it is missing or skipping layouts and other properties described in the .ui file, such as the title. Thing is when I log the return value of that load function I get what seems right&#8230;

	&amp;nbsp; &amp;nbsp; class ExampleUiFile&#40;QDialog&#41;:
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; def __init__&#40;self, parent, uifilepath&#41;:
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; QDialog.__init__&#40;self, parent&#41;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # load ui file
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; loader = QUiLoader&#40;self&#41;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; file = QtCore.QFile&#40;uifilepath&#41;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; file.open&#40;QtCore.QFile.ReadOnly&#41;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; self.ui = loader.load&#40;file, self&#41;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; file.close&#40;&#41;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for k,v in vars&#40;self.ui&#41;.items&#40;&#41;:
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print&#40;&amp;quot;%s : %s&amp;quot; % &#40;k,v&#41;&#41;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # connect to the createCube function
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; self.ui.uiCreateCube.clicked.connect&#40;self.createCube&#41;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; def createCube&#40;self&#41;:
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print&#40;self.ui.uiCubeName.text&#40;&#41;&#41;


	Output..

	&amp;nbsp; &amp;nbsp; horizontalLayout : &amp;lt;PySide.QtGui.QHBoxLayout object at 0x0000000023997308&amp;gt;
&amp;nbsp; &amp;nbsp; uiCubeName : &amp;lt;PySide.QtGui.QLineEdit object at 0x0000000023338508&amp;gt;
&amp;nbsp; &amp;nbsp; verticalLayout :&amp;lt;PySide.QtGui.QVBoxLayout object at 0x0000000023997548&amp;gt;
&amp;nbsp; &amp;nbsp; gridLayout : &amp;lt;PySide.QtGui.QGridLayout object at 0x0000000023997E08&amp;gt;
&amp;nbsp; &amp;nbsp; uiCubeLength : &amp;lt;PySide.QtGui.QDoubleSpinBox object at 0x0000000023338808&amp;gt;
&amp;nbsp; &amp;nbsp; uiCreateCube : &amp;lt;PySide.QtGui.QPushButton object at 0x0000000023338988&amp;gt;


	So in an attempt to fix this I went digging, here and elsewhere, and found examples of sub&#45;classing QUiLoader. I was able to copy a simple class which inherits QUiLoader which does some extra work to return the initial base class. This guy seemed to have worked and my dialog looks correct, the correct title is shown, layout, and resizing works. Unfortunately, the garbage collector removes all the widgets that my loader class created and I get message about my object being deleted&#8230;

	&amp;nbsp; &amp;nbsp; class UiLoader&#40;QUiLoader&#41;:
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; def __init__&#40;self, baseinstance&#41;:
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; super&#40;UiLoader, self&#41;.__init__&#40;baseinstance&#41;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; self._baseinstance = baseinstance
&amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; def createWidget&#40;self, classname, parent=None, name=&amp;quot;&amp;quot;&#41;:
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; widget = super&#40;UiLoader, self&#41;.createWidget&#40;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; classname, parent, name&#41;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if parent is None:
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return self._baseinstance
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else:
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; setattr&#40;self._baseinstance, name, widget&#41;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return widget


	Output using new sub&#45;classed loader&#8230;

	&amp;nbsp; &amp;nbsp; Internal C++ object &#40;PySide.QtGui.QLineEdit&#41; already deleted.


	I have done a lot of digging on this issue and some bug in PySide in the past seemed to be the culprit, but I am using PySide 1.1.2 which has it fixed. I even built PySide from source with 1.1.3dev and still the same. I should add that I wasn&#8217;t able to reproduce this sub&#45;classing issue outside of the host application. I was able to make a simple python/PySide example that worked as expected.

	Where do I go from here, where should I look next? I get a good looking ui without the functionality or I get an ugly ui with the functionality. I would prefer not to sub&#45;class the QUiLoader since I am not doing anything fancy with custom widgets or anything.]]></description>
            <guid isPermaLink="false">df55dcc2948db17a6e92eb09a6772540</guid>
            <pubDate>Thu, 16 May 2013 01:53:25 GMT</pubDate>
        </item>
  
        <item>
            <title>I need some help with Jambi</title>
            <link>http://qt-project.org/forums/viewreply/125257</link>
            <author>arcangel.salazar</author>
            <description><![CDATA[This normally happens when the wrong library is loaded. Include only the library for the platformyou use.]]></description>
            <guid isPermaLink="false">d04e93d881f4857ac093798c0b98f85a</guid>
            <pubDate>Tue, 14 May 2013 08:43:41 GMT</pubDate>
        </item>
  
        <item>
            <title>QtWebkit bridge in Qt Jambi</title>
            <link>http://qt-project.org/forums/viewreply/125255</link>
            <author>arcangel.salazar</author>
            <description><![CDATA[Yes, it&#8217;s possible to use qt webkit with jambi.

	You can use something like:

	QWebView expendiosWebView = new QWebView();
expendiosWebView.setUrl(new QUrl(&#8220;classpath:com/nettrace/lotecarng/gui/resources/html/map2.html&#8221;));]]></description>
            <guid isPermaLink="false">07332cc338aca3e65beb8f9b58f48db7</guid>
            <pubDate>Tue, 14 May 2013 08:39:08 GMT</pubDate>
        </item>
  
        <item>
            <title>PySide QImage constructor from buffer doesn&apos;t copy memory</title>
            <link>http://qt-project.org/forums/viewreply/124900</link>
            <author>SGaist</author>
            <description><![CDATA[Hi,

	AFAIK, when you use the constructor variant with the buffer, you must ensure the buffer exists through all the lifetime of the QImage. Check the QImage documentation.]]></description>
            <guid isPermaLink="false">4f5b71db43dcbd9675e648f673970986</guid>
            <pubDate>Fri, 10 May 2013 23:26:08 GMT</pubDate>
        </item>
  
        <item>
            <title>[Solved] QTableView reflected in every tab PyQt</title>
            <link>http://qt-project.org/forums/viewreply/124857</link>
            <author>DisappointedIdealist</author>
            <description><![CDATA[Hey, I am sorry to bother you, but I tried to give everyone a parent, and I think they do?
(from my src code)
def __init__&#40;self, parent=None , **kwargs&#41;: 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; QWidget.__init__&#40;self, parent, **kwargs&#41; 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; layout = QVBoxLayout&#40;self&#41;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; self.lv = snifferView.view&#40;&#41;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; layout.addWidget&#40;self.lv&#41; 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; self.setLayout&#40;layout&#41;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; headers = &#91;&apos;No&apos;,&apos;Source&apos;,&apos;Destination&apos;,&apos;Protocol&apos;&#93;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; self.model = snifferModel.tableModel&#40;headers=headers&#41;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; self.lv.tableView.setModel&#40;self.model&#41;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; self.resultList = &#91;&#93;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; self.hexDump = &apos;&apos;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; self.count = 0
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; self.lv.tableView.selectionModel&#40;&#41;.selectionChanged.connect&#40;self.rowSelected&#41;
&amp;nbsp; &amp;nbsp; &amp;nbsp;]]></description>
            <guid isPermaLink="false">c31efbf6a109c542ddb05656e9a05605</guid>
            <pubDate>Fri, 10 May 2013 16:19:30 GMT</pubDate>
        </item>
  
        <item>
            <title>PySide QImage constructor from buffer doesn&apos;t copy memory</title>
            <link>http://qt-project.org/forums/viewthread/27654</link>
            <author>titusjan</author>
            <description><![CDATA[Hello all

	When I create a QImage from a buffer and then delete the buffer (or the buffer goes out of scope), the QImage object refers to an unreserved piece of memory. This leads to unexpected behavior as illustrated by the program below. The program saves two blue images whereas I would expect &#8220;savedimg1.png&#8221; to be red. 

	I think this is a bug but I thought I&#8217;d ask here first before I submit a bug report. BTW, PyQt4 does save a red and blue image.

	import sys
&amp;nbsp;
if True:
&amp;nbsp; &amp;nbsp; from PySide import QtGui
&amp;nbsp; &amp;nbsp; IMG_FORMAT = QtGui.QImage.Format.Format_RGB32
else:
&amp;nbsp; &amp;nbsp; from PyQt4 import QtGui
&amp;nbsp; &amp;nbsp; IMG_FORMAT = QtGui.QImage.Format_RGB32
&amp;nbsp;
WIDTH = 255
HEIGHT = 128
&amp;nbsp;
def create_buf&#40;r, g, b&#41;:
&amp;nbsp; &amp;nbsp; color = chr&#40;b&#41; + chr&#40;g&#41; + chr&#40;r&#41; + chr&#40;255&#41;
&amp;nbsp; &amp;nbsp; pixels = &amp;nbsp;&#40;WIDTH*HEIGHT&#41; * color
&amp;nbsp; &amp;nbsp; return buffer&#40;pixels&#41;
&amp;nbsp;
app = QtGui.QApplication&#40;sys.argv&#41;
&amp;nbsp;
buf1 = create_buf&#40;255, 0, 0&#41;
img1 = QtGui.QImage&#40;buf1, WIDTH, HEIGHT, IMG_FORMAT&#41; 
print &amp;quot;buf1: &#123;!r&#125;&amp;quot;.format&#40;buf1&#41;
&amp;nbsp;
del buf1 &amp;nbsp;# Removing this line will cause savedimg1.png to be red
&amp;nbsp;
buf2 = create_buf&#40;0, 0, 255&#41;
print &amp;quot;buf2: &#123;!r&#125;&amp;quot;.format&#40;buf2&#41;
img2 = QtGui.QImage&#40;buf2, WIDTH, HEIGHT, IMG_FORMAT&#41; 
&amp;nbsp;
print &amp;quot;img1 buffer: &#123;!r&#125;&amp;quot;.format&#40;img1.constBits&#40;&#41;&#41;
print &amp;quot;img2 buffer: &#123;!r&#125;&amp;quot;.format&#40;img2.constBits&#40;&#41;&#41;
&amp;nbsp;
img1.save&#40;&apos;savedimg1.png&apos;&#41;
img2.save&#40;&apos;savedimg2.png&apos;&#41;]]></description>
            <guid isPermaLink="false">74b8dfc2787f6882c3f13a0aeb39064d</guid>
            <pubDate>Fri, 10 May 2013 16:06:24 GMT</pubDate>
        </item>
  
        <item>
            <title>detect all the network erroneous cases with  Qt</title>
            <link>http://qt-project.org/forums/viewthread/27615</link>
            <author>redstoneleo</author>
            <description><![CDATA[detect all the network erroneous cases with  Qt 

	I want to get Page Source by the following code ,I wonder is it enough  to detect all the network erroneous cases with  the following code  ?
import sys
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from PyQt4.QtNetwork &amp;nbsp;import *
import chardet
&amp;nbsp;
def showSrc&#40;reply&#41;:
&amp;nbsp; &amp;nbsp; redirctLocation=reply.header&#40;QNetworkRequest.LocationHeader&#41;
&amp;nbsp; &amp;nbsp; realUrl=reply.url&#40;&#41; if not redirctLocation else redirctLocation
&amp;nbsp; &amp;nbsp; print&#40;realUrl&#41;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; if &#40;reply.error&#40;&#41;!= QNetworkReply.NoError&#41;:
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print&#40;&apos;11111111&apos;, reply.errorString&#40;&#41;&#41;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return
&amp;nbsp;
&amp;nbsp; &amp;nbsp; content=reply.readAll&#40;&#41;.data&#40;&#41;
&amp;nbsp; &amp;nbsp; if content==b&apos;&apos;:
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print&#40;&apos;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&apos;, &apos;cannot find any resource !&apos;&#41;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return
&amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; charCodec = chardet.detect&#40;content&#41;&#91;&apos;encoding&apos;&#93;
&amp;nbsp; &amp;nbsp; webPageSRC = content.decode&#40;charCodec&#41;
&amp;nbsp; &amp;nbsp; print&#40;webPageSRC &#41;
&amp;nbsp; &amp;nbsp; qApp.quit&#40;&#41;
&amp;nbsp; &amp;nbsp; 
if __name__ == &apos;__main__&apos;:
&amp;nbsp;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; app =QCoreApplication&#40;sys.argv&#41;
&amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; manager=QNetworkAccessManager &#40;&#41;
&amp;nbsp; &amp;nbsp; url =input&#40;&apos;input url :&apos;&#41;
&amp;nbsp;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; request=QNetworkRequest &#40;QUrl.fromEncoded&#40;QUrl.fromUserInput&#40;url&#41;.toEncoded&#40;&#41;&#41;&#41;
&amp;nbsp;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; request.setRawHeader&#40;&amp;quot;User&#45;Agent&amp;quot; ,&apos;Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.57 Safari/537.17 SE 2.X MetaSr 1.0&apos;&#41;
&amp;nbsp; &amp;nbsp; reply=manager.get&#40;request&#41;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; manager.finished.connect&#40;showSrc&#41;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; app.exec&#40;&#41;]]></description>
            <guid isPermaLink="false">7940d6cb1c48ae06f1d6802d2b993331</guid>
            <pubDate>Thu, 09 May 2013 14:58:50 GMT</pubDate>
        </item>
  
        <item>
            <title>[Solved] QTableView reflected in every tab PyQt</title>
            <link>http://qt-project.org/forums/viewthread/27589</link>
            <author>DisappointedIdealist</author>
            <description><![CDATA[Hello! I am using PyQt4/python2.7
I have tabbed windows which contains QTableView. So when I open a new tab I get QTableView in it. When I click on a button to populate the view, it works correctly, however it reflects the result in every other QTableView tab. 
I make sure I made a new instance of the view/Model.
The only way it works correctly, is that I open few tabs but I have to focus on each, like open it. Then it will work on the one i just selected and won&#8217;t reflect result, however if after that I make a new tab, that new tab reflects current result.
I checked, but seems the new Qtableview in the new tabs doesn&#8217;t contain data, even though they reflect it. So I am guessing the problem is with QtableView?
Thanks!]]></description>
            <guid isPermaLink="false">7ec8558eeda436b5cdc88735c320ebb5</guid>
            <pubDate>Wed, 08 May 2013 21:42:53 GMT</pubDate>
        </item>
  
        <item>
            <title>PyQt4: DirectX window</title>
            <link>http://qt-project.org/forums/viewthread/27506</link>
            <author>sepul</author>
            <description><![CDATA[I&#8217;m trying to render into Qt widget using directx (PyQt4), but have problems :
when I create a 3d&#45;view widget as the main window with no parents, rendering is ok :
class w_view&#40;QtGui.QWidget&#41;:
&amp;nbsp;def __init__&#40;self, parent&#41;:
&amp;nbsp; super&#40;w_view, self&#41;.__init__&#40;parent&#41;
&amp;nbsp; self.setAttribute&#40;QtCore.Qt.WA_PaintOnScreen, True&#41;
&amp;nbsp;
&amp;nbsp;def paintEvent&#40;self, pe&#41;:
&amp;nbsp; render&#40;&#41;
&amp;nbsp;
&amp;nbsp;def paintEngine&#40;self&#41;:
&amp;nbsp; return None
&amp;nbsp;
def main&#40;&#41;:
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; app = QtGui.QApplication&#40;sys.argv&#41;
&amp;nbsp;view_wnd = w_view&#40;None&#41;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #setup directx and assign winId() for device 
&amp;nbsp;view_wnd.show&#40;&#41;


	But the problem is where I want to create QMainWindow and put 3d&#45;view widget inside it (as a child window), so I change the main() function to this :
def main&#40;&#41;:
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; app = QtGui.QApplication&#40;sys.argv&#41;
&amp;nbsp;main_wnd = QtGui.QMainWindow&#40;&#41;
&amp;nbsp;main_wnd.setMinimumSize&#40;640, 480&#41;
&amp;nbsp;view_wnd = w_view&#40;main_wnd&#41;
&amp;nbsp;main_wnd.setCentralWidget&#40;view_wnd&#41;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #setup directx and assign winId() for device 
&amp;nbsp;main_wnd.show&#40;&#41;


	3D&#45;view widget renders nothing and turns into empty (NULL) window
And I need to create QMainWindow and put some controls/toolbars/menus/&#8230; around the 3d&#45;view. how can I solve this problem ?

	I&#8217;m using PyQt4.8, Python2.7 and DirectX11 API]]></description>
            <guid isPermaLink="false">5812797da067050237d306f29dc4042e</guid>
            <pubDate>Mon, 06 May 2013 22:14:47 GMT</pubDate>
        </item>
  

  </channel>
</rss>