Results 1 to 2 of 2

Thread: Quick PyQt4 connect question

  1. #1

    Default Quick PyQt4 connect question

    I don't have access to my code at the moment, but from memory it goes something like
    Qt Code:
    1. class GLWidget(QGLWidget):
    2. def __init__(self, parent=None):
    3. QGLWidget.__init__(self, QGLFormat(QGL.SampleBuffers), parent)
    4. self.connect(self, SIGNAL('clicked()'), self.test)
    5. def test():
    6. print "wee"
    To copy to clipboard, switch view to plain text mode 

    my main window is simply this widget, the problem is connect doesn't seem to have any effect -- it doesn't complain about anything, it just doesn't do anything. Not sure what the problem is. My understanding is QObject -> QWidget -> QGLWidget, since I inherit from QGLWidget I should be able to use self as the first parameter, am I wrong?

    if you see any syntax errors / typos keep in mind I'm reproducing this from memory, everything executes error free. I can post the actual code when I have a chance.

  2. #2

    Default Re: Quick PyQt4 connect question

    Qt Code:
    1. class GLWidget(QGLWidget):
    2. width = 1024
    3. height = 768
    4. def testing(self):
    5. print "working"
    6. def __init__(self, width, height, parent=None):
    7. QGLWidget.__init__(self, QGLFormat(QGL.SampleBuffers), parent)
    8. self.connect(self, SIGNAL('clicked()'), self.testing)
    9. self.width = width
    10. self.height = height
    To copy to clipboard, switch view to plain text mode 
    Qt Code:
    1. app = QApplication(sys.argv)
    2. test = GLWidget(1024,768)
    3. test.show()
    4. sys.exit(app.exec_())
    To copy to clipboard, switch view to plain text mode 

    There is actual (relevant) code. Runs, displays, no errors, but no connect.

Similar Threads

  1. Quick Bindvalue Question
    By tpf80 in forum Qt Programming
    Replies: 7
    Last Post: 6th February 2009, 21:09
  2. Quick question: infinite double?
    By Raccoon29 in forum Qt Programming
    Replies: 2
    Last Post: 17th October 2008, 15:05
  3. Connect question...
    By McCall in forum Newbie
    Replies: 4
    Last Post: 20th June 2007, 18:19
  4. Quick question regarding abstract classes and DLLs
    By durbrak in forum Qt Programming
    Replies: 1
    Last Post: 8th February 2007, 21:32
  5. quick question on model/view programming
    By locus in forum Qt Programming
    Replies: 1
    Last Post: 2nd February 2007, 10:04

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.