forked from blue/squawk
link clicking and hovering in message body now works!
This commit is contained in:
parent
eac87e713f
commit
7ba94e9deb
4 changed files with 105 additions and 120 deletions
|
@ -29,8 +29,6 @@
|
|||
#include <QPushButton>
|
||||
#include <QProgressBar>
|
||||
#include <QLabel>
|
||||
#include <QTextEdit>
|
||||
#include <QTextBrowser>
|
||||
|
||||
#include "shared/icons.h"
|
||||
#include "shared/global.h"
|
||||
|
@ -59,6 +57,7 @@ public:
|
|||
void endClearWidgets();
|
||||
void beginClearWidgets();
|
||||
void leftClick(const QPoint& point, const QModelIndex& index, const QRect& sizeHint) const;
|
||||
bool isAnchorHovered(const QPoint& point, const QModelIndex& index, const QRect& sizeHint) const;
|
||||
|
||||
static int avatarHeight;
|
||||
static int margin;
|
||||
|
@ -66,6 +65,7 @@ public:
|
|||
signals:
|
||||
void buttonPushed(const QString& messageId) const;
|
||||
void invalidPath(const QString& messageId) const;
|
||||
void openLink(const QString& href) const;
|
||||
|
||||
protected:
|
||||
int paintButton(QPushButton* btn, QPainter* painter, bool sentByMe, QStyleOptionViewItem& option) const;
|
||||
|
@ -80,11 +80,13 @@ protected:
|
|||
QProgressBar* getBar(const Models::FeedItem& data) const;
|
||||
QLabel* getStatusIcon(const Models::FeedItem& data) const;
|
||||
QLabel* getPencilIcon(const Models::FeedItem& data) const;
|
||||
QTextBrowser* getBody(const Models::FeedItem& data) const;
|
||||
void clearHelperWidget(const Models::FeedItem& data) const;
|
||||
|
||||
bool needToDrawAvatar(const QModelIndex& index, const Models::FeedItem& data, const QStyleOptionViewItem& option) const;
|
||||
bool needToDrawSender(const QModelIndex& index, const Models::FeedItem& data) const;
|
||||
|
||||
QRect getHoveredMessageBodyRect(const QModelIndex& index, const Models::FeedItem& data, const QRect& sizeHint) const;
|
||||
QString getAnchor(const QPoint& point, const QModelIndex& index, const QRect& sizeHint) const;
|
||||
|
||||
protected slots:
|
||||
void onButtonPushed() const;
|
||||
|
@ -98,7 +100,6 @@ private:
|
|||
QFont bodyFont;
|
||||
QFont nickFont;
|
||||
QFont dateFont;
|
||||
QFontMetrics bodyMetrics;
|
||||
QTextDocument* bodyRenderer;
|
||||
QFontMetrics nickMetrics;
|
||||
QFontMetrics dateMetrics;
|
||||
|
@ -111,7 +112,6 @@ private:
|
|||
std::map<QString, QProgressBar*>* bars;
|
||||
std::map<QString, QLabel*>* statusIcons;
|
||||
std::map<QString, QLabel*>* pencilIcons;
|
||||
std::map<QString, QTextBrowser*>* bodies;
|
||||
std::map<QString, Preview*>* previews;
|
||||
std::set<QString>* idsToKeep;
|
||||
bool clearingWidgets;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue