Added horizontal layout and stretch for player icon (#4052)

This commit is contained in:
awlangham 2020-07-28 01:22:02 -04:00 committed by GitHub
parent fe63dfa762
commit 5d9d91262b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 5 deletions

View file

@ -29,9 +29,16 @@ UserInfoBox::UserInfoBox(AbstractClient *_client, bool _editable, QWidget *paren
avatarLabel.setMinimumSize(200, 200);
avatarLabel.setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
avatarLabel.setAlignment(Qt::AlignCenter);
QHBoxLayout *avatarLayout = new QHBoxLayout;
avatarLayout->setContentsMargins(0, 0, 0, 0);
avatarLayout->addStretch(1);
avatarLayout->addWidget(&avatarLabel, 3);
avatarLayout->addStretch(1);
QGridLayout *mainLayout = new QGridLayout;
mainLayout->addWidget(&avatarLabel, 0, 1, 1, 1);
mainLayout->addLayout(avatarLayout, 0, 0, 1, 3);
mainLayout->addWidget(&nameLabel, 1, 0, 1, 3);
mainLayout->addWidget(&realNameLabel1, 2, 0, 1, 1);
mainLayout->addWidget(&realNameLabel2, 2, 1, 1, 2);
@ -41,9 +48,9 @@ UserInfoBox::UserInfoBox(AbstractClient *_client, bool _editable, QWidget *paren
mainLayout->addWidget(&userLevelLabel1, 5, 0, 1, 1);
mainLayout->addWidget(&userLevelLabel2, 5, 1, 1, 1);
mainLayout->addWidget(&userLevelLabel3, 5, 2, 1, 1);
mainLayout->addWidget(&accountAgeLebel1, 6, 0, 1, 1);
mainLayout->addWidget(&accountAgeLabel1, 6, 0, 1, 1);
mainLayout->addWidget(&accountAgeLabel2, 6, 2, 1, 1);
mainLayout->setColumnStretch(1, 10);
mainLayout->setColumnStretch(2, 10);
if (editable) {
QHBoxLayout *buttonsLayout = new QHBoxLayout;
@ -67,7 +74,7 @@ void UserInfoBox::retranslateUi()
realNameLabel1.setText(tr("Real name:"));
countryLabel1.setText(tr("Location:"));
userLevelLabel1.setText(tr("User level:"));
accountAgeLebel1.setText(tr("Account Age:"));
accountAgeLabel1.setText(tr("Account Age:"));
editButton.setText(tr("Edit"));
passwordButton.setText(tr("Change password"));

View file

@ -16,7 +16,7 @@ private:
AbstractClient *client;
bool editable;
QLabel avatarLabel, nameLabel, realNameLabel1, realNameLabel2, countryLabel1, countryLabel2, countryLabel3,
userLevelLabel1, userLevelLabel2, userLevelLabel3, accountAgeLebel1, accountAgeLabel2;
userLevelLabel1, userLevelLabel2, userLevelLabel3, accountAgeLabel1, accountAgeLabel2;
QPushButton editButton, passwordButton, avatarButton;
QPixmap avatarPixmap;