[PyQt] QDockWidgetquestion

Iliya Gogolev iliya at realdice.com
Mon Dec 22 16:16:33 GMT 2008


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 at riverbankcomputing.com
[mailto:pyqt-bounces at riverbankcomputing.com] On Behalf Of piotr malinski
Sent: Monday, December 22, 2008 5:38 PM
To: pyqt at 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 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
 

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

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
 



More information about the PyQt mailing list