[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    RE: [PyQt] QDockWidgetquestion
From:       "Iliya Gogolev" <iliya () realdice ! com>
Date:       2008-12-22 17:34:25
Message-ID: 004201c9645b$8a1fa120$9e5ee360$ () com
[Download RAW message or body]

This is a multipart message in MIME format.

[Attachment #2 (multipart/alternative)]
This is a multipart message in MIME format.


Cool. I added and modified your code to my main window and catch the Close event \
type. Will try later on dock widgets. Thanks.

 

From: Brian Kelley [mailto:kelley@eyesopen.com] 
Sent: Monday, December 22, 2008 6:22 PM
To: Iliya Gogolev; piotr maliński; pyqt@riverbankcomputing.com
Subject: Re: [PyQt] QDockWidgetquestion

 

If you want to catch mouse events in a parent, you should install or override an \
eventFilter.

For example, here is an eventFilter I use on my main window to catch close events.  \
You can catch mouse events or others in this way.  "obj" is the object receiving the \
event and "event" is the event being received.  Note that doing it this way is \
tricky.  You may be better off making your own subclasses for all your widgets that \
can communicate to the mainwindow.

    def eventFilter(self, obj, event):
        controller = self.controller
        if obj == self.mw and event.type() == QEvent.Close:
            if controller and controller.db.ProcessesRunning():
                opt = QtGui.QMessageBox.question(self.mw,
                                                 "Running Workflows",
                                                 "There are workflows still running, \
                would you like to save these?\n"
                                                 "(Saved workflows will restart when \
                the throughput is run again.)",
                                                 QtGui.QMessageBox.Save | \
QtGui.QMessageBox.Discard |  QtGui.QMessageBox.Cancel)
                if opt == QtGui.QMessageBox.Cancel:
                    event.setAccepted(False)
                    return True

                self.controller.db.disconnect()
                self.controller.db.KillRunningProcesses()
                if res == QtGui.QMessageBox.Discard:
                    self.controller.db.ClearRunningProcesses()

        return QObject.eventFilter(self, obj, event)



On 12/22/08 11:16 AM, "Iliya Gogolev" <iliya@realdice.com> wrote:

Yes, you are right. But I did it for checking if i can catch the event :) I
added mousePressEvent & mouse ReleaseEvent:

    def mouseMoveEvent (self, p_event) :
        print "CustomDockWidget mouseMoveEvent"
        event.ignore()

    def mouseReleaseEvent(self, event) :
        print " CustomDockWidget  mouseReleaseEvent"
        event.ignore()

I also added the output(or breakpoint) and it did not work :) Actually I
want to catch the mouse move event in the parent - QMainWindow, when the
left mouse button pressed.
I want to make something similar to Widget Box of Qt Designer(left docked
side). For example, when user wants to add a button to a canvas, he select
it, the button layout is shown and then user can drag and drop it to the
canvas.
I think the way to implement it is: when one of the buttons of Widget Box
was selected (by pressing left mouse button and it's still pressed), cache
the mouse event in MainWindow and change a position of button layout entity.




-----Original Message-----
From: pyqt-bounces@riverbankcomputing.com
[HYPERLINK "mailto:pyqt-bounces@riverbankcomputing.com"mailto:pyqt-bounces@riverbankcomputing.com] \
                On Behalf Of piotr malinski
Sent: Monday, December 22, 2008 5:38 PM
To: pyqt@riverbankcomputing.com
Subject: Re: [PyQt] QDockWidgetquestion

If you want to catch mouse events that happen on the docked widget
then yout CustomDockWidget must have such methods (def
mouseSomethingEvent(self, event)).
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
HYPERLINK "http://www.riverbankcomputing.com/mailman/listinfo/pyqt"http://www.riverbankcomputing.com/mailman/listinfo/pyqt



--
Internal Virus Database is out-of-date.
Checked by AVG.
Version: 7.5.549 / Virus Database: 270.9.10/1814 - Release Date: 11/26/2008
8:53 PM


Internal Virus Database is out-of-date.
Checked by AVG.
Version: 7.5.549 / Virus Database: 270.9.10/1814 - Release Date: 11/26/2008
8:53 PM


I tried it too. It did not help.

Sorry, I use QToolBox  instead QTreeWidget, but there's no sense


From: Brian Kelley [HYPERLINK "mailto:kelley@eyesopen.com"mailto:kelley@eyesopen.com]
Sent: Monday, December 22, 2008 5:00 PM
To: Iliya Gogolev; pyqt@riverbankcomputing.com
Subject: Re: [PyQt] QDockWidgetquestion

QDockWidgets behave a little different than normal widgets.  You need to
call "setWidget" to place a widget in a dock widget.

HYPERLINK "http://doc.trolltech.com/4.4/qdockwidget.html"http://doc.trolltech.com/4.4/qdockwidget.html


Try:

CustomDockWidget(QDockWidget):
  def __init__(self,parent):
    QDockWidget.__init__(self, parent)
    self.tree = QTreeWidget(self)
    self.setWidget(self.tree)


On 12/22/08 9:54 AM, "Iliya Gogolev" <iliya@realdice.com> wrote:
Hi everyone!


I added QTreeWidget to QDockWidget and then added it to MainWindow by
addDockWidget function:

"""""""""""""""""""""""""""""""""""""""""""
CustomDockWidget(QDockWidget):
    def __init__(self,parent):
        QDockWidget.__init__(self, p_parent)
        self.tree = QTreeWidget(self)

                .
                .
                        .


"""""""""""""""""""""""""""""""""""""""""""

class MainWindow(QMainWindow):
    def __init__(self,  p_parent = None):
        QMainWindow.__init__(self,  p_parent)

          self.customWidget = CustomDockWidget(self)
        self.addDockWidget (Qt.LeftDockWidgetArea, self.customWidget)
                .
                .
                        .

I'm trying to catch mouse event in MainWindow when I click on the
QTreeWidget and no success.

Any ideas?

Thanks

Internal Virus Database is out-of-date.
Checked by AVG.
Version: 7.5.549 / Virus Database: 270.9.10/1814 - Release Date: 11/26/2008
8:53 PM


_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
HYPERLINK "http://www.riverbankcomputing.com/mailman/listinfo/pyqt"http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Internal Virus Database is out-of-date.
Checked by AVG.
Version: 7.5.549 / Virus Database: 270.9.10/1814 - Release Date: 11/26/2008
8:53 PM

Internal Virus Database is out-of-date.
Checked by AVG.
Version: 7.5.549 / Virus Database: 270.9.10/1814 - Release Date: 11/26/2008
8:53 PM

Internal Virus Database is out-of-date.
Checked by AVG.
Version: 7.5.549 / Virus Database: 270.9.10/1814 - Release Date: 11/26/2008
8:53 PM


_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
HYPERLINK "http://www.riverbankcomputing.com/mailman/listinfo/pyqt"http://www.riverbankcomputing.com/mailman/listinfo/pyqt


 

Internal Virus Database is out-of-date.
Checked by AVG.
Version: 7.5.549 / Virus Database: 270.9.10/1814 - Release Date: 11/26/2008 8:53 PM


Internal Virus Database is out-of-date.
Checked by AVG. 
Version: 7.5.549 / Virus Database: 270.9.10/1814 - Release Date: 11/26/2008 8:53 PM
 


[Attachment #5 (text/html)]

<html xmlns:v="urn:schemas-microsoft-com:vml" \
xmlns:o="urn:schemas-microsoft-com:office:office" \
xmlns:w="urn:schemas-microsoft-com:office:word" \
xmlns:x="urn:schemas-microsoft-com:office:excel" \
xmlns:p="urn:schemas-microsoft-com:office:powerpoint" \
xmlns:a="urn:schemas-microsoft-com:office:access" \
xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" \
xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" \
xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema" \
xmlns:b="urn:schemas-microsoft-com:office:publisher" \
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" \
xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet" \
xmlns:odc="urn:schemas-microsoft-com:office:odc" \
xmlns:oa="urn:schemas-microsoft-com:office:activation" \
xmlns:html="http://www.w3.org/TR/REC-html40" \
xmlns:q="http://schemas.xmlsoap.org/soap/envelope/" xmlns:D="DAV:" \
xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml" \
xmlns:ois="http://schemas.microsoft.com/sharepoint/soap/ois/" \
xmlns:dir="http://schemas.microsoft.com/sharepoint/soap/directory/" \
xmlns:ds="http://www.w3.org/2000/09/xmldsig#" \
xmlns:dsp="http://schemas.microsoft.com/sharepoint/dsp" \
xmlns:udc="http://schemas.microsoft.com/data/udc" \
xmlns:xsd="http://www.w3.org/2001/XMLSchema" \
xmlns:sub="http://schemas.microsoft.com/sharepoint/soap/2002/1/alerts/" \
xmlns:ec="http://www.w3.org/2001/04/xmlenc#" \
xmlns:sp="http://schemas.microsoft.com/sharepoint/" \
xmlns:sps="http://schemas.microsoft.com/sharepoint/soap/" \
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" \
xmlns:udcxf="http://schemas.microsoft.com/data/udc/xmlfile" \
xmlns:wf="http://schemas.microsoft.com/sharepoint/soap/workflow/" \
xmlns:mver="http://schemas.openxmlformats.org/markup-compatibility/2006" \
xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" \
xmlns:mrels="http://schemas.openxmlformats.org/package/2006/relationships" \
xmlns:ex12t="http://schemas.microsoft.com/exchange/services/2006/types" \
xmlns:ex12m="http://schemas.microsoft.com/exchange/services/2006/messages" \
xmlns:Z="urn:schemas-microsoft-com:" xmlns:st="&#1;" \
xmlns="http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">


<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<title>Re: [PyQt] QDockWidgetquestion</title>
<style>
<!--
 /* Font Definitions */
 @font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
	{font-family:Tahoma;
	panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:purple;
	text-decoration:underline;}
p
	{mso-style-priority:99;
	mso-margin-top-alt:auto;
	margin-right:0in;
	mso-margin-bottom-alt:auto;
	margin-left:0in;
	font-size:12.0pt;
	font-family:"Times New Roman","serif";}
span.EmailStyle18
	{mso-style-type:personal-reply;
	font-family:"Calibri","sans-serif";
	color:#1F497D;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-size:10.0pt;}
@page Section1
	{size:8.5in 11.0in;
	margin:56.7pt 42.5pt 56.7pt 85.05pt;}
div.Section1
	{page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=EN-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Cool. I added and modified your code to my main window and catch
the Close event type. Will try later on dock widgets. Thanks.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<div>

<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>

<p class=MsoNormal><b><span \
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span \
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Brian Kelley \
[mailto:kelley@eyesopen.com] <br> <b>Sent:</b> Monday, December 22, 2008 6:22 PM<br>
<b>To:</b> Iliya Gogolev; piotr maliński; pyqt@riverbankcomputing.com<br>
<b>Subject:</b> Re: [PyQt] QDockWidgetquestion<o:p></o:p></span></p>

</div>

</div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal style='margin-bottom:12.0pt'><span style='font-size:11.0pt;
font-family:"Calibri","sans-serif"'>If you want to catch mouse events in a
parent, you should install or override an eventFilter.<br>
<br>
For example, here is an eventFilter I use on my main window to catch close
events. &nbsp;You can catch mouse events or others in this way. &nbsp;"obj" is
the object receiving the event and "event" is the event being received.
&nbsp;Note that doing it this way is tricky. &nbsp;You may be better off making
your own subclasses for all your widgets that can communicate to the
mainwindow.<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;def eventFilter(self, obj, event):<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;controller = self.controller<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if obj == self.mw and
event.type() == QEvent.Close:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if
controller and controller.db.ProcessesRunning():<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;opt
 = QtGui.QMessageBox.question(self.mw,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n \
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs \
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;Running
 Workflows&quot;,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n \
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs \
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;There
 are workflows still running, would you like to save these?\n&quot;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n \
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs \
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;(Saved
 workflows will restart when the throughput is run again.)&quot;,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n \
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs \
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;QtGui.QMessageBox.Save
 | QtGui.QMessageBox.Discard |<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n \
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs \
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;QtGui.QMessageBox.Cancel)<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if
 opt == QtGui.QMessageBox.Cancel:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;event.setAccepted(False)<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return
 True<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self.controller.db.disconnect()<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self.controller.db.KillRunningProcesses()<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if
 res == QtGui.QMessageBox.Discard:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self.controller.db.ClearRunningProcesses()<br>
 <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return
QObject.eventFilter(self, obj, event)<br>
<br>
<br>
<br>
On 12/22/08 11:16 AM, &quot;Iliya Gogolev&quot; &lt;<a \
href="iliya@realdice.com">iliya@realdice.com</a>&gt; wrote:</span><o:p></o:p></p>

<p class=MsoNormal style='margin-bottom:12.0pt'><span style='font-size:11.0pt;
font-family:"Calibri","sans-serif"'>Yes, you are right. But I did it for
checking if i can catch the event :) I<br>
added mousePressEvent &amp; mouse ReleaseEvent:<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;def mouseMoveEvent (self, p_event) :<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print &quot;CustomDockWidget
mouseMoveEvent&quot;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;event.ignore()<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;def mouseReleaseEvent(self, event) :<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print &quot; CustomDockWidget
&nbsp;mouseReleaseEvent&quot;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;event.ignore()<br>
<br>
I also added the output(or breakpoint) and it did not work :) Actually I<br>
want to catch the mouse move event in the parent - QMainWindow, when the<br>
left mouse button pressed.<br>
I want to make something similar to Widget Box of Qt Designer(left docked<br>
side). For example, when user wants to add a button to a canvas, he select<br>
it, the button layout is shown and then user can drag and drop it to the<br>
canvas.<br>
I think the way to implement it is: when one of the buttons of Widget Box<br>
was selected (by pressing left mouse button and it's still pressed), cache<br>
the mouse event in MainWindow and change a position of button layout entity.<br>
<br>
<br>
<br>
<br>
-----Original Message-----<br>
From: <a href="pyqt-bounces@riverbankcomputing.com">pyqt-bounces@riverbankcomputing.com</a><br>
 [<a href="mailto:pyqt-bounces@riverbankcomputing.com">mailto:pyqt-bounces@riverbankcomputing.com</a>]
 On Behalf Of piotr malinski<br>
Sent: Monday, December 22, 2008 5:38 PM<br>
To: <a href="pyqt@riverbankcomputing.com">pyqt@riverbankcomputing.com</a><br>
Subject: Re: [PyQt] QDockWidgetquestion<br>
<br>
If you want to catch mouse events that happen on the docked widget<br>
then yout CustomDockWidget must have such methods (def<br>
mouseSomethingEvent(self, event)).<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>
 <br>
<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>
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>
I tried it too. It did not help.<br>
<br>
Sorry, I use QToolBox &nbsp;instead QTreeWidget, but there's no sense<br>
<br>
<br>
From: Brian Kelley [<a \
                href="mailto:kelley@eyesopen.com">mailto:kelley@eyesopen.com</a>]<br>
Sent: Monday, December 22, 2008 5:00 PM<br>
To: Iliya Gogolev; <a \
                href="pyqt@riverbankcomputing.com">pyqt@riverbankcomputing.com</a><br>
                
Subject: Re: [PyQt] QDockWidgetquestion<br>
<br>
QDockWidgets behave a little different than normal widgets. &nbsp;You need to<br>
call &quot;setWidget&quot; 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)<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;&q \
uot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quo \
t;&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;&q \
uot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quo \
t;&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>
 <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>
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>
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></span><o:p></o:p></p>


<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p><span style='font-size:10.0pt'>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</span><o:p></o:p></p>

</div>

</body>

</html>
<BR>

<P><FONT SIZE=2>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> </P>



_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic