Quellcode durchsuchen

BUG: Hide error log "threadid" column by setting model column count

If not setting the column count, the column can be hidden only after
data have been inserted. As a consequence, within the error log widget,
the column is visibility is set only after the error log model is set.
Jean-Christophe Fillion-Robin vor 11 Jahren
Ursprung
Commit
a706f23f99
2 geänderte Dateien mit 3 neuen und 2 gelöschten Zeilen
  1. 1 0
      Libs/Core/ctkErrorLogModel.cpp
  2. 2 2
      Libs/Widgets/ctkErrorLogWidget.cpp

+ 1 - 0
Libs/Core/ctkErrorLogModel.cpp

@@ -217,6 +217,7 @@ public:
 ctkErrorLogModelPrivate::ctkErrorLogModelPrivate(ctkErrorLogModel& object)
   : q_ptr(&object)
 {
+  this->StandardItemModel.setColumnCount(ctkErrorLogModel::MaxColumn);
   this->LogEntryGrouping = false;
   this->AsynchronousLogging = true;
   this->AddingEntry = false;

+ 2 - 2
Libs/Widgets/ctkErrorLogWidget.cpp

@@ -83,8 +83,6 @@ void ctkErrorLogWidgetPrivate::init()
 
   QObject::connect(this->ClearButton, SIGNAL(clicked()),
                    q, SLOT(removeEntries()));
-
-  this->ErrorLogTableView->setColumnHidden(ctkErrorLogModel::ThreadIdColumn, true);
 }
 
 // --------------------------------------------------------------------------
@@ -177,6 +175,8 @@ void ctkErrorLogWidget::setErrorLogModel(ctkErrorLogModel * newErrorLogModel)
     {
     this->setAllEntriesVisible(0);
     }
+
+  d->ErrorLogTableView->setColumnHidden(ctkErrorLogModel::ThreadIdColumn, true);
 }
 
 // --------------------------------------------------------------------------