diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2013-06-13 19:56:36 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-06-13 19:56:36 +0200 |
commit | e34da61362c0a64b8fd932c3363421c766595d4a (patch) | |
tree | a1e71824e9e94eafd791c0c005b78371fa7dc1e5 /qt-ui/divelistview.cpp | |
parent | 863c48593949e91beb6b7ff02a1385b9977182f5 (diff) | |
parent | 7e9d6e28297432d4a15721a49a9dd0c0d067ce7e (diff) | |
download | subsurface-e34da61362c0a64b8fd932c3363421c766595d4a.tar.gz |
Merge branch 'linusDiveList' of https://github.com/tcanabrava/subsurface
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/divelistview.cpp')
-rw-r--r-- | qt-ui/divelistview.cpp | 12 |
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(); |