PyQt: Problem finding and showing a record in a QDataBrowser

Discussion in 'Python' started by Jorge Godoy, Aug 8, 2005.

  1. Jorge Godoy

    Jorge Godoy Guest

    [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 <>
     
    Jorge Godoy, Aug 8, 2005
    #1
    1. Advertising

  2. Jorge Godoy

    Jorge Godoy Guest

    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 <>
     
    Jorge Godoy, Aug 10, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ray Booysen
    Replies:
    2
    Views:
    658
    Ray Booysen
    Mar 28, 2006
  2. ulysses
    Replies:
    4
    Views:
    800
    Werner Schiendl
    Oct 22, 2003
  3. Mike N.
    Replies:
    0
    Views:
    530
    Mike N.
    Jul 31, 2008
  4. Mike N.
    Replies:
    0
    Views:
    659
    Mike N.
    Jul 31, 2008
  5. David
    Replies:
    3
    Views:
    122
    David Gordon
    Aug 4, 2004
Loading...

Share This Page