[Kmymoney-devel] Tags update
Alessandro Russo
axela74 at yahoo.it
Tue Oct 16 23:20:56 UTC 2012
Il 16/10/2012 01:28, Alvaro Soliverez ha scritto:
> On Mon, Oct 15, 2012 at 6:10 PM, Alessandro Russo <axela74 at yahoo.it> wrote:
>> Il 15/10/2012 14:42, Alvaro Soliverez ha scritto:
>>> On Mon, Oct 15, 2012 at 9:12 AM, Alessandro Russo <axela74 at yahoo.it>
>>> wrote:
>>>> I wanted to show each tag with a different color (the user can set a
>>>> different color for each tag) but I can't see how to do that...
>>>> Do you know if you can use richtext with QStyle->drawItemText() ?
>>>>
>>> You could use the <qt> tag and then rich text tags for color. Have you
>>> tried that?
>>> _______________________________________________
>> I tried now but doesn't work. I put '<qt><b>test</b></qt>' but it came out
>> like:
>> <qt><b>test</b></qt>
>>
>> Do you now why it's used qstyle->drawItemText() instead of.. i.e. QLabel?
>>
> The code in the register is very old, that might explain it. Can you
> point me to the exact class where you are trying to modify that?
> Personally, I'd rather go with a more flexible widget than a label.
> Something that works better for lists of strings.
>
I'm talking about transaction.cpp: inside the method void
Transaction::paintRegisterCell
...
// the text
// construct the text for the cell
int align = Qt::AlignVCenter;
QString txt;
if (m_transaction != MyMoneyTransaction() && !m_inRegisterEdit) {
registerCellText(txt, align, index.row() - startRow(),
index.column(), painter);
}
// adjust the text rectangle to obtain a reasonable spacing between
the text and the grid
style->drawItemText(painter, option.rect.adjusted(2, 0, -2, 0),
align, option.palette, true, txt, m_selected ? QPalette::HighlightedText
: QPalette::Text);
...
style->drawItemText draw the text for a single row of a cell of the
ledger table. I'm trying to write the tags in the 'category' row.
Best regards,
Alessandro Russo
More information about the KMyMoney-devel
mailing list