[Libreoffice-commits] core.git: sfx2/source

Julien Nabet (via logerrit) logerrit at kemper.freedesktop.org
Fri May 14 09:07:53 UTC 2021


 sfx2/source/devtools/ObjectInspectorTreeHandler.cxx |   17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

New commits:
commit c76e184ca1448c15f2f5fb059a51c2b483d0e387
Author:     Julien Nabet <serval2412 at yahoo.fr>
AuthorDate: Fri May 14 09:50:31 2021 +0200
Commit:     Julien Nabet <serval2412 at yahoo.fr>
CommitDate: Fri May 14 11:07:17 2021 +0200

    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 at collabora.com>
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>
    Tested-by: Jenkins

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);


More information about the Libreoffice-commits mailing list