[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    [PyKDE] QListBoxItem.isSelected() does not exist
From:       Jeffrey Barish <jeff_barish () earthlink ! net>
Date:       2005-03-30 21:32:20
Message-ID: d2f5r3$1cn$1 () sea ! gmane ! org
[Download RAW message or body]

Here's one that I'm pretty sure is a bug.  In the following complete
code sample, the line that is commented out tests whether the
listboxitem is selected.  However, that line produces an
AttributeError.  The line above it works correctly, but according to
the documentation selected() is obsolete.

import sys
from qt import *

class MainWindow(QMainWindow):
    def __init__(self, *args):
        QMainWindow.__init__(self, *args)

        self.lb = QListBox(self)
        self.setCentralWidget(self.lb)
        QListBoxText(self.lb, "some text")

        lbi = self.lb.firstItem()
        print "lbi.selected() = ", lbi.selected()
##        print "lbi.isSelected() = ", lbi.isSelected() # AttributeError

        print QListBoxText.__bases__[0].__dict__.get('isSelected') # the
base
        # is QListBoxItem, and 'isSelected' does not appear in its
__dict__
        # even though documentation indicates that it is a public
member.

def main(args):
    app = QApplication(args)
    win = MainWindow()
    app.setMainWidget(win)
    win.show()
    app.connect(app, SIGNAL("lastWindowClosed()"), app, SLOT("quit()"))
    app.exec_loop()

if __name__ == "__main__":
    main(sys.argv)

-- 
Jeffrey Barish

_______________________________________________
PyKDE mailing list    PyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic