diff options
Diffstat (limited to 'Swift/QtUI')
-rw-r--r-- | Swift/QtUI/QtRosterHeader.cpp | 12 | ||||
-rw-r--r-- | Swift/QtUI/QtRosterHeader.h | 11 |
2 files changed, 9 insertions, 14 deletions
diff --git a/Swift/QtUI/QtRosterHeader.cpp b/Swift/QtUI/QtRosterHeader.cpp index fc3d0e6..5c89e2a 100644 --- a/Swift/QtUI/QtRosterHeader.cpp +++ b/Swift/QtUI/QtRosterHeader.cpp @@ -16,6 +16,7 @@ #include "QtStatusWidget.h" #include "Swift/QtUI/QtElidingLabel.h" + namespace Swift { QtRosterHeader::QtRosterHeader(QWidget* parent) : QWidget(parent) { QHBoxLayout* topLayout = new QHBoxLayout(); @@ -26,10 +27,11 @@ QtRosterHeader::QtRosterHeader(QWidget* parent) : QWidget(parent) { setMaximumHeight(50); avatarLabel_ = new QLabel(this); - avatarLabel_->setMinimumSize(40, 40); - avatarLabel_->setMaximumSize(40, 40); + avatarLabel_->setMinimumSize(avatarSize_, avatarSize_); + avatarLabel_->setMaximumSize(avatarSize_, avatarSize_); + avatarLabel_->setAlignment(Qt::AlignCenter); setAvatar(":/icons/avatar.png"); - avatarLabel_->setScaledContents(true); + avatarLabel_->setScaledContents(false); topLayout->addWidget(avatarLabel_); QVBoxLayout* rightLayout = new QVBoxLayout(); @@ -125,11 +127,13 @@ void QtRosterHeader::setAvatar(const QString& path) { qDebug() << "Setting null avatar"; avatar = QIcon(":/icons/avatar.png"); } - avatarLabel_->setPixmap(avatar.pixmap(64, 64)); + avatarLabel_->setPixmap(avatar.pixmap(avatarSize_, avatarSize_)); } //QSize QtRosterHeader::sizeHint() const { // return minimumSizeHint(); //} +const int QtRosterHeader::avatarSize_ = 40; + } diff --git a/Swift/QtUI/QtRosterHeader.h b/Swift/QtUI/QtRosterHeader.h index 72091cb..6d36b75 100644 --- a/Swift/QtUI/QtRosterHeader.h +++ b/Swift/QtUI/QtRosterHeader.h @@ -30,26 +30,17 @@ namespace Swift { void setName(const QString& name); void setStatusText(const QString& statusMessage); void setStatusType(StatusShow::Type type); -// QSize sizeHint() const; -// public slots: -// void emitStatus(); signals: void onChangeStatusRequest(StatusShow::Type showType, const QString &statusMessage); private slots: void handleChangeStatusRequest(StatusShow::Type type, const QString &statusMessage); -// protected: -// virtual void resizeEvent(QResizeEvent* event); -// virtual void mousePressEvent(QMouseEvent* event); private: -// void resizeNameLabel(); -// void toggleExpanded(); QString name_; QLabel* avatarLabel_; QLabel* nameLabel_; QtTextEdit* statusEdit_; QToolBar* toolBar_; QtStatusWidget* statusWidget_; - //QHBoxLayout* expandedLayout_; - //bool expanded_; + static const int avatarSize_; }; } |