diff --git a/src/ui/include/predefinedfilterscombobox.h b/src/ui/include/predefinedfilterscombobox.h index 6d97ac2d7..d45714235 100644 --- a/src/ui/include/predefinedfilterscombobox.h +++ b/src/ui/include/predefinedfilterscombobox.h @@ -59,7 +59,7 @@ class PredefinedFiltersComboBox final : public QComboBox { PredefinedFiltersComboBox& operator=( PredefinedFiltersComboBox&& other ) = delete; void populatePredefinedFilters(); - void updateSearchPattern( const QString newSearchPattern, bool useLogicalCombining ); + void updateSearchPattern( const QString& newSearchPattern, bool useLogicalCombining ); virtual void showPopup(); diff --git a/src/ui/include/selection.h b/src/ui/include/selection.h index fddd43e8f..1a788da07 100644 --- a/src/ui/include/selection.h +++ b/src/ui/include/selection.h @@ -162,7 +162,7 @@ class Selection { FilePosition getPreviousPosition() const; private: - std::map + std::vector> getSelectionWithLineNumbers( const AbstractLogData* logData ) const; private: diff --git a/src/ui/src/abstractlogview.cpp b/src/ui/src/abstractlogview.cpp index f53d457eb..e12cd20d2 100644 --- a/src/ui/src/abstractlogview.cpp +++ b/src/ui/src/abstractlogview.cpp @@ -2575,6 +2575,8 @@ void AbstractLogView::drawTextArea( QPaintDevice* paintDevice ) painter->drawText( lineNumberAreaStartX + LineNumberPadding, yPos + fontAscent, lineNumberStr ); } + + wrappedLinesInfo_.reserve(wrappedLinesInfo_.size() + wrappedLineView.wrappedLinesCount()); for ( size_t i = 0u; i < wrappedLineView.wrappedLinesCount(); ++i ) { wrappedLinesInfo_.emplace_back( WrappedLineData{ lineNumber, i, wrappedLineView } ); } diff --git a/src/ui/src/predefinedfilterscombobox.cpp b/src/ui/src/predefinedfilterscombobox.cpp index 665ed9a09..b330eb3c9 100644 --- a/src/ui/src/predefinedfilterscombobox.cpp +++ b/src/ui/src/predefinedfilterscombobox.cpp @@ -119,7 +119,7 @@ void PredefinedFiltersComboBox::populatePredefinedFilters() this->setModel( model_ ); } -void PredefinedFiltersComboBox::updateSearchPattern( const QString newSearchPattern, bool useLogicalCombining ) +void PredefinedFiltersComboBox::updateSearchPattern( const QString& newSearchPattern, bool useLogicalCombining ) { searchPattern_.newOne_ = newSearchPattern; searchPattern_.useLogicalCombining_ = useLogicalCombining; diff --git a/src/ui/src/selection.cpp b/src/ui/src/selection.cpp index 348d997a6..03843aca4 100644 --- a/src/ui/src/selection.cpp +++ b/src/ui/src/selection.cpp @@ -189,29 +189,30 @@ QString Selection::getSelectedText( const AbstractLogData* logData, bool lineNum return text; } -std::map +std::vector> Selection::getSelectionWithLineNumbers( const AbstractLogData* logData ) const { - std::map selectionData; + std::vector> selectionData; if ( selectedLine_.has_value() ) { - selectionData.emplace( logData->getLineNumber( selectedLine_.value() ), + selectionData.emplace_back( logData->getLineNumber( selectedLine_.value() ), logData->getLineString( *selectedLine_ ) ); } else if ( selectedPartial_.line.has_value() ) { - selectionData.emplace( + selectionData.emplace_back( logData->getLineNumber( selectedPartial_.line.value() ), logData->getExpandedLineString( *selectedPartial_.line ) .mid( selectedPartial_.startColumn.get(), selectedPartial_.size().get() ) ); } else if ( selectedRange_.startLine.has_value() ) { - const auto list = logData->getLines( *selectedRange_.startLine, selectedRange_.size() ); - LineNumber ln = *selectedRange_.startLine; + const auto list = logData->getLines( selectedRange_.startLine.value(), selectedRange_.size() ); + LineNumber ln = selectedRange_.startLine.value(); + selectionData.reserve(list.size()); for ( const auto& line : list ) { - selectionData.emplace( logData->getLineNumber( ln ), line ); - ln++; + selectionData.emplace_back( logData->getLineNumber( ln ), line ); + ++ln; } }