By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,201 Members | 922 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,201 IT Pros & Developers. It's quick & easy.

PyQt: Problem finding and showing a record in a QDataBrowser

P: n/a
[I've also posted this to pyqt-pykde list, but I haven't got any answers so
far. I also thought that someone here might have solved it or have a
different idea to help me :-) Sorry for those that read it twice. ]
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 <go***@ieee.org>

Aug 8 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Jorge Godoy wrote:
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.


Just to make the answer available to other that might have the same problem,
I had to deactivate the framework code and handle the cursor from the
databrowser manually.

It also fixed a performance problem since I only have one record fetched and
not all of them. This makes the answer time linear (database dependant, of
course) no matter how many records I have on the database.

--
Jorge Godoy <go***@ieee.org>

Aug 10 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.