Reply
Thread Tools
Posts: 17 | Thanked: 8 times | Joined on Jul 2010
#1
Greetings, maemo gurus !

I'm currently trying to learn PyQt, and I'm developing an ebook reader as a learning project. I'm using a QTextBrowser as my display widget (I need to display HTML) and I'd like to create a "scroll forward by one screen" button, so my reader would behave a bit more like FBReader. However, I have no idea how to do this. I figured I could assign a value to the QTextBrowser scrollbars, but I have no clue how to compute the appropriate value since it depends on the widget size, the current position in the text, etc...

Could you give me a few pointers here ? I don't mind searching by myself (it's a learning process after all), but I just don't know where to begin. And I'm not even sure my idea of assigning a value to the scrollbars is a good one to begin with.

Thanks
 
noobmonkey's Avatar
Posts: 3,203 | Thanked: 1,391 times | Joined on Nov 2009 @ Worthing, England
#2
Hiya,

You could look at it from a different perspective, by loading a certain amount of characters into the text browser, (And remove any training parts), and then just use a next button to jump to the next set, starting at the character point that you finshed at?

(Not sure if i entirely understand what you want, so the above was just a guess)
__________________
----------- Follow me on Twitter here
----------- My Photography Website and Blog is here
----------- Author of the N900 Health Check Application ----------- New Version in Extras Devel (Dec 2010 - 2.9.10)
----------- Are you on the N900 World Map? - http://pininthemap.com/maemo - masterpin: shotgun
----------- What apps do you want to see on the n900 or in MeeGo in the future? -
 
Posts: 17 | Thanked: 8 times | Joined on Jul 2010
#3
Thanks for the quick reply !

This seems like a good idea. Actually, I thought about this too However, I see two drawbacks to this :

- I don't know how many characters/lines I should keep since I don't know the size of the QTextBrowser widget. Sure, I could do some trial and error on my N900, but I'd like to keep the application portable if possible, so I can test it and use it on my desktop computer. Besides, the HTML I want to display might contain images, which would certainly mess up any computation based on number of characters.

- If I use this method, I fear that I might break some of the handy built-in features of the QTextBrowser, such as automatic handling of hypertext links. Right now, in my 15-lines-or-so application, I already have a fully working local HTML browser, which is quite amazing.


Bottom line is : I'd prefer a GUI-level solution, if possible, to avoid messing up with the actual text content. But if such a solution does not exist, I will probably end up implementing your trick.
 
Reply


 
Forum Jump


All times are GMT. The time now is 16:41.