[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [tellico] src/gui: Another workaround for nested event loops and image loading.
From:       Robby Stephenson <null () kde ! org>
Date:       2017-08-01 0:57:40
Message-ID: E1dcLVE-00035Z-70 () code ! kde ! org
[Download RAW message or body]

Git commit 9868aa8d1190fe8607693754d0498cc6a936f0ec by Robby Stephenson.
Committed on 01/08/2017 at 00:53.
Pushed by rstephenson into branch 'master'.

Another workaround for nested event loops and image loading.

Similar to commit 9ee42800bbde51844694572289410d052b7903c9.

M  +9    -0    src/gui/detailedentryitemdelegate.cpp
M  +4    -1    src/gui/detailedentryitemdelegate.h

https://commits.kde.org/tellico/9868aa8d1190fe8607693754d0498cc6a936f0ec

diff --git a/src/gui/detailedentryitemdelegate.cpp \
b/src/gui/detailedentryitemdelegate.cpp index 162c00d8..c0895290 100644
--- a/src/gui/detailedentryitemdelegate.cpp
+++ b/src/gui/detailedentryitemdelegate.cpp
@@ -28,7 +28,15 @@
 using namespace Tellico;
 using Tellico::DetailedEntryItemDelegate;
 
+DetailedEntryItemDelegate::DetailedEntryItemDelegate(QObject* parent_) : \
QStyledItemDelegate(parent_) +    , m_isLoading(false) {
+}
+
 void DetailedEntryItemDelegate::initStyleOption(QStyleOptionViewItem* option, const \
QModelIndex& index) const { +  if(m_isLoading) {
+    return;
+  }
+  m_isLoading = true;
   QStyledItemDelegate::initStyleOption(option, index);
 
   const int state = index.data(SaveStateRole).toInt();
@@ -36,4 +44,5 @@ void \
DetailedEntryItemDelegate::initStyleOption(QStyleOptionViewItem* option, co  \
option->font.setBold(true);  option->font.setItalic(true);
   }
+  m_isLoading = false;
 }
diff --git a/src/gui/detailedentryitemdelegate.h \
b/src/gui/detailedentryitemdelegate.h index 042bfab1..421f00e6 100644
--- a/src/gui/detailedentryitemdelegate.h
+++ b/src/gui/detailedentryitemdelegate.h
@@ -33,10 +33,13 @@ class DetailedEntryItemDelegate : public QStyledItemDelegate {
 Q_OBJECT
 
 public:
-  DetailedEntryItemDelegate(QObject* parent) : QStyledItemDelegate(parent) {}
+  DetailedEntryItemDelegate(QObject* parent);
 
 protected:
   void initStyleOption(QStyleOptionViewItem* option, const QModelIndex& index) const \
Q_DECL_OVERRIDE; +
+private:
+  mutable bool m_isLoading;
 };
 
 } // end namespace;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic