From c76e184ca1448c15f2f5fb059a51c2b483d0e387 Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Fri, 14 May 2021 09:50:31 +0200 Subject: Directly initialize vectors in sfx2/ObjectInspectorTreeHandler MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit since we've got all the information from the beginning. The static_cast is to fix this error: /home/julien/lo/libreoffice/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx:976:39: error: type 'float' cannot be narrowed to 'int' in initializer list [-Wc++11-narrowing] std::vector aMethodsWidths { nMethodsDigitWidth * 30, nMethodsDigitWidth * 15, ^~~~~~~~~~~~~~~~~~~~~~~ /home/julien/lo/libreoffice/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx:976:39: note: insert an explicit cast to silence this issue std::vector aMethodsWidths { nMethodsDigitWidth * 30, nMethodsDigitWidth * 15, ^~~~~~~~~~~~~~~~~~~~~~~ static_cast( ) Change-Id: I7d59d947bd54bf97dd559b6813cabd3ea4216efe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115582 Reviewed-by: Gülşah Köse Reviewed-by: Julien Nabet Tested-by: Jenkins --- sfx2/source/devtools/ObjectInspectorTreeHandler.cxx | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx b/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx index 4915917ee087..204cdb3c9319 100644 --- a/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx +++ b/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx @@ -968,20 +968,13 @@ ObjectInspectorTreeHandler::ObjectInspectorTreeHandler( auto nPropertiesDigitWidth = mpObjectInspectorWidgets->mpPropertiesTreeView->get_approximate_digit_width(); - std::vector aPropertiesWidths; - aPropertiesWidths.push_back(nPropertiesDigitWidth * 30); - aPropertiesWidths.push_back(nPropertiesDigitWidth * 30); - aPropertiesWidths.push_back(nPropertiesDigitWidth * 30); - aPropertiesWidths.push_back(nPropertiesDigitWidth * 30); + std::vector aPropertiesWidths(4, nPropertiesDigitWidth * 30); mpObjectInspectorWidgets->mpPropertiesTreeView->set_column_fixed_widths(aPropertiesWidths); - auto nMethodsDigitWidth - = mpObjectInspectorWidgets->mpMethodsTreeView->get_approximate_digit_width(); - std::vector aMethodsWidths; - aMethodsWidths.push_back(nMethodsDigitWidth * 30); - aMethodsWidths.push_back(nMethodsDigitWidth * 15); - aMethodsWidths.push_back(nMethodsDigitWidth * 30); - aMethodsWidths.push_back(nMethodsDigitWidth * 50); + auto nMethodsDigitWidth = static_cast( + mpObjectInspectorWidgets->mpMethodsTreeView->get_approximate_digit_width()); + std::vector aMethodsWidths{ nMethodsDigitWidth * 30, nMethodsDigitWidth * 15, + nMethodsDigitWidth * 30, nMethodsDigitWidth * 50 }; mpObjectInspectorWidgets->mpMethodsTreeView->set_column_fixed_widths(aMethodsWidths); pObjectInspectorWidgets->mpPaned->set_position(160); -- cgit