mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Merge pull request #3176
PKEv (1): fix(groupinviteform):make list of groups scrollable
This commit is contained in:
commit
74e7257a3e
|
@ -48,7 +48,16 @@ GroupInviteForm::GroupInviteForm()
|
|||
|
||||
inviteBox = new QGroupBox(this);
|
||||
inviteLayout = new QVBoxLayout(inviteBox);
|
||||
inviteLayout->addStretch(1);
|
||||
|
||||
scroll = new QScrollArea(this);
|
||||
|
||||
QWidget* innerWidget = new QWidget(scroll);
|
||||
innerWidget->setLayout(new QVBoxLayout());
|
||||
innerWidget->layout()->setAlignment(Qt::AlignTop);
|
||||
scroll->setWidget(innerWidget);
|
||||
scroll->setWidgetResizable(true);
|
||||
|
||||
inviteLayout->addWidget(scroll);
|
||||
|
||||
layout->addWidget(createButton);
|
||||
layout->addWidget(inviteBox);
|
||||
|
@ -114,7 +123,7 @@ void GroupInviteForm::addGroupInvite(int32_t friendId, uint8_t type, QByteArray
|
|||
groupLayout->addWidget(rejectButton);
|
||||
retranslateRejectButton(rejectButton);
|
||||
|
||||
inviteLayout->insertWidget(0, groupWidget);
|
||||
scroll->widget()->layout()->addWidget(groupWidget);
|
||||
|
||||
GroupInvite group;
|
||||
group.friendId = friendId;
|
||||
|
@ -137,7 +146,7 @@ void GroupInviteForm::onGroupInviteAccepted()
|
|||
{
|
||||
QPushButton* acceptButton = static_cast<QPushButton*>(sender());
|
||||
QWidget* groupWidget = acceptButton->parentWidget();
|
||||
int index = inviteLayout->indexOf(groupWidget);
|
||||
int index = scroll->widget()->layout()->indexOf(groupWidget);
|
||||
GroupInvite invite = groupInvites.at(index);
|
||||
groupInvites.removeAt(index);
|
||||
|
||||
|
@ -150,7 +159,7 @@ void GroupInviteForm::onGroupInviteRejected()
|
|||
{
|
||||
QPushButton* rejectButton = static_cast<QPushButton*>(sender());
|
||||
QWidget* groupWidget = rejectButton->parentWidget();
|
||||
int index = inviteLayout->indexOf(groupWidget);
|
||||
int index = scroll->widget()->layout()->indexOf(groupWidget);
|
||||
groupInvites.removeAt(index);
|
||||
|
||||
deleteInviteButtons(groupWidget);
|
||||
|
@ -168,7 +177,7 @@ void GroupInviteForm::deleteInviteButtons(QWidget* widget)
|
|||
groupLabels.remove(labels.at(0));
|
||||
|
||||
widget->deleteLater();
|
||||
inviteLayout->removeWidget(widget);
|
||||
scroll->widget()->layout()->removeWidget(widget);
|
||||
}
|
||||
|
||||
void GroupInviteForm::retranslateUi()
|
||||
|
@ -193,7 +202,7 @@ void GroupInviteForm::retranslateUi()
|
|||
void GroupInviteForm::retranslateGroupLabel(CroppingLabel* label)
|
||||
{
|
||||
QWidget* groupWidget = label->parentWidget();
|
||||
int index = inviteLayout->indexOf(groupWidget);
|
||||
int index = scroll->widget()->layout()->indexOf(groupWidget);
|
||||
GroupInvite invite = groupInvites.at(index);
|
||||
|
||||
QString name = Nexus::getCore()->getFriendUsername(invite.friendId);
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include <QSet>
|
||||
#include "src/widget/tool/croppinglabel.h"
|
||||
#include "src/widget/gui.h"
|
||||
#include <QScrollArea>
|
||||
|
||||
class QLabel;
|
||||
class QVBoxLayout;
|
||||
|
@ -84,6 +85,7 @@ private:
|
|||
QSet<QPushButton*> rejectButtons;
|
||||
QSet<CroppingLabel*> groupLabels;
|
||||
QList<GroupInvite> groupInvites;
|
||||
QScrollArea* scroll;
|
||||
};
|
||||
|
||||
#endif // GROUPINVITEFORM_H
|
||||
|
|
Loading…
Reference in New Issue
Block a user