summary refs log tree commit diff
path: root/src/UserInfoWidget.cc
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2017-05-19 19:55:38 +0300
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2017-05-19 19:55:38 +0300
commitc480f8f4bcef551eddcddeb5a4304de33c146732 (patch)
treef405592f095083723077243e618b7a3b7b462a3c /src/UserInfoWidget.cc
parentRemove RoomList UI form (diff)
downloadnheko-c480f8f4bcef551eddcddeb5a4304de33c146732.tar.xz
Snappy sidebar
Diffstat (limited to 'src/UserInfoWidget.cc')
-rw-r--r--src/UserInfoWidget.cc27
1 files changed, 24 insertions, 3 deletions
diff --git a/src/UserInfoWidget.cc b/src/UserInfoWidget.cc

index 82ff822f..2fca8925 100644 --- a/src/UserInfoWidget.cc +++ b/src/UserInfoWidget.cc
@@ -15,8 +15,10 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "UserInfoWidget.h" +#include <QDebug> + #include "FlatButton.h" +#include "UserInfoWidget.h" UserInfoWidget::UserInfoWidget(QWidget *parent) : QWidget(parent) @@ -29,7 +31,7 @@ UserInfoWidget::UserInfoWidget(QWidget *parent) topLayout_ = new QHBoxLayout(this); topLayout_->setSpacing(0); - topLayout_->setContentsMargins(5, 5, 5, 5); + topLayout_->setMargin(5); avatarLayout_ = new QHBoxLayout(); textLayout_ = new QVBoxLayout(); @@ -65,11 +67,12 @@ UserInfoWidget::UserInfoWidget(QWidget *parent) topLayout_->addStretch(1); buttonLayout_ = new QHBoxLayout(); + buttonLayout_->setSpacing(0); + buttonLayout_->setMargin(0); logoutButton_ = new FlatButton(this); logoutButton_->setForegroundColor(QColor("#555459")); logoutButton_->setCursor(QCursor(Qt::PointingHandCursor)); - logoutButton_->setStyleSheet("width: 30px; height: 30px;"); QIcon icon; icon.addFile(":/icons/icons/power-button-off.png", QSize(), QIcon::Normal, QIcon::Off); @@ -88,6 +91,24 @@ UserInfoWidget::~UserInfoWidget() { } +void UserInfoWidget::resizeEvent(QResizeEvent *event) +{ + Q_UNUSED(event); + + if (width() <= ui::sidebar::SmallSize) { + topLayout_->setContentsMargins(0, 0, 10, 0); + + userAvatar_->hide(); + displayNameLabel_->hide(); + userIdLabel_->hide(); + } else { + topLayout_->setMargin(5); + userAvatar_->show(); + displayNameLabel_->show(); + userIdLabel_->show(); + } +} + void UserInfoWidget::reset() { displayNameLabel_->setText("");