From b87de8976774dcbd2919d3ddf63feee39db9e373 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Pereira?= Date: Thu, 11 Apr 2019 12:46:23 +0100 Subject: [PATCH] Use braced initializer list in returns Replaces explicit calls to the constructor in a return with a braced initializer list. --- lib/CharacterColor.h | 2 +- lib/Emulation.cpp | 2 +- lib/Pty.cpp | 2 +- lib/ScreenWindow.cpp | 2 +- lib/TerminalDisplay.cpp | 8 ++++---- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/CharacterColor.h b/lib/CharacterColor.h index a5a5e67..737feea 100644 --- a/lib/CharacterColor.h +++ b/lib/CharacterColor.h @@ -278,7 +278,7 @@ inline QColor CharacterColor::color(const ColorEntry* base) const case COLOR_SPACE_DEFAULT: return base[_u+0+(_v?BASE_COLORS:0)].color; case COLOR_SPACE_SYSTEM: return base[_u+2+(_v?BASE_COLORS:0)].color; case COLOR_SPACE_256: return color256(_u,base); - case COLOR_SPACE_RGB: return QColor(_u,_v,_w); + case COLOR_SPACE_RGB: return {_u,_v,_w}; case COLOR_SPACE_UNDEFINED: return QColor(); } diff --git a/lib/Emulation.cpp b/lib/Emulation.cpp index 4e8b1a3..10efe44 100644 --- a/lib/Emulation.cpp +++ b/lib/Emulation.cpp @@ -380,7 +380,7 @@ void Emulation::setImageSize(int lines, int columns) QSize Emulation::imageSize() const { - return QSize(_currentScreen->getColumns(), _currentScreen->getLines()); + return {_currentScreen->getColumns(), _currentScreen->getLines()}; } ushort ExtendedCharTable::extendedCharHash(ushort* unicodePoints , ushort length) const diff --git a/lib/Pty.cpp b/lib/Pty.cpp index e3cc62f..724527c 100644 --- a/lib/Pty.cpp +++ b/lib/Pty.cpp @@ -56,7 +56,7 @@ void Pty::setWindowSize(int lines, int cols) } QSize Pty::windowSize() const { - return QSize(_windowColumns,_windowLines); + return {_windowColumns,_windowLines}; } void Pty::setFlowControlEnabled(bool enable) diff --git a/lib/ScreenWindow.cpp b/lib/ScreenWindow.cpp index 22e9b08..d1ccfd9 100644 --- a/lib/ScreenWindow.cpp +++ b/lib/ScreenWindow.cpp @@ -259,7 +259,7 @@ QRect ScreenWindow::scrollRegion() const if ( atEndOfOutput() && equalToScreenSize ) return _screen->lastScrolledRegion(); else - return QRect(0,0,windowColumns(),windowLines()); + return {0,0,windowColumns(),windowLines()}; } void ScreenWindow::notifyOutputChanged() diff --git a/lib/TerminalDisplay.cpp b/lib/TerminalDisplay.cpp index fe22508..1cc0fad 100644 --- a/lib/TerminalDisplay.cpp +++ b/lib/TerminalDisplay.cpp @@ -1390,7 +1390,7 @@ QPoint TerminalDisplay::cursorPosition() const if (_screenWindow) return _screenWindow->cursorPosition(); else - return QPoint(0,0); + return {0,0}; } QRect TerminalDisplay::preeditRect() const @@ -1398,7 +1398,7 @@ QRect TerminalDisplay::preeditRect() const const int preeditLength = string_width(_inputMethodData.preeditString); if ( preeditLength == 0 ) - return QRect(); + return {}; return QRect(_leftMargin + _fontWidth*cursorPosition().x(), _topMargin + _fontHeight*cursorPosition().y(), @@ -1560,10 +1560,10 @@ QRect TerminalDisplay::calculateTextArea(int topLeftX, int topLeftY, int startCo int left = _fixedFont ? _fontWidth * startColumn : textWidth(0, startColumn, line); int top = _fontHeight * line; int width = _fixedFont ? _fontWidth * length : textWidth(startColumn, length, line); - return QRect(_leftMargin + topLeftX + left, + return {_leftMargin + topLeftX + left, _topMargin + topLeftY + top, width, - _fontHeight); + _fontHeight}; } void TerminalDisplay::drawContents(QPainter &paint, const QRect &rect)