[PyQt] QDockWidgetquestion

Brian Kelley kelley at eyesopen.com
Mon Dec 22 15:12:49 GMT 2008


Apologies, I didn't see your real question.

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

You should be able to connect any signal from the tree or toolbox and attach it to the mainwindow.  What "mouse event" are you trying to capture?

On 12/22/08 10:08 AM, "Iliya Gogolev" <iliya at realdice.com> wrote:

I tried it too. It did not help.

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



From: Brian Kelley [mailto:kelley at eyesopen.com]
Sent: Monday, December 22, 2008 5:00 PM
To: Iliya Gogolev; pyqt at 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.

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 at 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 at riverbankcomputing.com
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


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20081222/ad20bcfe/attachment-0001.html


More information about the PyQt mailing list