mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4683 clang-format on all files in ApplicationCode
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- Equinor ASA
|
||||
//
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -21,10 +21,7 @@
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuQwtPlotItemGroup::RiuQwtPlotItemGroup()
|
||||
{
|
||||
|
||||
}
|
||||
RiuQwtPlotItemGroup::RiuQwtPlotItemGroup() {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@@ -32,11 +29,11 @@ RiuQwtPlotItemGroup::RiuQwtPlotItemGroup()
|
||||
RiuQwtPlotItemGroup::~RiuQwtPlotItemGroup()
|
||||
{
|
||||
this->detach();
|
||||
for (QwtPlotItem* item : m_plotItems)
|
||||
for ( QwtPlotItem* item : m_plotItems )
|
||||
{
|
||||
delete item;
|
||||
}
|
||||
for (QwtPlotItem* legendItem : m_legendItems)
|
||||
for ( QwtPlotItem* legendItem : m_legendItems )
|
||||
{
|
||||
delete legendItem;
|
||||
}
|
||||
@@ -45,27 +42,30 @@ RiuQwtPlotItemGroup::~RiuQwtPlotItemGroup()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuQwtPlotItemGroup::addPlotItem(QwtPlotItem* plotItem)
|
||||
void RiuQwtPlotItemGroup::addPlotItem( QwtPlotItem* plotItem )
|
||||
{
|
||||
m_plotItems.push_back(plotItem);
|
||||
m_plotItems.push_back( plotItem );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuQwtPlotItemGroup::addLegendItem(QwtPlotItem* legendItem)
|
||||
void RiuQwtPlotItemGroup::addLegendItem( QwtPlotItem* legendItem )
|
||||
{
|
||||
m_legendItems.push_back(legendItem);
|
||||
m_legendItems.push_back( legendItem );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuQwtPlotItemGroup::draw(QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect) const
|
||||
void RiuQwtPlotItemGroup::draw( QPainter* painter,
|
||||
const QwtScaleMap& xMap,
|
||||
const QwtScaleMap& yMap,
|
||||
const QRectF& canvasRect ) const
|
||||
{
|
||||
for (const QwtPlotItem* item : m_plotItems)
|
||||
for ( const QwtPlotItem* item : m_plotItems )
|
||||
{
|
||||
item->draw(painter, xMap, yMap, canvasRect);
|
||||
item->draw( painter, xMap, yMap, canvasRect );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,9 +75,9 @@ void RiuQwtPlotItemGroup::draw(QPainter *painter, const QwtScaleMap &xMap, const
|
||||
QRectF RiuQwtPlotItemGroup::boundingRect() const
|
||||
{
|
||||
QRectF totalBoundingRect;
|
||||
for (const QwtPlotItem* item : m_plotItems)
|
||||
for ( const QwtPlotItem* item : m_plotItems )
|
||||
{
|
||||
totalBoundingRect = totalBoundingRect.united(item->boundingRect());
|
||||
totalBoundingRect = totalBoundingRect.united( item->boundingRect() );
|
||||
}
|
||||
return totalBoundingRect;
|
||||
}
|
||||
@@ -85,26 +85,25 @@ QRectF RiuQwtPlotItemGroup::boundingRect() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QwtGraphic RiuQwtPlotItemGroup::legendIcon(int index, const QSizeF& size) const
|
||||
QwtGraphic RiuQwtPlotItemGroup::legendIcon( int index, const QSizeF& size ) const
|
||||
{
|
||||
QwtGraphic graphic;
|
||||
graphic.setDefaultSize(size);
|
||||
graphic.setDefaultSize( size );
|
||||
|
||||
QPainter painter(&graphic);
|
||||
painter.setRenderHint(QPainter::Antialiasing,
|
||||
testRenderHint(QwtPlotItem::RenderAntialiased));
|
||||
QPainter painter( &graphic );
|
||||
painter.setRenderHint( QPainter::Antialiasing, testRenderHint( QwtPlotItem::RenderAntialiased ) );
|
||||
|
||||
for (QwtPlotItem* legendItem : m_legendItems)
|
||||
for ( QwtPlotItem* legendItem : m_legendItems )
|
||||
{
|
||||
QwtGraphic subGraphic = legendItem->legendIcon(index, legendItem->legendIconSize());
|
||||
QRectF boundingRect = legendItem->boundingRect();
|
||||
QImage subImage = subGraphic.toImage();
|
||||
QRectF subRect(0.0, 0.0, legendItem->legendIconSize().width(), legendItem->legendIconSize().height());
|
||||
QwtGraphic subGraphic = legendItem->legendIcon( index, legendItem->legendIconSize() );
|
||||
QRectF boundingRect = legendItem->boundingRect();
|
||||
QImage subImage = subGraphic.toImage();
|
||||
QRectF subRect( 0.0, 0.0, legendItem->legendIconSize().width(), legendItem->legendIconSize().height() );
|
||||
// Symbols may not have a bounding width/height. Force the width height to be the same as the icon
|
||||
boundingRect.setWidth(subRect.width());
|
||||
boundingRect.setHeight(subRect.height());
|
||||
boundingRect.setWidth( subRect.width() );
|
||||
boundingRect.setHeight( subRect.height() );
|
||||
// Paint onto the existing icon
|
||||
painter.drawImage(boundingRect, subImage, subRect);
|
||||
painter.drawImage( boundingRect, subImage, subRect );
|
||||
}
|
||||
return graphic;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user