• May 17, 2024, 03:57:38 pm

Author Topic: Threading a ListView  (Read 3113 times)

0 Members and 1 Guest are viewing this topic.

Offline msirapian

  • Full Member
  • ***
  • Posts: 100
  • Reputation: 12
  • Symbian Power User - Symbian and my N8 rule!
Threading a ListView
« on: August 30, 2012, 02:01:20 pm »
Hi

I'm stalling in my app development because I need to asynchronize a synchrone process, which is : retrieve items from a SQLite database and display them. When ordering/filtering them, ideally, a thread should request a query from the database, and lazily fill a listview to avoid a GUI irresponsiveness (which is my problem).

Are there any Qt/QML developers here to help me?

thanks

Offline Allstar12345

  • Allstar Software Founder
  • Administrator
  • Forum Genius
  • ******
  • Posts: 5,235
  • Reputation: 812
    • Allstar Software
  • Current Phone: : OnePlus 8 Pro, Xperia 10, Nexus 6p, Jolla Phone, Nokia N8, Nokia 808 PureView, BlackBerry Z30
Re: Threading a ListView
« Reply #1 on: August 30, 2012, 04:02:15 pm »
our user dracodragon asked me to tell you to learn WorkerScript element in QML for multithreading requests.

Offline msirapian

  • Full Member
  • ***
  • Posts: 100
  • Reputation: 12
  • Symbian Power User - Symbian and my N8 rule!
Re: Threading a ListView
« Reply #2 on: August 30, 2012, 05:56:51 pm »
our user dracodragon asked me to tell you to learn WorkerScript element in QML for multithreading requests.

Thanks for the advice, but it is not enough. WorkerScript will use js, and it's too resource/time consuming.

The threading will have to be implemented in Qt/C++, I guess. My SQL code is already in Qt/C++, and gosh!, it's a lot faster than in QML/javascript.

I think the way is to write my own QAbstractTableModel, to fill it with a qsqlrecord, to use signals and slots between the worker thread and the (gui) main thread, but I don't understand how to implement it.

dracodragon

  • Guest
Re: Threading a ListView
« Reply #3 on: August 30, 2012, 07:35:56 pm »
thats why i said workerscript. easy and perfect. multithreading wil keep the ui active too
« Last Edit: August 30, 2012, 07:37:47 pm by dracodragon »

dracodragon

  • Guest
Re: Threading a ListView
« Reply #4 on: August 30, 2012, 07:41:15 pm »
you can also see this for interfacing between qml and C++. hard but definitely better
http://doc.qt.nokia.com/4.7-snapshot/qtbinding.html

Offline msirapian

  • Full Member
  • ***
  • Posts: 100
  • Reputation: 12
  • Symbian Power User - Symbian and my N8 rule!
Re: Threading a ListView
« Reply #5 on: August 30, 2012, 07:57:27 pm »
thats why i said workerscript. easy and perfect. multithreading wil keep the ui active too

Nope I've tried, and js is too slow to handle my 1000+ rows x 40 columns table ;)

I think that the qabstract* track is the good one, I've found a couple of articles that I now have to read, understand, and apply to my case.

Offline MoritzJT

  • Developer
  • New Member
  • ****
  • Posts: 16
  • Reputation: 1
  • Symbian Power User
  • Current Phone: : N95-1, N8-00, N900, N9, 808
Re: Threading a ListView
« Reply #6 on: August 01, 2013, 09:28:57 pm »
Hey Massis, what're you cooking up? :D Any public project here?

Offline Allstar12345

  • Allstar Software Founder
  • Administrator
  • Forum Genius
  • ******
  • Posts: 5,235
  • Reputation: 812
    • Allstar Software
  • Current Phone: : OnePlus 8 Pro, Xperia 10, Nexus 6p, Jolla Phone, Nokia N8, Nokia 808 PureView, BlackBerry Z30
Re: Threading a ListView
« Reply #7 on: August 02, 2013, 03:25:59 am »
Hey Massis, what're you cooking up? :D Any public project here?
Year old topic mate ;)

Offline msirapian

  • Full Member
  • ***
  • Posts: 100
  • Reputation: 12
  • Symbian Power User - Symbian and my N8 rule!
Re: Threading a ListView
« Reply #8 on: September 09, 2013, 07:43:25 pm »
I have started to write a geocaching application. But I have to admit I have forgotten it, as it became too complicated.

What I've done so far :
1. Import GPX file (containing caches) with a filebrowser
2. DB handled as a SQL database,
3. Browse, filter, search in the db
4. A description of the cache with its location.

Looks really cool, BUT, when I search the list (sending a query to the sql db), it takes so much time.

So I was thinking I should start from sratch, but writing the compass part. For instance, just a POI manager (as we had in S60v5), with a compass (direction/distance to selected POI).

The pb is that it involves Qt and I should really use my device to test (not sure the simulator would help here to simulate a POI local db). And it doesn't work at office (I need the admin rights for the Symbian chains, no access to RDA).

So without giving up, the pace of the project is just really really slow  :(