[PyQt] QDockWidgetquestion

Brian Kelley kelley at eyesopen.com
Mon Dec 22 15:00:14 GMT 2008


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

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


More information about the PyQt mailing list