[Kde-games-devel] Review Request 108606: Add an option to change the row height
Ian Simpson
ian.kdedev at yahoo.com
Sat Feb 9 14:49:03 UTC 2013
> On Feb. 5, 2013, 11:04 p.m., Albert Astals Cid wrote:
> > src/itemdelegate.cpp, line 13
> > <http://git.reviewboard.kde.org/r/108606/diff/3/?file=111031#file111031line13>
> >
> > I understand that not making row 0 bigger makes sense, but i find a bit ugly when i make the rows bigger and somehow there are three rows of different sizes, do you like it much more this way?
I don't mind the smaller empty rows but really only did that to keep it looking like it did before. If the height is set equal to the font size it looks exactly the same as the current version.
The grand total row is a bit different. Because its font is set to pointSize + 5 and you can set a row height that is bigger than that, it can end up smaller than the others. You need to set a fairly big difference for it to be noticable though - like font size 10 and row height 18 or so. As it is highlighted I didn't try to make sure it is always set larger.
> On Feb. 5, 2013, 11:04 p.m., Albert Astals Cid wrote:
> > src/itemdelegate.cpp, line 20
> > <http://git.reviewboard.kde.org/r/108606/diff/3/?file=111031#file111031line20>
> >
> > Haven't tried if it works, but could you try something along this lines
> > QStyleOptionViewItemV4 opt = option;
> > opt.font.setPointSize(m_height);
> > return QItemDelegate::sizeHint(opt, index);
Changing the pointSize doesn't seem to affect the fontMetrics height, which I figure sizeHint actually uses for the cell height. I tried adding
opt.fontMetrics = QFontMetrics(opt.font);
which works at the start of a game. The heights change during the game though, and end up back to the font size.
How about
QFont f(option.font);
f.setPointSize(m_height);
return QSize(0, QFontMetrics(f).height());
The treeview header sets the columns wide enough, so the width is not needed here, right?
- Ian
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/108606/#review26721
-----------------------------------------------------------
On Jan. 29, 2013, 9:25 p.m., Ian Simpson wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/108606/
> -----------------------------------------------------------
>
> (Updated Jan. 29, 2013, 9:25 p.m.)
>
>
> Review request for KDE Games.
>
>
> Description
> -------
>
> Adds a configuration option to set the row height of the tableview.
>
> Would have liked to prevent the height being set smaller than the font size. I tried to figure out how to get hold of the rowHeight spinbox in order to set its minimum value to that of the font size when it was changed, but couldn't. Anyone give me a hint? :-)
>
> Other than that it seems to work OK.
>
>
> This addresses bug 309428.
> http://bugs.kde.org/show_bug.cgi?id=309428
>
>
> Diffs
> -----
>
> src/itemdelegate.h PRE-CREATION
> src/configwidget.cpp 30851ae
> src/configwidget.h e35be7a
> src/configPage.ui 5382a33
> src/CMakeLists.txt 1a0f3a8
> src/itemdelegate.cpp PRE-CREATION
> src/kiriki.h 357b771
> src/kiriki.cpp 4571d8f
> src/kiriki.kcfg 785991a
>
> Diff: http://git.reviewboard.kde.org/r/108606/diff/
>
>
> Testing
> -------
>
> Simply played a few games, changing the font size and row height.
>
>
> Thanks,
>
> Ian Simpson
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-games-devel/attachments/20130209/37fec3d8/attachment.html>
More information about the kde-games-devel
mailing list