How to reduce row height in table print

Lubomir I. Ivanov neolit123 at gmail.com
Thu Mar 19 15:55:52 PDT 2015


On 19 March 2015 at 18:12, Tomaz Canabrava <tcanabrava at kde.org> wrote:
>
>
> On Thu, Mar 19, 2015 at 10:07 AM, Lubomir I. Ivanov <neolit123 at gmail.com>
> wrote:
>>
>> On 19 March 2015 at 01:28, Lutz Vieweg <lvml at 5t9.de> wrote:
>> > Hi,
>> >
>> > I would like to print more dives per page in "table" mode,
>> > just reducing the number sr=4 in
>> >>
>> >>         const int sr = 12; // smallest row height in pixels
>> >>         profilePrintRowHeights.append(sr);
>> >
>>
>> that's for the table in profile print.
>>
>> > does not help, even if also reducing the model.setFontsize().
>> >
>> > Is there some easy way to tell subsurface to not put that much
>> > margin above/below the table row texts?
>> >
>>
>> that's a good question and i quickly experimented with some code to
>> try to answer it.
>> nothing works for me: CSS, Qt::SizeHintRole, explicit row heights, etc.
>> thus, i don't have an answer ATM, so please wait for the print layout
>> rework which is coming in the next few months.
>>
>> in the meantime if someone has a better idea why QTableView is so
>> stubborn, you can give this a try.
>
>
> you need to create a new QStyledItemDelegate with a different width and pass
> it to QTableView
> it's not hard to do, there are lots of different delegates written for
> subsurface.
> the easier to change is the StarDelegate - just remove the paint method and
> add the sizeHint methods.
>

doesn't work,

the sizeHint() of the delegate is not called. google shows this and
another similar thread:
https://forum.qt.io/topic/5624/solved-my-overloaded-qstyleditemdelegate-sizehint-is-not-called/4

but we have this by default, anyhow:
table.verticalHeader()->setResizeMode(QHeaderView::ResizeToContents);
calling table.resizeRowsToContents() explicitly at any point does not
help, either.

table.setContentsMargins(...), also doesn't work.

there is probably some weird undocumented concurrency of settings. we
should instead focus on the new functionality to come...

lubomir
--


More information about the subsurface mailing list