Explorar el Código

Show the headers of the result tree view

The headers was hidden by default based on the Qt doc:
Widgets are hidden if:

they were created as independent windows,
they were created as children of visible widgets,
hide() or setVisible(false) was called.
Julien Finet hace 14 años
padre
commit
88e199f50f
Se han modificado 1 ficheros con 6 adiciones y 7 borrados
  1. 6 7
      Libs/DICOM/Widgets/ctkDICOMQueryRetrieveWidget.cpp

+ 6 - 7
Libs/DICOM/Widgets/ctkDICOMQueryRetrieveWidget.cpp

@@ -2,6 +2,7 @@
 #include <QTreeView>
 #include <QTabBar>
 #include <QSettings>
+#include <QHBoxLayout>
 
 /// CTK includes
 #include <ctkCheckableHeaderView.h>
@@ -126,6 +127,8 @@ void ctkDICOMQueryRetrieveWidget::processQuery()
 
   // checkable headers - allow user to select the patient/studies to retrieve
   d->results->setModel(&d->model);
+  d->model.setDatabase(d->queryResultDatabase.database());
+
   d->model.setHeaderData(0, Qt::Horizontal, Qt::Unchecked, Qt::CheckStateRole);
   QHeaderView* previousHeaderView = d->results->header();
   ctkCheckableHeaderView* headerView = new ctkCheckableHeaderView(Qt::Horizontal, d->results);
@@ -134,14 +137,10 @@ void ctkDICOMQueryRetrieveWidget::processQuery()
   headerView->setHighlightSections(previousHeaderView->highlightSections());
   headerView->setPropagateToItems(true);
   d->results->setHeader(headerView);
+  // headerView is hidden because it was created with a visisble parent widget 
+  headerView->setHidden(false);
 
-  d->model.setDatabase(d->queryResultDatabase.database());
-  d->results->setModel(&d->model);
-
-  if ( d->model.rowCount() > 0 )
-  {
-    d->RetrieveButton->setEnabled(true);
-  }
+  d->RetrieveButton->setEnabled(d->model.rowCount());
 }
 
 //----------------------------------------------------------------------------