Fix resize slowness on the TopBar

This commit is contained in:
Konstantinos Sideris 2018-05-25 16:13:38 +03:00
parent f533d9d7ea
commit bcba977f4c
4 changed files with 42 additions and 79 deletions

View file

@ -75,8 +75,8 @@ constexpr int communityBubble = bubble - 4;
namespace userInfoWidget {
namespace fonts {
constexpr int displayName = 16;
constexpr int userid = 14;
constexpr int displayName = 15;
constexpr int userid = 13;
} // namespace fonts
} // namespace userInfoWidget

View file

@ -22,12 +22,15 @@
#include <QImage>
#include <QLabel>
#include <QPaintEvent>
#include <QPainter>
#include <QPen>
#include <QSharedPointer>
#include <QStyle>
#include <QStyleOption>
#include <QVBoxLayout>
class Avatar;
class FlatButton;
class Label;
class Menu;
class OverlayModal;
@ -55,21 +58,35 @@ signals:
void inviteUsers(QStringList users);
protected:
void paintEvent(QPaintEvent *event) override;
void mousePressEvent(QMouseEvent *event) override;
void mousePressEvent(QMouseEvent *) override
{
if (roomSettings_ != nullptr)
roomSettings_->trigger();
}
void paintEvent(QPaintEvent *) override
{
QStyleOption opt;
opt.init(this);
QPainter p(this);
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
p.setPen(QPen(borderColor()));
p.drawLine(QPointF(0, height()), QPointF(width(), height()));
}
private:
QHBoxLayout *topLayout_;
QVBoxLayout *textLayout_;
QHBoxLayout *topLayout_ = nullptr;
QVBoxLayout *textLayout_ = nullptr;
QLabel *nameLabel_;
Label *topicLabel_;
QLabel *nameLabel_ = nullptr;
QLabel *topicLabel_ = nullptr;
Menu *menu_;
QAction *leaveRoom_;
QAction *roomMembers_;
QAction *roomSettings_;
QAction *inviteUsers_;
QAction *leaveRoom_ = nullptr;
QAction *roomMembers_ = nullptr;
QAction *roomSettings_ = nullptr;
QAction *inviteUsers_ = nullptr;
FlatButton *settingsBtn_;
@ -77,8 +94,5 @@ private:
int buttonSize_;
QString roomName_;
QString roomTopic_;
QColor borderColor_;
};