Quantcast
Channel: Jobs
Viewing all articles
Browse latest Browse all 18427

[SOLVED] Text with outline pen failure

$
0
0
I cannot get some simple text to paint with an outline. I wanted red text with a black outline. So I did this: Dialog::Dialog(QWidget *parent) : QDialog(parent), ui(new Ui::Dialog)     {     ui->setupUi(this);     scene = new QGraphicsScene(this);     ui->graphicsView->setScene(scene);       QBrush redbrush(Qt::red);     QPen   blackpen(Qt::black);     blackpen.setWidth(15);     blackpen.setStyle(Qt::SolidLine);       QFont font;     font.setFamily("Times New Roman");     font.setPointSize(200);       txt = new QGraphicsSimpleTextItem();     txt->setText("Hi");     txt->setFont(font);     txt->setPen(blackpen);     txt->setBrush(redbrush);       scene->addItem(txt);     } I get red text as I had wanted, but it does not have a black outline. What else must I do to make this work? If I change the color of the brush, the text will change color appropriately but I cannot get the QPen to paint its border into the scene. Any help would be appreciated. Must I override paint() for this class?

Viewing all articles
Browse latest Browse all 18427

Latest Images

Trending Articles



Latest Images