Beispiel #1
0
void QTextFormat::updateStyleFlags()
{
    different = NoFlags;
    if ( !collection || !collection->styleSheet() )
        return;
    QStyleSheetItem *item = collection->styleSheet()->item( style );
    if ( !item )
        return;
    if ( item->color() != col )
        different |= Color;
    if ( item->fontSize() != fn.pointSize() )
        different |= Size;
    if ( item->fontFamily() != fn.family() )
        different |= Family;
    if ( item->fontItalic() != fn.italic() )
        different |= Italic;
    if ( item->fontUnderline() != fn.underline() )
        different |= Underline;
    if ( item->fontWeight() != fn.weight() )
        different |= Bold;
}
Beispiel #2
0
void QTextFormat::updateStyle()
{
    if ( !collection || !collection->styleSheet() )
        return;
    QStyleSheetItem *item = collection->styleSheet()->item( style );
    if ( !item )
        return;
    if ( !( different & Color ) && item->color().isValid() )
        col = item->color();
    if ( !( different & Size ) && item->fontSize() != -1 )
        fn.setPointSize( item->fontSize() );
    if ( !( different & Family ) && !item->fontFamily().isEmpty() )
        fn.setFamily( item->fontFamily() );
    if ( !( different & Bold ) && item->fontWeight() != -1 )
        fn.setWeight( item->fontWeight() );
    if ( !( different & Italic ) && item->definesFontItalic() )
        fn.setItalic( item->fontItalic() );
    if ( !( different & Underline ) && item->definesFontUnderline() )
        fn.setUnderline( item->fontUnderline() );
    generateKey();
    update();

}