dirk at hohndel.org
Tue Sep 24 03:05:06 UTC 2013
How about this one?
diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp
index a1436bf..ddd10e2 100644
@@ -400,7 +400,7 @@ void DiveListView::contextMenuEvent(QContextMenuEvent *event)
popup.addAction(tr("delete dive"), this, SLOT(deleteDive()));
- if (selectionModel()->selection().indexes().count() > 14)
+ if (amount_selected > 1)
popup.addAction(tr("merge selected dives"), this, SLOT(mergeDives()));
// "collapse all" really closes all trips,
// "collapse" keeps the trip with the selected dive open
That seems to work reliably for me and feels much more robust and
straight forward ;-)
On Tue, 2013-09-24 at 11:55 +0300, Lubomir I. Ivanov wrote:
> alternative that only shows the popup entry if there is no trip row in
> the selection.
> not sure if this is how it's supposed to work.
> On 24 September 2013 10:50, Lubomir I. Ivanov <neolit123 at gmail.com> wrote:
> > this seems to work:
> > selectionModel()->selectedRows().count() > 1
> > but both methods are not optimal when a trip with a single dive is
> > selected, because the index count is > 14 and the row count is > 1.
> > so perhaps there has to be also a check if the row count is 2 and the
> > first row is a trip, or when the selection does not include a trip
> > row.
> > lubomir
> > --
> > On 24 September 2013 08:02, Dirk Hohndel <dirk at hohndel.org> wrote:
> >> I randomly played around with Subsurface to find little things to add
> >> (I'm sure you are all doing this in your spare time, right?) - and
> >> stumbled across dive merging.
> >> I pushed my implementation but I want someone who actually speaks Qt to
> >> look at the odd way in which I ended up determining if more than 1 dive
> >> is selected.
> >> if (selectionModel()->selection().indexes().count() > 14)
> >> Turns out that selection.indexes() counts all fields and we happen to
> >> have 14 columns... that seems REALLY hackish to me.
> >> Tomaz? Thiago? mgue?
> >> What's the elegant way to do this?
> >> /D
> >> _______________________________________________
> >> subsurface mailing list
> >> subsurface at hohndel.org
> >> http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface
More information about the subsurface