QTextEdit does not show!!!!
Hi again to all!
I have a code:
Code:
void CMerchandizeBrowser
::paintEvent(QPaintEvent* event
) {
Q_UNUSED(event);
painter.
setRenderHint(QPainter::Antialiasing,
false);
painter.
drawImage(QPoint(0,
0), d
->buffer
);
// shows merchandize info: name, price, descriptions
painter.setPen(Qt::white); // sets white pen's color
painter.setBrush(Qt::NoBrush); // sets brush
//p.drawRect(merchandizeDescriptionRect);
painter.
setFont(QFont("Arial",
12));
// sets test font QRectF computedRec
(merchandizeDescriptionRect
);
/*
painter.drawText(computedRec, Qt::AlignLeft, getMerchandizeName(m_ImagesList.at(m_iSelected).text(strKeyImagePathName)));
*/
painter.drawText(computedRec, Qt::AlignLeft, getMerchandizeName(d->slideImages.at(currentSlide()).text(strKeyImagePathName)));
// appends "euro" sing at the end of the price
QString priceString
(getMerchandizePrice
(d
->slideImages.
at(currentSlide
()).
text(strKeyImagePathName
)));
priceString=priceString.append(" EUR");
painter.drawText(computedRec, Qt::AlignRight, priceString);
// shows merchandize description
QTextEdit merchandizeDescription
(getMerchandizeDescription
((qint16
)currentSlide
()),
this);
// new instance of qtextedit merchandizeDescription.show(); // shows constucted text
}
And QTextEdit is not shown? Can someone help me out, please?
Re: QTextEdit does not show!!!!
You create QTextEdit on the stack and it immediately goes out of scope, so you don't have a chance to see it. Also paintEvent() isn't the best place to create widgets.