OpenCoverage

qgraphicslayoutstyleinfo.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/widgets/graphicsview/qgraphicslayoutstyleinfo.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Contact: https://www.qt.io/licensing/-
5**-
6** This file is part of the QtWidgets module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see https://www.qt.io/terms-conditions. For further-
15** information use the contact form at https://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 3 as published by the Free Software-
20** Foundation and appearing in the file LICENSE.LGPL3 included in the-
21** packaging of this file. Please review the following information to-
22** ensure the GNU Lesser General Public License version 3 requirements-
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
24**-
25** GNU General Public License Usage-
26** Alternatively, this file may be used under the terms of the GNU-
27** General Public License version 2.0 or (at your option) the GNU General-
28** Public license version 3 or any later version approved by the KDE Free-
29** Qt Foundation. The licenses are as published by the Free Software-
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
31** included in the packaging of this file. Please review the following-
32** information to ensure the GNU General Public License requirements will-
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
34** https://www.gnu.org/licenses/gpl-3.0.html.-
35**-
36** $QT_END_LICENSE$-
37**-
38****************************************************************************/-
39-
40#include "qgraphicslayoutstyleinfo_p.h"-
41-
42#ifndef QT_NO_GRAPHICSVIEW-
43-
44#include "qgraphicslayout_p.h"-
45#include "qgraphicswidget.h"-
46#include <QtWidgets/qstyle.h>-
47#include <QtWidgets/qwidget.h>-
48#include <QtWidgets/qapplication.h>-
49-
50QT_BEGIN_NAMESPACE-
51-
52QGraphicsLayoutStyleInfo::QGraphicsLayoutStyleInfo(const QGraphicsLayoutPrivate *layout)-
53 : m_layout(layout), m_style(0)-
54{-
55 m_widget = new QWidget; // pixelMetric might need a widget ptr-
56 if (m_widget)
m_widgetDescription
TRUEnever evaluated
FALSEnever evaluated
0
57 m_styleOption.initFrom(m_widget);
never executed: m_styleOption.initFrom(m_widget);
0
58 m_isWindow = m_styleOption.state & QStyle::State_Window;-
59}
never executed: end of block
0
60-
61QGraphicsLayoutStyleInfo::~QGraphicsLayoutStyleInfo()-
62{-
63 delete m_widget;-
64}
never executed: end of block
0
65-
66qreal QGraphicsLayoutStyleInfo::combinedLayoutSpacing(QLayoutPolicy::ControlTypes controls1,-
67 QLayoutPolicy::ControlTypes controls2,-
68 Qt::Orientation orientation) const-
69{-
70 Q_ASSERT(style());-
71 return style()->combinedLayoutSpacing(QSizePolicy::ControlTypes(int(controls1)), QSizePolicy::ControlTypes(int(controls2)),
never executed: return style()->combinedLayoutSpacing(QSizePolicy::ControlTypes(int(controls1)), QSizePolicy::ControlTypes(int(controls2)), orientation, const_cast<QStyleOption*>(&m_styleOption), widget());
0
72 orientation, const_cast<QStyleOption*>(&m_styleOption), widget());
never executed: return style()->combinedLayoutSpacing(QSizePolicy::ControlTypes(int(controls1)), QSizePolicy::ControlTypes(int(controls2)), orientation, const_cast<QStyleOption*>(&m_styleOption), widget());
0
73}-
74-
75qreal QGraphicsLayoutStyleInfo::perItemSpacing(QLayoutPolicy::ControlType control1,-
76 QLayoutPolicy::ControlType control2,-
77 Qt::Orientation orientation) const-
78{-
79 Q_ASSERT(style());-
80 return style()->layoutSpacing(QSizePolicy::ControlType(control1), QSizePolicy::ControlType(control2),
never executed: return style()->layoutSpacing(QSizePolicy::ControlType(control1), QSizePolicy::ControlType(control2), orientation, const_cast<QStyleOption*>(&m_styleOption), widget());
0
81 orientation, const_cast<QStyleOption*>(&m_styleOption), widget());
never executed: return style()->layoutSpacing(QSizePolicy::ControlType(control1), QSizePolicy::ControlType(control2), orientation, const_cast<QStyleOption*>(&m_styleOption), widget());
0
82}-
83-
84qreal QGraphicsLayoutStyleInfo::spacing(Qt::Orientation orientation) const-
85{-
86 Q_ASSERT(style());-
87 return style()->pixelMetric(orientation == Qt::Horizontal ? QStyle::PM_LayoutHorizontalSpacing : QStyle::PM_LayoutVerticalSpacing);
never executed: return style()->pixelMetric(orientation == Qt::Horizontal ? QStyle::PM_LayoutHorizontalSpacing : QStyle::PM_LayoutVerticalSpacing);
0
88}-
89-
90qreal QGraphicsLayoutStyleInfo::windowMargin(Qt::Orientation orientation) const-
91{-
92 return style()->pixelMetric(orientation == Qt::Vertical
never executed: return style()->pixelMetric(orientation == Qt::Vertical ? QStyle::PM_LayoutBottomMargin : QStyle::PM_LayoutRightMargin, const_cast<QStyleOption*>(&m_styleOption), widget());
0
93 ? QStyle::PM_LayoutBottomMargin
never executed: return style()->pixelMetric(orientation == Qt::Vertical ? QStyle::PM_LayoutBottomMargin : QStyle::PM_LayoutRightMargin, const_cast<QStyleOption*>(&m_styleOption), widget());
0
94 : QStyle::PM_LayoutRightMargin,
never executed: return style()->pixelMetric(orientation == Qt::Vertical ? QStyle::PM_LayoutBottomMargin : QStyle::PM_LayoutRightMargin, const_cast<QStyleOption*>(&m_styleOption), widget());
0
95 const_cast<QStyleOption*>(&m_styleOption), widget());
never executed: return style()->pixelMetric(orientation == Qt::Vertical ? QStyle::PM_LayoutBottomMargin : QStyle::PM_LayoutRightMargin, const_cast<QStyleOption*>(&m_styleOption), widget());
0
96}-
97-
98QWidget *QGraphicsLayoutStyleInfo::widget() const { return m_widget; }
never executed: return m_widget;
0
99-
100QStyle *QGraphicsLayoutStyleInfo::style() const-
101{-
102 if (!m_style) {
!m_styleDescription
TRUEnever evaluated
FALSEnever evaluated
0
103 Q_ASSERT(m_layout);-
104 QGraphicsItem *item = m_layout->parentItem();-
105 m_style = (item && item->isWidget()) ? static_cast<QGraphicsWidget*>(item)->style() : QApplication::style();
itemDescription
TRUEnever evaluated
FALSEnever evaluated
item->isWidget()Description
TRUEnever evaluated
FALSEnever evaluated
0
106 }
never executed: end of block
0
107 return m_style;
never executed: return m_style;
0
108}-
109-
110QT_END_NAMESPACE-
111-
112#endif // QT_NO_GRAPHICSVIEW-
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9