<HTML>
<HEAD>
<TITLE>Re: [PyQt] QDockWidgetquestion</TITLE>
</HEAD>
<BODY>
<FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>Apologies, I didn&#8217;t see your real question.<BR>
<BR>
&gt; I'm trying to catch mouse event in MainWindow when I click on the<BR>
&gt; QTreeWidget and no success.<BR>
<BR>
You should be able to connect any signal from the tree or toolbox and attach it to the mainwindow. &nbsp;What &#8220;mouse event&#8221; are you trying to capture?<BR>
<BR>
On 12/22/08 10:08 AM, &quot;Iliya Gogolev&quot; &lt;<a href="iliya@realdice.com">iliya@realdice.com</a>&gt; wrote:<BR>
<BR>
</SPAN></FONT><BLOCKQUOTE><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><FONT COLOR="#1F497D">I tried it too. It did not help.<BR>
&nbsp;<BR>
Sorry, I use QToolBox &nbsp;instead QTreeWidget, but there&#8217;s no sense<BR>
&nbsp;<BR>
&nbsp;<BR>
</FONT><BR>
</SPAN></FONT><FONT SIZE="2"><FONT FACE="Tahoma, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:10pt'><B>From:</B> Brian Kelley [<a href="mailto:kelley@eyesopen.com">mailto:kelley@eyesopen.com</a>] <BR>
<B>Sent:</B> Monday, December 22, 2008 5:00 PM<BR>
<B>To:</B> Iliya Gogolev; <a href="pyqt@riverbankcomputing.com">pyqt@riverbankcomputing.com</a><BR>
<B>Subject:</B> Re: [PyQt] QDockWidgetquestion<BR>
</SPAN></FONT></FONT><FONT FACE="Times New Roman"><SPAN STYLE='font-size:12pt'> <BR>
</SPAN></FONT><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>QDockWidgets behave a little different than normal widgets. &nbsp;You need to call &#8220;setWidget&#8221; to place a widget in a dock widget.<BR>
<BR>
<a href="http://doc.trolltech.com/4.4/qdockwidget.html">http://doc.trolltech.com/4.4/qdockwidget.html</a><BR>
<BR>
Try:<BR>
<BR>
CustomDockWidget(QDockWidget):<BR>
&nbsp;&nbsp;def __init__(self,parent):<BR>
&nbsp;&nbsp;&nbsp;&nbsp;QDockWidget.__init__(self, parent)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;self.tree = QTreeWidget(self)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;self.setWidget(self.tree) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>
<BR>
<BR>
On 12/22/08 9:54 AM, &quot;Iliya Gogolev&quot; &lt;<a href="iliya@realdice.com">iliya@realdice.com</a>&gt; wrote:<BR>
Hi everyone!<BR>
<BR>
<BR>
I added QTreeWidget to QDockWidget and then added it to MainWindow by<BR>
addDockWidget function:<BR>
<BR>
&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;<BR>
CustomDockWidget(QDockWidget):<BR>
&nbsp;&nbsp;&nbsp;&nbsp;def __init__(self,parent):<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;QDockWidget.__init__(self, p_parent)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self.tree = QTreeWidget(self)<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.<BR>
<BR>
<BR>
&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;<BR>
<BR>
class MainWindow(QMainWindow):<BR>
&nbsp;&nbsp;&nbsp;&nbsp;def __init__(self, &nbsp;p_parent = None):<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;QMainWindow.__init__(self, &nbsp;p_parent)<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self.customWidget = CustomDockWidget(self)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self.addDockWidget (Qt.LeftDockWidgetArea, self.customWidget)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.<BR>
<BR>
I'm trying to catch mouse event in MainWindow when I click on the<BR>
QTreeWidget and no success.<BR>
<BR>
Any ideas?<BR>
<BR>
Thanks<BR>
<BR>
Internal Virus Database is out-of-date.<BR>
Checked by AVG.<BR>
Version: 7.5.549 / Virus Database: 270.9.10/1814 - Release Date: 11/26/2008<BR>
8:53 PM<BR>
<BR>
<BR>
_______________________________________________<BR>
PyQt mailing list &nbsp;&nbsp;&nbsp;<a href="PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com</a><BR>
<a href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a><BR>
</SPAN></FONT><FONT FACE="Times New Roman"><SPAN STYLE='font-size:12pt'> <BR>
</SPAN><FONT SIZE="2"><SPAN STYLE='font-size:10pt'>Internal Virus Database is out-of-date.<BR>
Checked by AVG.<BR>
Version: 7.5.549 / Virus Database: 270.9.10/1814 - Release Date: 11/26/2008 8:53 PM<BR>
</SPAN></FONT></FONT><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><BR>
<BR>
</SPAN></FONT><SPAN STYLE='font-size:11pt'><FONT FACE="Times New Roman">Internal Virus Database is out-of-date.<BR>
Checked by AVG.<BR>
Version: 7.5.549 / Virus Database: 270.9.10/1814 - Release Date: 11/26/2008 8:53 PM<BR>
</FONT></SPAN><FONT FACE="Times New Roman"><SPAN STYLE='font-size:12pt'> <BR>
</SPAN></FONT><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><BR>
</SPAN></FONT></BLOCKQUOTE>
</BODY>
</HTML>