QGraphicsSimpleTextItem under Qt 5.0 no longer draws outline

  • Hello all,

    I have a simple desktop app under Qt that started as a 4.8 project and has been ported to 5.0 however upon doing so the QGraphicsSimpleTextItem class now seems to function differently. I have searched to find references to this problem to no avail. It is a fairly vanilla example and I cannot see what I have done wrong. I am certain it will be painfully obvious when someone points out the error in my attempt. Many thanks in advance for any kind help you might offer and for your time. I include a code fragment for clarity.

    this->activeText = new QGraphicsSimpleTextItem( this->text );
    if ( this->activeText != null )
    this->font.setFamily( this->fontName );
    this->font.setPointSize( this->pointSize );
    this->activeText->setFont( this->font );
    if( tst( color ) )
    this->activeText->setBrush( QBrush( QColor( this->color ) ) );
    if( tst( generic ) )
    QPen pen;
    pen.setWidth( this->width );
    pen.setColor( this->generic );
    this->activeText->setPen( pen );

            // preset all its parameters.
            SetUpParams( *this->activeText );
            // set the location to be displayed.
            if ( tst( startingLoc ) )
                this->activeText->setPos( this->startingLoc );
                SnxScene->addItem( this->activeText );
            // mark this event as completed
            mark( Completed );


    A few notes, all if's will evaluate to true and thus execute their clauses, and the end result is that the text will paint perfectly into the scene but it will not show an outline. I have not overridden the paint function. This yields red text and should have a black outline, but the outline is suppressed in 5.0, but it appears quite normally in 4.8. Yes I did single step through with the debugger and it appears to execute normally. Font changes and base color changes all work properly. ONLY the outline (QPen portion) seems to fail now. I have not reported this as a bug as I am fairly certain the bug is mine.....

    thanks again,

  • Anyone have any thoughts on how I can solve this? Any changes I could make to help illuminate/identify the problem?

  • I'm having this problem myself, using the same method in 5.0.0.

  • I have the same problem in Qt 5.2.
    In Qt 4.8, it works fine.
    Is this issue already posted on bugtracker?

  • Hooray, it seems that this issue is fixed in Qt 5.3.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.