summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2021-05-14 09:50:31 +0200
committerJulien Nabet <serval2412@yahoo.fr>2021-05-14 11:07:17 +0200
commitc76e184ca1448c15f2f5fb059a51c2b483d0e387 (patch)
tree825ad72d8c6a7766393195ecca47870477e39f9f /sfx2
parent9837d3b51557955b2a2b7e66c2bdcdc706474704 (diff)
Directly initialize vectors in sfx2/ObjectInspectorTreeHandler
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<int> 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<int> aMethodsWidths { nMethodsDigitWidth * 30, nMethodsDigitWidth * 15, ^~~~~~~~~~~~~~~~~~~~~~~ static_cast<int>( ) Change-Id: I7d59d947bd54bf97dd559b6813cabd3ea4216efe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115582 Reviewed-by: Gülşah Köse <gulsah.kose@collabora.com> Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Jenkins
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/devtools/ObjectInspectorTreeHandler.cxx17
1 files changed, 5 insertions, 12 deletions
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<int> aPropertiesWidths;
- aPropertiesWidths.push_back(nPropertiesDigitWidth * 30);
- aPropertiesWidths.push_back(nPropertiesDigitWidth * 30);
- aPropertiesWidths.push_back(nPropertiesDigitWidth * 30);
- aPropertiesWidths.push_back(nPropertiesDigitWidth * 30);
+ std::vector<int> aPropertiesWidths(4, nPropertiesDigitWidth * 30);
mpObjectInspectorWidgets->mpPropertiesTreeView->set_column_fixed_widths(aPropertiesWidths);
- auto nMethodsDigitWidth
- = mpObjectInspectorWidgets->mpMethodsTreeView->get_approximate_digit_width();
- std::vector<int> 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<int>(
+ mpObjectInspectorWidgets->mpMethodsTreeView->get_approximate_digit_width());
+ std::vector<int> aMethodsWidths{ nMethodsDigitWidth * 30, nMethodsDigitWidth * 15,
+ nMethodsDigitWidth * 30, nMethodsDigitWidth * 50 };
mpObjectInspectorWidgets->mpMethodsTreeView->set_column_fixed_widths(aMethodsWidths);
pObjectInspectorWidgets->mpPaned->set_position(160);