mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
cleanup: replace Q_FOREACH by range-based for in profile code
With Qt-containers, this might be a small pessimization, because it might lead to a deep copy. This can be "fixed" by for (const Type &item: qAsConst(container)) But frankly, I don't care. Ultimately it is probably best to replace the Qt containers by standard containers. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
4128fec1ea
commit
3f2e4e8b16
3 changed files with 8 additions and 11 deletions
|
@ -14,12 +14,10 @@ void ToolTipItem::addToolTip(const QString &toolTip, const QPixmap &pixmap)
|
|||
|
||||
QGraphicsPixmapItem *iconItem = 0;
|
||||
double yValue = title->boundingRect().height() + iconMetrics.spacing;
|
||||
Q_FOREACH (ToolTip t, toolTips) {
|
||||
for (ToolTip t: toolTips)
|
||||
yValue += t.second->boundingRect().height();
|
||||
}
|
||||
if (entryToolTip.second) {
|
||||
if (entryToolTip.second)
|
||||
yValue += entryToolTip.second->boundingRect().height();
|
||||
}
|
||||
iconItem = new QGraphicsPixmapItem(this);
|
||||
if (!pixmap.isNull())
|
||||
iconItem->setPixmap(pixmap);
|
||||
|
@ -36,7 +34,7 @@ void ToolTipItem::addToolTip(const QString &toolTip, const QPixmap &pixmap)
|
|||
|
||||
void ToolTipItem::clear()
|
||||
{
|
||||
Q_FOREACH (ToolTip t, toolTips) {
|
||||
for (ToolTip t: toolTips) {
|
||||
delete t.first;
|
||||
delete t.second;
|
||||
}
|
||||
|
@ -78,7 +76,7 @@ void ToolTipItem::expand()
|
|||
const IconMetrics &iconMetrics = defaultIconMetrics();
|
||||
|
||||
double width = 0, height = title->boundingRect().height() + iconMetrics.spacing;
|
||||
Q_FOREACH (const ToolTip &t, toolTips) {
|
||||
for (const ToolTip &t: toolTips) {
|
||||
QRectF sRect = t.second->boundingRect();
|
||||
if (sRect.width() > width)
|
||||
width = sRect.width();
|
||||
|
@ -186,9 +184,8 @@ void ToolTipItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
|||
{
|
||||
persistPos();
|
||||
QGraphicsRectItem::mouseReleaseEvent(event);
|
||||
Q_FOREACH (QGraphicsItem *item, oldSelection) {
|
||||
for (QGraphicsItem *item: oldSelection)
|
||||
item->setSelected(true);
|
||||
}
|
||||
}
|
||||
|
||||
void ToolTipItem::persistPos() const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue