Esempio n. 1
0
void CompletionItem::setupParagraph() {
    if ( !parag ) {
	Q3TextFormatter *formatter;
	formatter = new Q3TextFormatterBreakWords;
	formatter->setWrapEnabled( false );
	parag = new Q3TextParagraph( 0 );
	parag->setTabStops( listBox()->fontMetrics().width( QString::fromLatin1("propertyXXXX") ) );
	parag->pseudoDocument()->pFormatter = formatter;
	parag->insert( 0, " " + type + ( type.isEmpty() ? " " : "\t" ) + prefix +
		       Q3ListBoxItem::text() + postfix + postfix2 );
	bool selCol = isSelected() && listBox()->palette().highlightedText() != listBox()->palette().text();
	QColor sc = selCol ? listBox()->palette().highlightedText().color() : getColor( type );
	Q3TextFormat *f1 = parag->formatCollection()->format( listBox()->font(), sc );
	Q3TextFormat *f3 = parag->formatCollection()->format( listBox()->font(), isSelected() ?
							     listBox()->palette().highlightedText().color() :
							     listBox()->palette().text().color() );
	QFont f( listBox()->font() );
	f.setBold( true );
	Q3TextFormat *f2 =
	    parag->formatCollection()->format( f, isSelected() ? listBox()->palette().highlightedText().color() :
					       listBox()->palette().text().color() );
	parag->setFormat( 1, type.length() + 1, f1 );
	parag->setFormat( type.length() + 2, prefix.length() + Q3ListBoxItem::text().length(), f2 );
	if ( !postfix.isEmpty() )
	    parag->setFormat( type.length() + 2 + prefix.length() + Q3ListBoxItem::text().length(),
			      postfix.length(), f3 );
	parag->setFormat( type.length() + 2 + prefix.length() + Q3ListBoxItem::text().length() + postfix.length(),
			  postfix2.length(), f3 );
	f1->removeRef();
	f2->removeRef();
	f3->removeRef();
	parag->format();
    }
}
Esempio n. 2
0
void QSAEditor::doRecalc()
{
    document()->invalidate();
    Q3TextParagraph *p = document()->firstParagraph();
    while ( p ) {
	p->format();
	p = p->next();
    }
    ensureCursorVisible();
    repaintContents( false );
}
Esempio n. 3
0
void QEditor::refresh()
{
	getDocument()->invalidate();
    Q3TextParagraph* p = getDocument()->firstParagraph();
    while( p ){
        p->format();
	p = p->next();
    }
    getDocument()->removeSelection( ParenMatcher::Match );
    getDocument()->removeSelection( ParenMatcher::Mismatch );
    ensureCursorVisible();
    repaintContents( false );
}