mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
refactor: minor cleanup in Widget and Friend
This commit is contained in:
parent
bdbf2b461b
commit
456e429cac
|
@ -86,7 +86,7 @@ void Friend::setName(QString name)
|
|||
void Friend::setAlias(QString name)
|
||||
{
|
||||
userAlias = name;
|
||||
QString dispName = userAlias.size() == 0 ? userName : userAlias;
|
||||
QString dispName = userAlias.isEmpty() ? userName : userAlias;
|
||||
|
||||
widget->setName(dispName);
|
||||
chatForm->setName(dispName);
|
||||
|
@ -116,10 +116,7 @@ QString Friend::getStatusMessage()
|
|||
|
||||
QString Friend::getDisplayedName() const
|
||||
{
|
||||
if (userAlias.size() == 0)
|
||||
return userName;
|
||||
|
||||
return userAlias;
|
||||
return userAlias.isEmpty() ? userName : userAlias;
|
||||
}
|
||||
|
||||
bool Friend::hasAlias() const
|
||||
|
|
|
@ -413,14 +413,14 @@ bool Widget::eventFilter(QObject *obj, QEvent *event)
|
|||
{
|
||||
case QEvent::Close:
|
||||
// It's needed if user enable `Close to tray`
|
||||
wasMaximized = state & Qt::WindowMaximized;
|
||||
wasMaximized = state.testFlag(Qt::WindowMaximized);
|
||||
break;
|
||||
|
||||
case QEvent::WindowStateChange:
|
||||
ce = static_cast<QWindowStateChangeEvent*>(event);
|
||||
if (state & Qt::WindowMinimized && obj)
|
||||
if (state.testFlag(Qt::WindowMinimized) && obj)
|
||||
{
|
||||
wasMaximized = ce->oldState() & Qt::WindowMaximized;
|
||||
wasMaximized = ce->oldState().testFlag(Qt::WindowMaximized);
|
||||
}
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
|
|
Loading…
Reference in New Issue
Block a user