Commit d32ad81a authored by Oswald Buddenhagen's avatar Oswald Buddenhagen
Browse files

use QFile::open()'s return value instead of using weird isOpen() checks

parent 2f1993e4
......@@ -443,8 +443,7 @@ public:
else
fileName = (_styleSheetFile.toLocalFile());
QFile file(fileName);
file.open(QIODevice::ReadOnly);
if (file.isOpen()) {
if (file.open(QIODevice::ReadOnly)) {
QString styleSheet(file.readAll());
q->setStyleSheet(styleSheet);
} else {
......@@ -634,8 +633,7 @@ private:
}
QFile file(path);
file.open(QIODevice::ReadOnly);
if (file.exists() && file.isOpen()) {
if (file.open(QIODevice::ReadOnly)) {
QPixmap pixmap(path);
if (pixmap.isNull())
qWarning() << QLatin1String("setIconFromFile: ") << url << QLatin1String(" not found!");
......@@ -700,8 +698,7 @@ private:
}
QFile file(path);
file.open(QIODevice::ReadOnly);
if (file.exists() && file.isOpen()) {
if (file.open(QIODevice::ReadOnly)) {
QPixmap pixmap(path);
if (pixmap.isNull())
qWarning() << QLatin1String("setIconFromFile: ") << url << QLatin1String(" not found!");
......@@ -773,8 +770,7 @@ private:
}
QFile file(path);
file.open(QIODevice::ReadOnly);
if (file.exists() && file.isOpen()) {
if (file.open(QIODevice::ReadOnly)) {
QPixmap pixmap(path);
if (pixmap.isNull())
qWarning() << QLatin1String("setIconFromFile: ") << url << QLatin1String(" not found!");
......
......@@ -94,8 +94,7 @@ LayoutWidget::~LayoutWidget()
{
if (url.scheme() == QLatin1String("file")) {
QFile file(url.toLocalFile());
file.open(QIODevice::ReadOnly);
if (file.isOpen()) {
if (file.open(QIODevice::ReadOnly)) {
QPixmap pixmap(url.toLocalFile());
button->setIcon(pixmap);
} else {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment