Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Zetcode tutorial vs what works for me. Version difference?
Forum Updated to NodeBB v4.3 + New Features

Zetcode tutorial vs what works for me. Version difference?

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 1.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    SatelliteEyes
    wrote on last edited by
    #1

    Hi, I am very very new to PyQt and I'm using version 4.4.4 on Windows 7 (editing in emacs on UNIX). I am currently going through Zetcode's great tutorial. There is one inconsistency that threw me for a major loop and I'm interested in knowing if it's due to a version difference between what I'm using and what they used, or if I'm just doing something wrong.

    Relevant excerpt from Zetcode:

    @ class Example(QtGui.QWidget):
    def init(self):
    super(Example,self).init()
    self.initUI()
    def initUI(self):
    qbtn = QtGui.QPushButton('Quit',self)
    qbtn.clicked.connect(QtCore.QCoreApplication.instance().quit)
    ...@

    When I run this code I get AttributeError: clicked

    What works for me:

    @ class Example(QtGui.QWidget):
    def init(self):
    super(Example,self).init()
    self.initUI()
    def initUI(self):
    qbtn = QtGui.QPushButton('Quit',self)
    qbtn.connect(qbtn,QtCore.SIGNAL("clicked()"),QtGui.qApp,QtCore.SLOT("quit()")
    ...@

    Why is it that I have to explicitly state the sender, signal, receiver and slot? The way Zetcode's code works makes sense to me and is more elegant. I have the same problem when trying to use triggered() for an exit function in a menu bar. And I can fix it in an analogous way.

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved