[PyKDE] Problem finding and showing a record in a QDataBrowser

Jorge Godoy godoy at ieee.org
Sun Aug 7 21:20:15 BST 2005


Hi.


I have created an interface where I have a QDataBrowser and all of its
editing and navigating controls and one of the displayed controls is in a
QSpinBox.

I have the navigation from current to next and previous records working fine
if I only use the data browser controls.  I also can recover the correct
record if I type in a valid code at the spin box.

For the spin box to work, I'm doing this:


    def codAmostra_valueChanged(self, amostra_id):
        cursor = self.dbAmostras.sqlCursor()
        cursor.select('amostra_id=%s' % amostra_id)
        self.dbAmostras.first()
        self.dbAmostras.refresh()


(codAmostra is my spinbox, dbAmostras is my QDataBrowser -- just as a
curiosity, "amostra" is the pt_BR for "sample")

I was willing to use "self.dbAmostras.seek()", but it requires that I know
the exact position of the record -- using it I wouldn't need to filter my
data and I think the problem would be solved... -- but I don't know it. 

There can be "holes" in my sequence (otherwise I'd use only the spinbox) and
I'll be having a few million entries (what makes it impossible to go
through each and every record every time I change the value at the spinbox
manually).

I was reading Qt3 docs trying to find out some other mean to recover the
record I need without messing with the filter because if I use the filter,
then I can't paginate through all records anymore.

Any hints on an alternative approach that would allow me to use both
controls?


* Python 2.4
* SIP 4.1.1 (4.1.1-255)
* >>> qt.qVersion()
  '3.3.4'
  >>>


Thanks in advance,
-- 
Jorge Godoy      <godoy at ieee.org>





More information about the PyQt mailing list