From 97fb50c28f8a7a65ee1b3b70d7a1d5a7411261f3 Mon Sep 17 00:00:00 2001 From: lethosor Date: Wed, 6 Jan 2016 17:30:07 -0500 Subject: [PATCH] Add better support for default ListColumn values This is only necessary for multiple-selection columns, and there aren't any with non-pointer entry types currently, but casting nullptr to non-pointer types isn't a great idea. --- plugins/listcolumn.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/listcolumn.h b/plugins/listcolumn.h index 0576ca4e4..5c96b4594 100644 --- a/plugins/listcolumn.h +++ b/plugins/listcolumn.h @@ -35,8 +35,9 @@ public: bool allow_search; bool feed_mouse_set_highlight; bool feed_changed_highlight; + T default_value; - ListColumn() + ListColumn(const T default_value_ = T()) { bottom_margin = 3; clear(); @@ -50,6 +51,7 @@ public: allow_search = true; feed_mouse_set_highlight = false; feed_changed_highlight = false; + default_value = default_value_; } void clear() @@ -310,7 +312,7 @@ public: { vector results = getSelectedElems(true); if (results.size() == 0) - return (T)nullptr; + return default_value; else return results[0]; }