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

List:       kde-core-devel
Subject:    QIconView not emitting selectionChanged()
From:       Krzysztof Lichota <krzysiek () lichota ! net>
Date:       2006-08-28 13:54:25
Message-ID: 44F2F591.4020600 () lichota ! net
[Download RAW message or body]

[Attachment #2 (multipart/mixed)]


Reposting to kde-core-devel, as it seems more appropriate list.

While testing my Cbar Konqueror extension I have noticed that multiple
selection of items works in all Konqueror list views, but it doesn't
work in icon views.

I have traced the problem down to QIconView. It does not emit
selectionChanged() signal when selecting items by dragging selection box
around them. It does when selecting by clicking on items.

So, is it a bug in Qt or intended behaviour? If a bug, can we work
around it in KDE by providing right behaviour in KIconView?

I attach simple python app which illustrates the problem. It shows
message box when selectionChanged() is emitted. It does not appear if
the 2 items are selected by dragging selection around them.

BTW. The funny (and counter-intuitive) thing is that when after
selecting these 2 items I click on the background and selection
disappears, the signal is emitted, although from point of view of
receiving app selection has not been changed! I.e step by step:
1. No items selected.
2. Select 2 items by dragging selection around them -> no signal emitted.=

3. Click on icon view background -> selection disappears -> signal emitte=
d.

	Krzysztof Lichota



["testqticonview.py" (text/x-python)]

import sys
from qt import *

class HelloWindow(QMainWindow):

    def __init__(self, *args):
        apply(QMainWindow.__init__, (self,) + args)
        self.iconView=QIconView(self)
        self.setCentralWidget(self.iconView)
        self.iconView.setSelectionMode(QIconView.Extended)
        item = QIconViewItem(self.iconView, "Item 1")
        item2 = QIconViewItem(self.iconView, "Item 2")
        self.connect(
            self.iconView,
            SIGNAL("selectionChanged()"),
            self.selectionChanged
            )
    def selectionChanged(self):
        QMessageBox.information(None, "Selection changed", "Selection changed")

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

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

["signature.asc" (application/pgp-signature)]

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

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