![]() |
PyQt noob question : QTextBrowser next screen
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 :D |
Re: PyQt noob question : QTextBrowser next screen
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) :) |
Re: PyQt noob question : QTextBrowser next screen
Thanks for the quick reply !
This seems like a good idea. Actually, I thought about this too :p 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. |
All times are GMT. The time now is 06:10. |
vBulletin® Version 3.8.8