QTextStream: use new operator bool() around the code
- After adding the QTextStream::operator bool(), it is not required to check the QTextStream::status(). It is enough to use the reference of stream in the statement, which returns true if stream status is OK. New operator usage makes code more convenient. Task-number: QTBUG-52189 Change-Id: Id9ecaa8a5c9cf1931dbeefa85f9d948d15379a82 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This commit is contained in:
parent
343cc50c22
commit
5525779b2e
@ -1137,7 +1137,7 @@ static bool write_xpm_image(const QImage &sourceImage, QIODevice *device, const
|
|||||||
s << '\"';
|
s << '\"';
|
||||||
}
|
}
|
||||||
s << "};" << Qt::endl;
|
s << "};" << Qt::endl;
|
||||||
return (s.status() == QTextStream::Ok);
|
return static_cast<bool>(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
QXpmHandler::QXpmHandler()
|
QXpmHandler::QXpmHandler()
|
||||||
|
@ -21,9 +21,8 @@ DragWidget::DragWidget(QWidget *parent)
|
|||||||
int x = 5;
|
int x = 5;
|
||||||
int y = 5;
|
int y = 5;
|
||||||
|
|
||||||
while (!inputStream.atEnd()) {
|
QString word;
|
||||||
QString word;
|
while (inputStream >> word) {
|
||||||
inputStream >> word;
|
|
||||||
if (!word.isEmpty()) {
|
if (!word.isEmpty()) {
|
||||||
DragLabel *wordLabel = new DragLabel(word, this);
|
DragLabel *wordLabel = new DragLabel(word, this);
|
||||||
wordLabel->move(x, y);
|
wordLabel->move(x, y);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user