fixed resizing+CPU bug due to inconsistent return in eventFilter()

This commit is contained in:
csoler 2018-11-27 10:13:03 +01:00
parent c0e87dbb3b
commit 02c6a92f48
No known key found for this signature in database
GPG Key ID: 7BCA522266C0804C
4 changed files with 16 additions and 5 deletions

View File

@ -503,6 +503,7 @@ void RsGxsForumModel::setPosts(const RsGxsForumGroup& group, const std::vector<F
#endif #endif
emit layoutChanged(); emit layoutChanged();
emit forumLoaded();
} }
void RsGxsForumModel::update_posts(const RsGxsGroupId& group_id) void RsGxsForumModel::update_posts(const RsGxsGroupId& group_id)

View File

@ -55,7 +55,7 @@ struct ForumModelPostEntry
class RsGxsForumModel : public QAbstractItemModel class RsGxsForumModel : public QAbstractItemModel
{ {
// Q_OBJECT Q_OBJECT
public: public:
explicit RsGxsForumModel(QObject *parent = NULL); explicit RsGxsForumModel(QObject *parent = NULL);
@ -147,6 +147,10 @@ public:
* Dumps the hierarchy of posts in the terminal, to allow checking whether the internal representation is correct. * Dumps the hierarchy of posts in the terminal, to allow checking whether the internal representation is correct.
*/ */
void debug_dump(); void debug_dump();
signals:
void forumLoaded(); // emitted after the posts have been set. Can be used to updated the UI.
private: private:
RsGxsForumGroup mForumGroup; RsGxsForumGroup mForumGroup;

View File

@ -347,6 +347,8 @@ GxsForumThreadWidget::GxsForumThreadWidget(const RsGxsGroupId &forumId, QWidget
connect(ui->newmessageButton, SIGNAL(clicked()), this, SLOT(replytoforummessage())); connect(ui->newmessageButton, SIGNAL(clicked()), this, SLOT(replytoforummessage()));
connect(ui->newthreadButton, SIGNAL(clicked()), this, SLOT(createthread())); connect(ui->newthreadButton, SIGNAL(clicked()), this, SLOT(createthread()));
connect(mThreadModel,SIGNAL(forumLoaded()),this,SLOT(updateGroupName()));
ui->newmessageButton->setText(tr("Reply")); ui->newmessageButton->setText(tr("Reply"));
ui->newthreadButton->setText(tr("New thread")); ui->newthreadButton->setText(tr("New thread"));
@ -529,9 +531,8 @@ void GxsForumThreadWidget::processSettings(bool load)
void GxsForumThreadWidget::groupIdChanged() void GxsForumThreadWidget::groupIdChanged()
{ {
#ifdef TO_REMOVE ui->forumName->setText(groupId().isNull () ? "" : tr("Loading..."));
ui->forumName->setText(groupId().isNull () ? "" : tr("Loading"));
#endif
mNewCount = 0; mNewCount = 0;
mUnreadCount = 0; mUnreadCount = 0;
@ -860,7 +861,7 @@ bool GxsForumThreadWidget::eventFilter(QObject *obj, QEvent *event)
// pass the event on to the parent class // pass the event on to the parent class
return RsGxsUpdateBroadcastWidget::eventFilter(obj, event); return RsGxsUpdateBroadcastWidget::eventFilter(obj, event);
#endif #endif
return true; return RsGxsUpdateBroadcastWidget::eventFilter(obj, event);
} }
void GxsForumThreadWidget::togglethreadview() void GxsForumThreadWidget::togglethreadview()
@ -2674,6 +2675,10 @@ bool GxsForumThreadWidget::filterItem(QTreeWidgetItem *item, const QString &text
/** Request / Response of Data ********************************/ /** Request / Response of Data ********************************/
/*********************** **** **** **** ***********************/ /*********************** **** **** **** ***********************/
void GxsForumThreadWidget::updateGroupName()
{
ui->forumName->setText(QString::fromUtf8(mForumGroup.mMeta.mGroupName.c_str()));
}
void GxsForumThreadWidget::updateGroupData() void GxsForumThreadWidget::updateGroupData()
{ {
mSubscribeFlags = 0; mSubscribeFlags = 0;

View File

@ -103,6 +103,7 @@ private slots:
void changedThread(QModelIndex index); void changedThread(QModelIndex index);
void changedVersion(); void changedVersion();
void clickedThread (QModelIndex index); void clickedThread (QModelIndex index);
void updateGroupName();
void reply_with_private_message(); void reply_with_private_message();
void replytoforummessage(); void replytoforummessage();