src: Fixed refresh of QtUndoRedoView in wrong thread

This commit is contained in:
Eberhard Graether
2015-07-20 15:02:01 +02:00
parent 73aa6080aa
commit 0f9e72d553
2 changed files with 11 additions and 2 deletions
+8 -2
View File
@@ -7,6 +7,7 @@
QtUndoRedoView::QtUndoRedoView(ViewLayout* viewLayout) QtUndoRedoView::QtUndoRedoView(ViewLayout* viewLayout)
: UndoRedoView(viewLayout) : UndoRedoView(viewLayout)
, m_refreshFunctor(std::bind(&QtUndoRedoView::doRefreshView, this))
, m_setRedoButtonEnabledFunctor(std::bind(&QtUndoRedoView::doSetRedoButtonEnabled, this, std::placeholders::_1)) , m_setRedoButtonEnabledFunctor(std::bind(&QtUndoRedoView::doSetRedoButtonEnabled, this, std::placeholders::_1))
, m_setUndoButtonEnabledFunctor(std::bind(&QtUndoRedoView::doSetUndoButtonEnabled, this, std::placeholders::_1)) , m_setUndoButtonEnabledFunctor(std::bind(&QtUndoRedoView::doSetUndoButtonEnabled, this, std::placeholders::_1))
{ {
@@ -29,8 +30,7 @@ void QtUndoRedoView::initView()
void QtUndoRedoView::refreshView() void QtUndoRedoView::refreshView()
{ {
setStyleSheet(); m_refreshFunctor();
m_widget->refreshStyle();
} }
void QtUndoRedoView::setStyleSheet() void QtUndoRedoView::setStyleSheet()
@@ -38,6 +38,12 @@ void QtUndoRedoView::setStyleSheet()
m_widget->setStyleSheet(utility::getStyleSheet("data/gui/undoredo_view/undoredo_view.css").c_str()); m_widget->setStyleSheet(utility::getStyleSheet("data/gui/undoredo_view/undoredo_view.css").c_str());
} }
void QtUndoRedoView::doRefreshView()
{
setStyleSheet();
m_widget->refreshStyle();
}
void QtUndoRedoView::doSetRedoButtonEnabled(bool enabled) void QtUndoRedoView::doSetRedoButtonEnabled(bool enabled)
{ {
m_widget->setRedoButtonEnabled(enabled); m_widget->setRedoButtonEnabled(enabled);
+3
View File
@@ -24,9 +24,12 @@ public:
virtual void setUndoButtonEnabled(bool enabled); virtual void setUndoButtonEnabled(bool enabled);
private: private:
void doRefreshView();
void doSetRedoButtonEnabled(bool enabled); void doSetRedoButtonEnabled(bool enabled);
void doSetUndoButtonEnabled(bool enabled); void doSetUndoButtonEnabled(bool enabled);
QtThreadedFunctor<void> m_refreshFunctor;
QtThreadedFunctor<bool> m_setRedoButtonEnabledFunctor; QtThreadedFunctor<bool> m_setRedoButtonEnabledFunctor;
QtThreadedFunctor<bool> m_setUndoButtonEnabledFunctor; QtThreadedFunctor<bool> m_setUndoButtonEnabledFunctor;