summaryrefslogtreecommitdiff
path: root/src/gui/widgets/widget.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-06-06 23:34:34 +0300
committerAndrei Karas <akaras@inbox.ru>2017-06-07 19:23:40 +0300
commit36ba43d6ea38062b17f7e63ef659962bfc51c64d (patch)
tree190156cb88b13a38a6d13c69ee0742cc078065a1 /src/gui/widgets/widget.cpp
parentf1518dd8476c968a43fa57cfb06198e290a4f77a (diff)
downloadmv-36ba43d6ea38062b17f7e63ef659962bfc51c64d.tar.gz
mv-36ba43d6ea38062b17f7e63ef659962bfc51c64d.tar.bz2
mv-36ba43d6ea38062b17f7e63ef659962bfc51c64d.tar.xz
mv-36ba43d6ea38062b17f7e63ef659962bfc51c64d.zip
Fix clang-tidy check readability-implicit-bool-cast.
Diffstat (limited to 'src/gui/widgets/widget.cpp')
-rw-r--r--src/gui/widgets/widget.cpp42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/gui/widgets/widget.cpp b/src/gui/widgets/widget.cpp
index 9523cb4b5..260272936 100644
--- a/src/gui/widgets/widget.cpp
+++ b/src/gui/widgets/widget.cpp
@@ -179,7 +179,7 @@ void Widget::setDimension(const Rect& dimension)
bool Widget::isFocused() const
{
- if (!mFocusHandler)
+ if (mFocusHandler == nullptr)
return false;
return (mFocusHandler->isFocused(this));
@@ -187,7 +187,7 @@ bool Widget::isFocused() const
void Widget::setFocusable(const bool focusable)
{
- if (!focusable && isFocused() && mFocusHandler)
+ if (!focusable && isFocused() && (mFocusHandler != nullptr))
mFocusHandler->focusNone();
mFocusable = focusable;
}
@@ -199,7 +199,7 @@ bool Widget::isFocusable() const
void Widget::requestFocus()
{
- if (!mFocusHandler)
+ if (mFocusHandler == nullptr)
return;
if (isFocusable())
@@ -208,19 +208,19 @@ void Widget::requestFocus()
void Widget::requestMoveToTop()
{
- if (mParent)
+ if (mParent != nullptr)
mParent->moveToTop(this);
}
void Widget::requestMoveToBottom()
{
- if (mParent)
+ if (mParent != nullptr)
mParent->moveToBottom(this);
}
void Widget::setVisible(Visible visible)
{
- if (visible == Visible_false && isFocused() && mFocusHandler)
+ if (visible == Visible_false && isFocused() && (mFocusHandler != nullptr))
mFocusHandler->focusNone();
if (visible == Visible_true)
@@ -233,13 +233,13 @@ void Widget::setVisible(Visible visible)
void Widget::setFocusHandler(FocusHandler *const focusHandler)
{
- if (mFocusHandler)
+ if (mFocusHandler != nullptr)
{
releaseModalFocus();
mFocusHandler->remove(this);
}
- if (focusHandler)
+ if (focusHandler != nullptr)
focusHandler->add(this);
mFocusHandler = focusHandler;
@@ -307,7 +307,7 @@ void Widget::removeWidgetListener(WidgetListener *const widgetListener)
void Widget::getAbsolutePosition(int& x, int& y) const
{
- if (!mParent)
+ if (mParent == nullptr)
{
x = mDimension.x;
y = mDimension.y;
@@ -326,7 +326,7 @@ void Widget::getAbsolutePosition(int& x, int& y) const
Font* Widget::getFont() const
{
- if (!mCurrentFont)
+ if (mCurrentFont == nullptr)
return mGlobalFont;
return mCurrentFont;
}
@@ -337,7 +337,7 @@ void Widget::setGlobalFont(Font *const font)
FOR_EACH (std::list<Widget*>::const_iterator, iter, mAllWidgets)
{
- if (!(*iter)->mCurrentFont)
+ if ((*iter)->mCurrentFont == nullptr)
(*iter)->fontChanged();
}
}
@@ -375,38 +375,38 @@ bool Widget::isEnabled() const
void Widget::requestModalFocus()
{
- if (!mFocusHandler)
+ if (mFocusHandler == nullptr)
return;
mFocusHandler->requestModalFocus(this);
}
void Widget::requestModalMouseInputFocus()
{
- if (!mFocusHandler)
+ if (mFocusHandler == nullptr)
return;
mFocusHandler->requestModalMouseInputFocus(this);
}
void Widget::releaseModalFocus()
{
- if (!mFocusHandler)
+ if (mFocusHandler == nullptr)
return;
mFocusHandler->releaseModalFocus(this);
}
void Widget::releaseModalMouseInputFocus()
{
- if (!mFocusHandler)
+ if (mFocusHandler == nullptr)
return;
mFocusHandler->releaseModalMouseInputFocus(this);
}
bool Widget::isModalFocused() const
{
- if (!mFocusHandler)
+ if (mFocusHandler == nullptr)
return false;
- if (mParent)
+ if (mParent != nullptr)
{
return (mFocusHandler->getModalFocused() == this)
|| mParent->isModalFocused();
@@ -417,10 +417,10 @@ bool Widget::isModalFocused() const
bool Widget::isModalMouseInputFocused() const
{
- if (!mFocusHandler)
+ if (mFocusHandler == nullptr)
return false;
- if (mParent)
+ if (mParent != nullptr)
{
return (mFocusHandler->getModalMouseInputFocused() == this)
|| mParent->isModalMouseInputFocused();
@@ -506,7 +506,7 @@ void Widget::distributeShownEvent()
void Widget::showPart(const Rect &rectangle)
{
- if (mParent)
+ if (mParent != nullptr)
mParent->showWidgetPart(this, rectangle);
}
@@ -517,7 +517,7 @@ void Widget::windowResized()
Widget *Widget::callPostInit(Widget *const widget)
{
- if (widget)
+ if (widget != nullptr)
widget->postInit();
return widget;
}