Printing Support - brainstorm.

Lubomir I. Ivanov neolit123 at gmail.com
Mon Jul 22 12:14:02 PDT 2013


On 22 July 2013 17:12, Lubomir I. Ivanov <neolit123 at gmail.com> wrote:
> On 22 July 2013 17:03, Tomaz Canabrava <tcanabrava at kde.org> wrote:
>> Without trying to read your code yet ( I will ad soon as I'm on lunch break)
>> I think this is a event issue. Correct me if I'm wrong g, but I think you
>> are doing this:
>>
>> You add the header data then check the size of the newly inserted row.
>>
>> *if* you are doing this, then this is the problem.
>>
>> Since the size of the row is in the view, and the data is in the model,
>> when you update the data it doesn't mean that it will update in the view at
>> the same time ( it waits for a paint event or mouse event or something.)  so
>> when you queried for the sizes things were just not ready yet, returning
>> default values (25)
>>
>> You can't "add, query" unfortunately. You can however add, force refresh,
>> query, but this will be slow since it will be generating a new pixmap each
>> time you does that.
>>
>> So, what I would do:
>>
>> 1- get the size of the header
>> 2- get the sizes of each row and save it in a vector.
>>
>> 3 -  Do the math to fill the print pages,
>> 4 - get the actual pixmap data from the table view using the precalculated
>> stuff in 3.
>>
>
> i currently do a (pseudo):
> fillTable(); // inserts one heading on first page and adds rows for all dives
> setModelToTable(); // only now i set the model to the table
> resizeTableColumns(); // resize the table columns to certain px; seems
> quite fast at this point?
>
> // this is missing in the zip, but seems to provide good rowHeight() values
> // TModel::reset()
>
> // obtain row heights...
> // there is no code for page headings yet...but
> MainWindow::addTableHeadingRow(int row) should handle that.
>

here is a working version (attachment)...
headings are now inserted at page starts and page offsets are
calculated correctly.

the stats are:
STATS:
 total_dives: 378
 tableHeight: 21938 px
 n_pages: 20
 page size: QSize(2279, 3308) px
 printer dpi: 300
 elapsed time: 4300 ms

apart from the obvious code cleanup, is this acceptable in terms of
performance and can it be improved further?

lubomir
--
-------------- next part --------------
A non-text attachment was scrubbed...
Name: qt-test.zip
Type: application/zip
Size: 63262 bytes
Desc: not available
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20130722/88f2a4b2/attachment-0001.zip>


More information about the subsurface mailing list