summaryrefslogtreecommitdiffstats
path: root/qt-ui/divelistview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qt-ui/divelistview.cpp')
-rw-r--r--qt-ui/divelistview.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp
index fd189e926..744f3d911 100644
--- a/qt-ui/divelistview.cpp
+++ b/qt-ui/divelistview.cpp
@@ -28,6 +28,8 @@ DiveListView::DiveListView(QWidget *parent) : QTreeView(parent), mouseClickSelec
model->setSortRole(TreeItemDT::SORT_ROLE);
model->setFilterKeyColumn(-1); // filter all columns
setModel(model);
+ connect(model, SIGNAL(layoutChanged()), this, SLOT(fixMessyQtModelBehaviour()));
+
setSortingEnabled(false);
setContextMenuPolicy(Qt::DefaultContextMenu);
header()->setContextMenuPolicy(Qt::ActionsContextMenu);
@@ -42,6 +44,16 @@ DiveListView::DiveListView(QWidget *parent) : QTreeView(parent), mouseClickSelec
connect(searchBox, SIGNAL(textChanged(QString)), model, SLOT(setFilterFixedString(QString)));
}
+void DiveListView::fixMessyQtModelBehaviour()
+{
+ QAbstractItemModel *m = model();
+ for(int i = 0; i < model()->rowCount(); i++){
+ if (m->rowCount( m->index(i, 0) ) != 0){
+ setFirstColumnSpanned(i, QModelIndex(), true);
+ }
+ }
+}
+
void DiveListView::unselectDives()
{
selectionModel()->clearSelection();