| Line | Source Code | Coverage |
|---|
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | namespace { | - |
| 5 | | - |
| 6 | | - |
| 7 | template <class T, int NumColumns> | - |
| 8 | class FixedColumnMatrix { | - |
| 9 | public: | - |
| 10 | typedef QVector<T> Storage; | - |
| 11 | | - |
| 12 | FixedColumnMatrix() { } | - |
| 13 | | - |
| 14 | void clear() { m_storage.clear(); } executed: }Execution Count:20 | 20 |
| 15 | | - |
| 16 | const T &operator()(int r, int c) const { return m_storage[r * NumColumns + c]; } executed: return m_storage[r * NumColumns + c];Execution Count:49 | 49 |
| 17 | T &operator()(int r, int c) { return m_storage[r * NumColumns + c]; } executed: return m_storage[r * NumColumns + c];Execution Count:480 | 480 |
| 18 | | - |
| 19 | int rowCount() const { return m_storage.size() / NumColumns; } executed: return m_storage.size() / NumColumns;Execution Count:275 | 275 |
| 20 | void addRow(const T &value); | - |
| 21 | void insertRow(int r, const T &value); | - |
| 22 | void removeRow(int r); | - |
| 23 | | - |
| 24 | bool find(const T &value, int *rowPtr, int *colPtr) const ; | - |
| 25 | int count(const T &value) const { return m_storage.count(value); } never executed: return m_storage.count(value); | 0 |
| 26 | | - |
| 27 | | - |
| 28 | const Storage &storage() const { return m_storage; } executed: return m_storage;Execution Count:59 | 59 |
| 29 | | - |
| 30 | static void storageIndexToPosition(int idx, int *rowPtr, int *colPtr); | - |
| 31 | | - |
| 32 | private: | - |
| 33 | Storage m_storage; | - |
| 34 | }; | - |
| 35 | | - |
| 36 | template <class T, int NumColumns> | - |
| 37 | void FixedColumnMatrix<T, NumColumns>::addRow(const T &value) | - |
| 38 | { | - |
| 39 | for (int i = 0; i < NumColumns; ++i) never evaluated: i < NumColumns | 0 |
| 40 | m_storage.append(value); never executed: m_storage.append(value); | 0 |
| 41 | } | 0 |
| 42 | | - |
| 43 | template <class T, int NumColumns> | - |
| 44 | void FixedColumnMatrix<T, NumColumns>::insertRow(int r, const T &value) | - |
| 45 | { | - |
| 46 | typename Storage::iterator it = m_storage.begin(); | - |
| 47 | it += r * NumColumns; | - |
| 48 | m_storage.insert(it, NumColumns, value); | - |
| 49 | } executed: }Execution Count:72 | 72 |
| 50 | | - |
| 51 | template <class T, int NumColumns> | - |
| 52 | void FixedColumnMatrix<T, NumColumns>::removeRow(int r) | - |
| 53 | { | - |
| 54 | m_storage.remove(r * NumColumns, NumColumns); | - |
| 55 | } | 0 |
| 56 | | - |
| 57 | template <class T, int NumColumns> | - |
| 58 | bool FixedColumnMatrix<T, NumColumns>::find(const T &value, int *rowPtr, int *colPtr) const | - |
| 59 | { | - |
| 60 | const int idx = m_storage.indexOf(value); | - |
| 61 | if (idx == -1) never evaluated: idx == -1 | 0 |
| 62 | return false; never executed: return false; | 0 |
| 63 | storageIndexToPosition(idx, rowPtr, colPtr); | - |
| 64 | return true; never executed: return true; | 0 |
| 65 | } | - |
| 66 | | - |
| 67 | template <class T, int NumColumns> | - |
| 68 | void FixedColumnMatrix<T, NumColumns>::storageIndexToPosition(int idx, int *rowPtr, int *colPtr) | - |
| 69 | { | - |
| 70 | *rowPtr = idx / NumColumns; | - |
| 71 | *colPtr = idx % NumColumns; | - |
| 72 | } executed: }Execution Count:39 | 39 |
| 73 | } | - |
| 74 | | - |
| 75 | | - |
| 76 | | - |
| 77 | const uint DefaultFieldGrowthPolicy = 255; | - |
| 78 | const uint DefaultRowWrapPolicy = 255; | - |
| 79 | | - |
| 80 | enum { ColumnCount = 2 }; | - |
| 81 | | - |
| 82 | | - |
| 83 | | - |
| 84 | struct QFormLayoutItem | - |
| 85 | { | - |
| 86 | QFormLayoutItem(QLayoutItem* i) : item(i), fullRow(false), isHfw(false) { } executed: }Execution Count:95 | 95 |
| 87 | ~QFormLayoutItem() { delete item; } executed: }Execution Count:95 | 95 |
| 88 | | - |
| 89 | | - |
| 90 | QWidget *widget() const { return item->widget(); } executed: return item->widget();Execution Count:118 | 118 |
| 91 | QLayout *layout() const { return item->layout(); } never executed: return item->layout(); | 0 |
| 92 | | - |
| 93 | bool hasHeightForWidth() const { return item->hasHeightForWidth(); } never executed: return item->hasHeightForWidth(); | 0 |
| 94 | int heightForWidth(int width) const { return item->heightForWidth(width); } never executed: return item->heightForWidth(width); | 0 |
| 95 | int minimumHeightForWidth(int width) const { return item->minimumHeightForWidth(width); } never executed: return item->minimumHeightForWidth(width); | 0 |
| 96 | Qt::Orientations expandingDirections() const { return item->expandingDirections(); } executed: return item->expandingDirections();Execution Count:104 | 104 |
| 97 | QSizePolicy::ControlTypes controlTypes() const { return item->controlTypes(); } never executed: return item->controlTypes(); | 0 |
| 98 | int vStretch() const { return widget() ? widget()->sizePolicy().verticalStretch() : 0; } executed: return widget() ? widget()->sizePolicy().verticalStretch() : 0;Execution Count:60 | 60 |
| 99 | | - |
| 100 | void setGeometry(const QRect& r) { item->setGeometry(r); } executed: }Execution Count:32 | 32 |
| 101 | QRect geometry() const { return item->geometry(); } executed: return item->geometry();Execution Count:29 | 29 |
| 102 | | - |
| 103 | | - |
| 104 | bool operator==(const QFormLayoutItem& other) { return item == other.item; } never executed: return item == other.item; | 0 |
| 105 | | - |
| 106 | QLayoutItem *item; | - |
| 107 | bool fullRow; | - |
| 108 | | - |
| 109 | | - |
| 110 | bool isHfw; | - |
| 111 | QSize minSize; | - |
| 112 | QSize sizeHint; | - |
| 113 | QSize maxSize; | - |
| 114 | | - |
| 115 | | - |
| 116 | int sbsHSpace; | - |
| 117 | int vSpace; | - |
| 118 | | - |
| 119 | | - |
| 120 | bool sideBySide; | - |
| 121 | int vLayoutIndex; | - |
| 122 | | - |
| 123 | | - |
| 124 | int layoutPos; | - |
| 125 | int layoutWidth; | - |
| 126 | }; | - |
| 127 | | - |
| 128 | class QFormLayoutPrivate : public QLayoutPrivate | - |
| 129 | { | - |
| 130 | inline QFormLayout* q_func() { return static_cast<QFormLayout *>(q_ptr); } inline const QFormLayout* q_func() const { return static_cast<const QFormLayout *>(q_ptr); } friend class QFormLayout; | - |
| 131 | | - |
| 132 | public: | - |
| 133 | typedef FixedColumnMatrix<QFormLayoutItem *, ColumnCount> ItemMatrix; | - |
| 134 | | - |
| 135 | QFormLayoutPrivate(); | - |
| 136 | ~QFormLayoutPrivate() { } | - |
| 137 | | - |
| 138 | int insertRow(int row); | - |
| 139 | void insertRows(int row, int count); | - |
| 140 | void setItem(int row, QFormLayout::ItemRole role, QLayoutItem *item); | - |
| 141 | void setLayout(int row, QFormLayout::ItemRole role, QLayout *layout); | - |
| 142 | void setWidget(int row, QFormLayout::ItemRole role, QWidget *widget); | - |
| 143 | | - |
| 144 | void arrangeWidgets(const QVector<QLayoutStruct>& layouts, QRect &rect); | - |
| 145 | | - |
| 146 | void updateSizes(); | - |
| 147 | | - |
| 148 | void setupVerticalLayoutData(int width); | - |
| 149 | void setupHorizontalLayoutData(int width); | - |
| 150 | | - |
| 151 | QStyle* getStyle() const; | - |
| 152 | | - |
| 153 | inline bool haveHfwCached(int width) const | - |
| 154 | { | - |
| 155 | return (hfw_width == width) || (width == sh_width && hfw_sh_height >= 0); executed: return (hfw_width == width) || (width == sh_width && hfw_sh_height >= 0);Execution Count:5 | 5 |
| 156 | } | - |
| 157 | | - |
| 158 | void recalcHFW(int w); | - |
| 159 | void setupHfwLayoutData(); | - |
| 160 | | - |
| 161 | uint fieldGrowthPolicy : 8; | - |
| 162 | uint rowWrapPolicy : 8; | - |
| 163 | uint has_hfw : 2; | - |
| 164 | uint dirty : 2; | - |
| 165 | uint sizesDirty : 2; | - |
| 166 | uint expandVertical : 1; | - |
| 167 | uint expandHorizontal : 1; | - |
| 168 | Qt::Alignment labelAlignment; | - |
| 169 | Qt::Alignment formAlignment; | - |
| 170 | | - |
| 171 | ItemMatrix m_matrix; | - |
| 172 | QList<QFormLayoutItem *> m_things; | - |
| 173 | | - |
| 174 | int layoutWidth; | - |
| 175 | | - |
| 176 | int hfw_width; | - |
| 177 | int hfw_height; | - |
| 178 | int hfw_minheight; | - |
| 179 | | - |
| 180 | int hfw_sh_height; | - |
| 181 | int hfw_sh_minheight; | - |
| 182 | | - |
| 183 | int min_width; | - |
| 184 | int sh_width; | - |
| 185 | int thresh_width; | - |
| 186 | QSize minSize; | - |
| 187 | QSize prefSize; | - |
| 188 | int formMaxWidth; | - |
| 189 | void calcSizeHints(); | - |
| 190 | | - |
| 191 | QVector<QLayoutStruct> vLayouts; | - |
| 192 | int vLayoutCount; | - |
| 193 | int maxLabelWidth; | - |
| 194 | | - |
| 195 | QVector<QLayoutStruct> hfwLayouts; | - |
| 196 | | - |
| 197 | int hSpacing; | - |
| 198 | int vSpacing; | - |
| 199 | }; | - |
| 200 | | - |
| 201 | QFormLayoutPrivate::QFormLayoutPrivate() | - |
| 202 | : fieldGrowthPolicy(DefaultFieldGrowthPolicy), | - |
| 203 | rowWrapPolicy(DefaultRowWrapPolicy), has_hfw(false), dirty(true), sizesDirty(true), | - |
| 204 | expandVertical(0), expandHorizontal(0), labelAlignment(0), formAlignment(0), | - |
| 205 | layoutWidth(-1), hfw_width(-1), hfw_sh_height(-1), min_width(-1), | - |
| 206 | sh_width(-1), thresh_width(QLAYOUTSIZE_MAX), hSpacing(-1), vSpacing(-1) | - |
| 207 | { | - |
| 208 | } executed: }Execution Count:20 | 20 |
| 209 | | - |
| 210 | static Qt::Alignment fixedAlignment(Qt::Alignment alignment, Qt::LayoutDirection layoutDirection) | - |
| 211 | { | - |
| 212 | if (layoutDirection == Qt::RightToLeft && alignment & Qt::AlignAbsolute) { partially evaluated: layoutDirection == Qt::RightToLeft| no Evaluation Count:0 | yes Evaluation Count:28 |
never evaluated: alignment & Qt::AlignAbsolute | 0-28 |
| 213 | | - |
| 214 | return Qt::Alignment((alignment & ~(Qt::AlignLeft | Qt::AlignRight | Qt::AlignAbsolute)) | 0 |
| 215 | | ((alignment & Qt::AlignRight) ? Qt::AlignLeft : 0) | 0 |
| 216 | | ((alignment & Qt::AlignLeft) ? Qt::AlignRight : 0)); never executed: return Qt::Alignment((alignment & ~(Qt::AlignLeft | Qt::AlignRight | Qt::AlignAbsolute)) | ((alignment & Qt::AlignRight) ? Qt::AlignLeft : 0) | ((alignment & Qt::AlignLeft) ? Qt::AlignRight : 0)); | 0 |
| 217 | } else { | - |
| 218 | return alignment & ~Qt::AlignAbsolute; executed: return alignment & ~Qt::AlignAbsolute;Execution Count:28 | 28 |
| 219 | } | - |
| 220 | } | - |
| 221 | | - |
| 222 | static int storageIndexFromLayoutItem(const QFormLayoutPrivate::ItemMatrix &m, | - |
| 223 | QFormLayoutItem *item) | - |
| 224 | { | - |
| 225 | if (item) { evaluated: item| yes Evaluation Count:39 | yes Evaluation Count:4 |
| 4-39 |
| 226 | return m.storage().indexOf(item); executed: return m.storage().indexOf(item);Execution Count:39 | 39 |
| 227 | } else { | - |
| 228 | return -1; executed: return -1;Execution Count:4 | 4 |
| 229 | } | - |
| 230 | } | - |
| 231 | | - |
| 232 | static void updateFormLayoutItem(QFormLayoutItem *item, int userVSpacing, | - |
| 233 | QFormLayout::FieldGrowthPolicy fieldGrowthPolicy, | - |
| 234 | bool fullRow) | - |
| 235 | { | - |
| 236 | item->minSize = item->item->minimumSize(); | - |
| 237 | item->sizeHint = item->item->sizeHint(); | - |
| 238 | item->maxSize = item->item->maximumSize(); | - |
| 239 | | - |
| 240 | if (!fullRow && (fieldGrowthPolicy == QFormLayout::FieldsStayAtSizeHint partially evaluated: !fullRow| yes Evaluation Count:26 | no Evaluation Count:0 |
evaluated: fieldGrowthPolicy == QFormLayout::FieldsStayAtSizeHint| yes Evaluation Count:6 | yes Evaluation Count:20 |
| 0-26 |
| 241 | || (fieldGrowthPolicy == QFormLayout::ExpandingFieldsGrow evaluated: fieldGrowthPolicy == QFormLayout::ExpandingFieldsGrow| yes Evaluation Count:6 | yes Evaluation Count:14 |
| 6-14 |
| 242 | && !(item->item->expandingDirections() & Qt::Horizontal)))) evaluated: !(item->item->expandingDirections() & Qt::Horizontal)| yes Evaluation Count:5 | yes Evaluation Count:1 |
| 1-5 |
| 243 | item->maxSize.setWidth(item->sizeHint.width()); executed: item->maxSize.setWidth(item->sizeHint.width());Execution Count:11 | 11 |
| 244 | | - |
| 245 | item->isHfw = item->item->hasHeightForWidth(); | - |
| 246 | item->vSpace = userVSpacing; | - |
| 247 | } executed: }Execution Count:26 | 26 |
| 248 | | - |
| 249 | | - |
| 250 | | - |
| 251 | | - |
| 252 | | - |
| 253 | | - |
| 254 | | - |
| 255 | void QFormLayoutPrivate::updateSizes() | - |
| 256 | { | - |
| 257 | QFormLayout * const q = q_func(); | - |
| 258 | | - |
| 259 | if (sizesDirty) { evaluated: sizesDirty| yes Evaluation Count:7 | yes Evaluation Count:47 |
| 7-47 |
| 260 | QFormLayout::RowWrapPolicy wrapPolicy = q->rowWrapPolicy(); | - |
| 261 | bool wrapAllRows = (wrapPolicy == QFormLayout::WrapAllRows); | - |
| 262 | bool dontWrapRows = (wrapPolicy == QFormLayout::DontWrapRows); | - |
| 263 | int rr = m_matrix.rowCount(); | - |
| 264 | | - |
| 265 | has_hfw = false; | - |
| 266 | | - |
| 267 | | - |
| 268 | | - |
| 269 | bool expandH = false; | - |
| 270 | bool expandV = false; | - |
| 271 | | - |
| 272 | QFormLayoutItem *prevLbl = 0; | - |
| 273 | QFormLayoutItem *prevFld = 0; | - |
| 274 | | - |
| 275 | QWidget *parent = q->parentWidget(); | - |
| 276 | QStyle *style = parent ? parent->style() : 0; partially evaluated: parent| yes Evaluation Count:7 | no Evaluation Count:0 |
| 0-7 |
| 277 | | - |
| 278 | int userVSpacing = q->verticalSpacing(); | - |
| 279 | int userHSpacing = wrapAllRows ? 0 : q->horizontalSpacing(); partially evaluated: wrapAllRows| no Evaluation Count:0 | yes Evaluation Count:7 |
| 0-7 |
| 280 | | - |
| 281 | int maxMinLblWidth = 0; | - |
| 282 | int maxMinFldWidth = 0; | - |
| 283 | int maxMinIfldWidth = 0; | - |
| 284 | | - |
| 285 | int maxShLblWidth = 0; | - |
| 286 | int maxShFldWidth = 0; | - |
| 287 | int maxShIfldWidth = 0; | - |
| 288 | | - |
| 289 | for (int i = 0; i < rr; ++i) { evaluated: i < rr| yes Evaluation Count:14 | yes Evaluation Count:7 |
| 7-14 |
| 290 | QFormLayoutItem *label = m_matrix(i, 0); | - |
| 291 | QFormLayoutItem *field = m_matrix(i, 1); | - |
| 292 | | - |
| 293 | | - |
| 294 | if (!label && !field) partially evaluated: !label| no Evaluation Count:0 | yes Evaluation Count:14 |
| 0-14 |
| 295 | continue; never executed: continue; | 0 |
| 296 | | - |
| 297 | if (label) { partially evaluated: label| yes Evaluation Count:14 | no Evaluation Count:0 |
| 0-14 |
| 298 | updateFormLayoutItem(label, userVSpacing, q->fieldGrowthPolicy(), false); | - |
| 299 | if (label->isHfw) partially evaluated: label->isHfw| no Evaluation Count:0 | yes Evaluation Count:14 |
| 0-14 |
| 300 | has_hfw = true; never executed: has_hfw = true; | 0 |
| 301 | Qt::Orientations o = label->expandingDirections(); | - |
| 302 | | - |
| 303 | if (o & Qt::Vertical) partially evaluated: o & Qt::Vertical| no Evaluation Count:0 | yes Evaluation Count:14 |
| 0-14 |
| 304 | expandV = true; never executed: expandV = true; | 0 |
| 305 | if (o & Qt::Horizontal) partially evaluated: o & Qt::Horizontal| no Evaluation Count:0 | yes Evaluation Count:14 |
| 0-14 |
| 306 | expandH = true; never executed: expandH = true; | 0 |
| 307 | } executed: }Execution Count:14 | 14 |
| 308 | if (field) { evaluated: field| yes Evaluation Count:12 | yes Evaluation Count:2 |
| 2-12 |
| 309 | updateFormLayoutItem(field, userVSpacing, q->fieldGrowthPolicy(), !label && field->fullRow); | - |
| 310 | field->sbsHSpace = (!label && field->fullRow) ? 0 : userHSpacing; partially evaluated: !label| no Evaluation Count:0 | yes Evaluation Count:12 |
never evaluated: field->fullRow | 0-12 |
| 311 | if (field->isHfw) partially evaluated: field->isHfw| no Evaluation Count:0 | yes Evaluation Count:12 |
| 0-12 |
| 312 | has_hfw = true; never executed: has_hfw = true; | 0 |
| 313 | | - |
| 314 | Qt::Orientations o = field->expandingDirections(); | - |
| 315 | | - |
| 316 | if (o & Qt::Vertical) partially evaluated: o & Qt::Vertical| no Evaluation Count:0 | yes Evaluation Count:12 |
| 0-12 |
| 317 | expandV = true; never executed: expandV = true; | 0 |
| 318 | if (o & Qt::Horizontal) evaluated: o & Qt::Horizontal| yes Evaluation Count:4 | yes Evaluation Count:8 |
| 4-8 |
| 319 | expandH = true; executed: expandH = true;Execution Count:4 | 4 |
| 320 | } executed: }Execution Count:12 | 12 |
| 321 | | - |
| 322 | | - |
| 323 | if ((userHSpacing < 0 || userVSpacing < 0) && style) { partially evaluated: userHSpacing < 0| no Evaluation Count:0 | yes Evaluation Count:14 |
partially evaluated: userVSpacing < 0| no Evaluation Count:0 | yes Evaluation Count:14 |
| 0-14 |
| 324 | QSizePolicy::ControlTypes lbltypes = | - |
| 325 | QSizePolicy::ControlTypes(label ? label->controlTypes() : QSizePolicy::DefaultType); | - |
| 326 | QSizePolicy::ControlTypes fldtypes = | - |
| 327 | QSizePolicy::ControlTypes(field ? field->controlTypes() : QSizePolicy::DefaultType); | - |
| 328 | | - |
| 329 | | - |
| 330 | if (userVSpacing < 0) { never evaluated: userVSpacing < 0 | 0 |
| 331 | if (wrapAllRows) { never evaluated: wrapAllRows | 0 |
| 332 | | - |
| 333 | QFormLayoutItem *lbltop = prevFld ? prevFld : prevLbl; | 0 |
| 334 | | - |
| 335 | QFormLayoutItem *fldtop = label ? label : lbltop; | 0 |
| 336 | QSizePolicy::ControlTypes lbltoptypes = | - |
| 337 | QSizePolicy::ControlTypes(lbltop ? lbltop->controlTypes() : QSizePolicy::DefaultType); | - |
| 338 | QSizePolicy::ControlTypes fldtoptypes = | - |
| 339 | QSizePolicy::ControlTypes(fldtop ? fldtop->controlTypes() : QSizePolicy::DefaultType); | - |
| 340 | if (label && lbltop) | 0 |
| 341 | label->vSpace = style->combinedLayoutSpacing(lbltoptypes, lbltypes, Qt::Vertical, 0, parent); never executed: label->vSpace = style->combinedLayoutSpacing(lbltoptypes, lbltypes, Qt::Vertical, 0, parent); | 0 |
| 342 | if (field && fldtop) | 0 |
| 343 | field->vSpace = style->combinedLayoutSpacing(fldtoptypes, fldtypes, Qt::Vertical, 0, parent); never executed: field->vSpace = style->combinedLayoutSpacing(fldtoptypes, fldtypes, Qt::Vertical, 0, parent); | 0 |
| 344 | } else { | 0 |
| 345 | | - |
| 346 | | - |
| 347 | QFormLayoutItem *lbltop = prevLbl ? prevLbl : prevFld; | 0 |
| 348 | QFormLayoutItem *fldtop = prevFld; | - |
| 349 | QSizePolicy::ControlTypes lbltoptypes = | - |
| 350 | QSizePolicy::ControlTypes(lbltop ? lbltop->controlTypes() : QSizePolicy::DefaultType); | - |
| 351 | QSizePolicy::ControlTypes fldtoptypes = | - |
| 352 | QSizePolicy::ControlTypes(fldtop ? fldtop->controlTypes() : QSizePolicy::DefaultType); | - |
| 353 | | - |
| 354 | | - |
| 355 | if (label) { | 0 |
| 356 | if (!field) { | 0 |
| 357 | int lblspacing = style->combinedLayoutSpacing(lbltoptypes, lbltypes, Qt::Vertical, 0, parent); | - |
| 358 | int fldspacing = style->combinedLayoutSpacing(fldtoptypes, lbltypes, Qt::Vertical, 0, parent); | - |
| 359 | label->vSpace = qMax(lblspacing, fldspacing); | - |
| 360 | } else | 0 |
| 361 | label->vSpace = style->combinedLayoutSpacing(lbltoptypes, lbltypes, Qt::Vertical, 0, parent); never executed: label->vSpace = style->combinedLayoutSpacing(lbltoptypes, lbltypes, Qt::Vertical, 0, parent); | 0 |
| 362 | } | - |
| 363 | | - |
| 364 | if (field) { | 0 |
| 365 | | - |
| 366 | if (!label) { | 0 |
| 367 | int lblspacing = style->combinedLayoutSpacing(lbltoptypes, fldtypes, Qt::Vertical, 0, parent); | - |
| 368 | int fldspacing = style->combinedLayoutSpacing(fldtoptypes, fldtypes, Qt::Vertical, 0, parent); | - |
| 369 | field->vSpace = qMax(lblspacing, fldspacing); | - |
| 370 | } else | 0 |
| 371 | field->vSpace = style->combinedLayoutSpacing(fldtoptypes, fldtypes, Qt::Vertical, 0, parent); never executed: field->vSpace = style->combinedLayoutSpacing(fldtoptypes, fldtypes, Qt::Vertical, 0, parent); | 0 |
| 372 | } | - |
| 373 | } | 0 |
| 374 | } | - |
| 375 | | - |
| 376 | | - |
| 377 | | - |
| 378 | | - |
| 379 | if (userHSpacing < 0 && !wrapAllRows && (label || !field->fullRow) && field) never evaluated: userHSpacing < 0 never evaluated: !wrapAllRows never evaluated: !field->fullRow | 0 |
| 380 | field->sbsHSpace = style->combinedLayoutSpacing(QSizePolicy::Label, QSizePolicy::LineEdit, Qt::Horizontal, 0, parent); never executed: field->sbsHSpace = style->combinedLayoutSpacing(QSizePolicy::Label, QSizePolicy::LineEdit, Qt::Horizontal, 0, parent); | 0 |
| 381 | } | 0 |
| 382 | if (label) { partially evaluated: label| yes Evaluation Count:14 | no Evaluation Count:0 |
| 0-14 |
| 383 | maxMinLblWidth = qMax(maxMinLblWidth, label->minSize.width()); | - |
| 384 | maxShLblWidth = qMax(maxShLblWidth, label->sizeHint.width()); | - |
| 385 | if (field) { evaluated: field| yes Evaluation Count:12 | yes Evaluation Count:2 |
| 2-12 |
| 386 | maxMinFldWidth = qMax(maxMinFldWidth, field->minSize.width() + field->sbsHSpace); | - |
| 387 | maxShFldWidth = qMax(maxShFldWidth, field->sizeHint.width() + field->sbsHSpace); | - |
| 388 | } executed: }Execution Count:12 | 12 |
| 389 | } else if (field) { executed: }Execution Count:14 | 0-14 |
| 390 | maxMinIfldWidth = qMax(maxMinIfldWidth, field->minSize.width()); | - |
| 391 | maxShIfldWidth = qMax(maxShIfldWidth, field->sizeHint.width()); | - |
| 392 | } | 0 |
| 393 | | - |
| 394 | prevLbl = label; | - |
| 395 | prevFld = field; | - |
| 396 | } executed: }Execution Count:14 | 14 |
| 397 | | - |
| 398 | | - |
| 399 | if (wrapAllRows) { partially evaluated: wrapAllRows| no Evaluation Count:0 | yes Evaluation Count:7 |
| 0-7 |
| 400 | sh_width = qMax(maxShLblWidth, qMax(maxShIfldWidth, maxShFldWidth)); | - |
| 401 | min_width = qMax(maxMinLblWidth, qMax(maxMinIfldWidth, maxMinFldWidth)); | - |
| 402 | | - |
| 403 | thresh_width = 0; | - |
| 404 | } else if (dontWrapRows) { evaluated: dontWrapRows| yes Evaluation Count:6 | yes Evaluation Count:1 |
| 0-6 |
| 405 | | - |
| 406 | sh_width = qMax(maxShLblWidth + maxShFldWidth, maxShIfldWidth); | - |
| 407 | min_width = qMax(maxMinLblWidth + maxMinFldWidth, maxMinIfldWidth); | - |
| 408 | thresh_width = ((1<<24)-1); | - |
| 409 | } else { executed: }Execution Count:6 | 6 |
| 410 | | - |
| 411 | sh_width = qMax(maxShLblWidth + maxShFldWidth, maxShIfldWidth); | - |
| 412 | | - |
| 413 | | - |
| 414 | min_width = qMax(maxMinLblWidth, qMax(maxMinIfldWidth, maxMinFldWidth)); | - |
| 415 | | - |
| 416 | thresh_width = maxShLblWidth + maxMinFldWidth; | - |
| 417 | } executed: }Execution Count:1 | 1 |
| 418 | | - |
| 419 | | - |
| 420 | expandVertical = expandV; | - |
| 421 | expandHorizontal = expandH; | - |
| 422 | } executed: }Execution Count:7 | 7 |
| 423 | sizesDirty = false; | - |
| 424 | } executed: }Execution Count:54 | 54 |
| 425 | | - |
| 426 | void QFormLayoutPrivate::recalcHFW(int w) | - |
| 427 | { | - |
| 428 | setupHfwLayoutData(); | - |
| 429 | | - |
| 430 | int h = 0; | - |
| 431 | int mh = 0; | - |
| 432 | | - |
| 433 | for (int r = 0; r < vLayoutCount; ++r) { evaluated: r < vLayoutCount| yes Evaluation Count:11 | yes Evaluation Count:3 |
| 3-11 |
| 434 | int spacing = hfwLayouts.at(r).spacing; | - |
| 435 | h += hfwLayouts.at(r).sizeHint + spacing; | - |
| 436 | mh += hfwLayouts.at(r).minimumSize + spacing; | - |
| 437 | } executed: }Execution Count:11 | 11 |
| 438 | | - |
| 439 | if (sh_width > 0 && sh_width == w) { partially evaluated: sh_width > 0| yes Evaluation Count:3 | no Evaluation Count:0 |
evaluated: sh_width == w| yes Evaluation Count:1 | yes Evaluation Count:2 |
| 0-3 |
| 440 | hfw_sh_height = qMin(QLAYOUTSIZE_MAX, h); | - |
| 441 | hfw_sh_minheight = qMin(QLAYOUTSIZE_MAX, mh); | - |
| 442 | } else { executed: }Execution Count:1 | 1 |
| 443 | hfw_width = w; | - |
| 444 | hfw_height = qMin(QLAYOUTSIZE_MAX, h); | - |
| 445 | hfw_minheight = qMin(QLAYOUTSIZE_MAX, mh); | - |
| 446 | } executed: }Execution Count:2 | 2 |
| 447 | } | - |
| 448 | | - |
| 449 | void QFormLayoutPrivate::setupHfwLayoutData() | - |
| 450 | { | - |
| 451 | int i; | - |
| 452 | int rr = m_matrix.rowCount(); | - |
| 453 | | - |
| 454 | hfwLayouts.clear(); | - |
| 455 | hfwLayouts.resize(vLayoutCount); | - |
| 456 | for (i = 0; i < vLayoutCount; ++i) evaluated: i < vLayoutCount| yes Evaluation Count:11 | yes Evaluation Count:3 |
| 3-11 |
| 457 | hfwLayouts[i] = vLayouts.at(i); executed: hfwLayouts[i] = vLayouts.at(i);Execution Count:11 | 11 |
| 458 | | - |
| 459 | for (i = 0; i < rr; ++i) { evaluated: i < rr| yes Evaluation Count:3 | yes Evaluation Count:3 |
| 3 |
| 460 | QFormLayoutItem *label = m_matrix(i, 0); | - |
| 461 | QFormLayoutItem *field = m_matrix(i, 1); | - |
| 462 | | - |
| 463 | if (label) { partially evaluated: label| yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
| 464 | if (label->isHfw) { partially evaluated: label->isHfw| no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
| 465 | | - |
| 466 | | - |
| 467 | int hfw = label->heightForWidth(label->layoutWidth); | - |
| 468 | hfwLayouts[label->vLayoutIndex].minimumSize = hfw; | - |
| 469 | hfwLayouts[label->vLayoutIndex].sizeHint = hfw; | - |
| 470 | } else { | 0 |
| 471 | | - |
| 472 | | - |
| 473 | hfwLayouts[label->vLayoutIndex].sizeHint = label->sizeHint.height(); | - |
| 474 | hfwLayouts[label->vLayoutIndex].minimumSize = label->minSize.height(); | - |
| 475 | } executed: }Execution Count:3 | 3 |
| 476 | } | - |
| 477 | | - |
| 478 | if (field) { partially evaluated: field| yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
| 479 | int hfw = field->isHfw ? field->heightForWidth(field->layoutWidth) : 0; partially evaluated: field->isHfw| no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
| 480 | int h = field->isHfw ? hfw : field->sizeHint.height(); partially evaluated: field->isHfw| no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
| 481 | int mh = field->isHfw ? hfw : field->minSize.height(); partially evaluated: field->isHfw| no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
| 482 | | - |
| 483 | if (field->sideBySide) { evaluated: field->sideBySide| yes Evaluation Count:1 | yes Evaluation Count:2 |
| 1-2 |
| 484 | int oh = hfwLayouts.at(field->vLayoutIndex).sizeHint; | - |
| 485 | int omh = hfwLayouts.at(field->vLayoutIndex).minimumSize; | - |
| 486 | | - |
| 487 | hfwLayouts[field->vLayoutIndex].sizeHint = qMax(h, oh); | - |
| 488 | hfwLayouts[field->vLayoutIndex].minimumSize = qMax(mh, omh); | - |
| 489 | } else { executed: }Execution Count:1 | 1 |
| 490 | hfwLayouts[field->vLayoutIndex].sizeHint = h; | - |
| 491 | hfwLayouts[field->vLayoutIndex].minimumSize = mh; | - |
| 492 | } executed: }Execution Count:2 | 2 |
| 493 | } | - |
| 494 | } executed: }Execution Count:3 | 3 |
| 495 | } executed: }Execution Count:3 | 3 |
| 496 | static inline int spacingHelper(QWidget* parent, QStyle *style, int userVSpacing, bool recalculate, QFormLayoutItem* item1, QFormLayoutItem* item2, QFormLayoutItem* prevItem1, QFormLayoutItem *prevItem2) | - |
| 497 | { | - |
| 498 | int spacing = userVSpacing; | - |
| 499 | if (spacing < 0) { partially evaluated: spacing < 0| no Evaluation Count:0 | yes Evaluation Count:17 |
| 0-17 |
| 500 | if (!recalculate) { never evaluated: !recalculate | 0 |
| 501 | if (item1) | 0 |
| 502 | spacing = item1->vSpace; never executed: spacing = item1->vSpace; | 0 |
| 503 | if (item2) | 0 |
| 504 | spacing = qMax(spacing, item2->vSpace); never executed: spacing = qMax(spacing, item2->vSpace); | 0 |
| 505 | } else { | 0 |
| 506 | if (style && prevItem1) { never evaluated: prevItem1 | 0 |
| 507 | QSizePolicy::ControlTypes itemtypes = | - |
| 508 | QSizePolicy::ControlTypes(item1 ? item1->controlTypes() : QSizePolicy::DefaultType); | - |
| 509 | int spacing2 = 0; | - |
| 510 | | - |
| 511 | spacing = style->combinedLayoutSpacing(itemtypes, prevItem1->controlTypes(), Qt::Vertical, 0, parent); | - |
| 512 | | - |
| 513 | | - |
| 514 | if (item2) | 0 |
| 515 | spacing2 = style->combinedLayoutSpacing(item2->controlTypes(), prevItem1->controlTypes(), Qt::Vertical, 0, parent); never executed: spacing2 = style->combinedLayoutSpacing(item2->controlTypes(), prevItem1->controlTypes(), Qt::Vertical, 0, parent); | 0 |
| 516 | else if (prevItem2) never evaluated: prevItem2 | 0 |
| 517 | spacing2 = style->combinedLayoutSpacing(itemtypes, prevItem2->controlTypes(), Qt::Vertical, 0, parent); never executed: spacing2 = style->combinedLayoutSpacing(itemtypes, prevItem2->controlTypes(), Qt::Vertical, 0, parent); | 0 |
| 518 | | - |
| 519 | spacing = qMax(spacing, spacing2); | - |
| 520 | } | 0 |
| 521 | } | 0 |
| 522 | } else { | - |
| 523 | if (prevItem1) { partially evaluated: prevItem1| yes Evaluation Count:17 | no Evaluation Count:0 |
| 0-17 |
| 524 | QWidget *wid = prevItem1->item->widget(); | - |
| 525 | if (wid) partially evaluated: wid| yes Evaluation Count:17 | no Evaluation Count:0 |
| 0-17 |
| 526 | spacing = qMax(spacing, prevItem1->geometry().top() - wid->geometry().top() ); executed: spacing = qMax(spacing, prevItem1->geometry().top() - wid->geometry().top() );Execution Count:17 | 17 |
| 527 | } executed: }Execution Count:17 | 17 |
| 528 | if (prevItem2) { evaluated: prevItem2| yes Evaluation Count:12 | yes Evaluation Count:5 |
| 5-12 |
| 529 | QWidget *wid = prevItem2->item->widget(); | - |
| 530 | if (wid) partially evaluated: wid| yes Evaluation Count:12 | no Evaluation Count:0 |
| 0-12 |
| 531 | spacing = qMax(spacing, prevItem2->geometry().top() - wid->geometry().top() ); executed: spacing = qMax(spacing, prevItem2->geometry().top() - wid->geometry().top() );Execution Count:12 | 12 |
| 532 | } executed: }Execution Count:12 | 12 |
| 533 | } executed: }Execution Count:17 | 17 |
| 534 | return spacing; executed: return spacing;Execution Count:17 | 17 |
| 535 | } | - |
| 536 | | - |
| 537 | static inline void initLayoutStruct(QLayoutStruct& sl, QFormLayoutItem* item) | - |
| 538 | { | - |
| 539 | sl.init(item->vStretch(), item->minSize.height()); | - |
| 540 | sl.sizeHint = item->sizeHint.height(); | - |
| 541 | sl.maximumSize = item->maxSize.height(); | - |
| 542 | sl.expansive = (item->expandingDirections() & Qt::Vertical); | - |
| 543 | sl.empty = false; | - |
| 544 | } executed: }Execution Count:4 | 4 |
| 545 | | - |
| 546 | void QFormLayoutPrivate::setupVerticalLayoutData(int width) | - |
| 547 | { | - |
| 548 | QFormLayout * const q = q_func(); | - |
| 549 | | - |
| 550 | | - |
| 551 | if ((width == layoutWidth || (width >= thresh_width && layoutWidth >= thresh_width)) && !dirty && !sizesDirty) evaluated: width == layoutWidth| yes Evaluation Count:1 | yes Evaluation Count:18 |
evaluated: width >= thresh_width| yes Evaluation Count:2 | yes Evaluation Count:16 |
partially evaluated: layoutWidth >= thresh_width| no Evaluation Count:0 | yes Evaluation Count:2 |
partially evaluated: !dirty| yes Evaluation Count:1 | no Evaluation Count:0 |
partially evaluated: !sizesDirty| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-18 |
| 552 | return; executed: return;Execution Count:1 | 1 |
| 553 | | - |
| 554 | layoutWidth = width; | - |
| 555 | | - |
| 556 | int rr = m_matrix.rowCount(); | - |
| 557 | int vidx = 1; | - |
| 558 | QFormLayout::RowWrapPolicy rowWrapPolicy = q->rowWrapPolicy(); | - |
| 559 | bool wrapAllRows = (rowWrapPolicy == QFormLayout::WrapAllRows); | - |
| 560 | bool addTopBottomStretch = true; | - |
| 561 | | - |
| 562 | vLayouts.clear(); | - |
| 563 | vLayouts.resize((2 * rr) + 2); | - |
| 564 | | - |
| 565 | QStyle *style = 0; | - |
| 566 | | - |
| 567 | int userVSpacing = q->verticalSpacing(); | - |
| 568 | | - |
| 569 | if (userVSpacing < 0) { partially evaluated: userVSpacing < 0| no Evaluation Count:0 | yes Evaluation Count:18 |
| 0-18 |
| 570 | if (QWidget *widget = q->parentWidget()) never evaluated: QWidget *widget = q->parentWidget() | 0 |
| 571 | style = widget->style(); never executed: style = widget->style(); | 0 |
| 572 | } | 0 |
| 573 | | - |
| 574 | | - |
| 575 | updateSizes(); | - |
| 576 | | - |
| 577 | | - |
| 578 | | - |
| 579 | | - |
| 580 | | - |
| 581 | maxLabelWidth = 0; | - |
| 582 | if (!wrapAllRows) { partially evaluated: !wrapAllRows| yes Evaluation Count:18 | no Evaluation Count:0 |
| 0-18 |
| 583 | for (int i = 0; i < rr; ++i) { evaluated: i < rr| yes Evaluation Count:33 | yes Evaluation Count:18 |
| 18-33 |
| 584 | const QFormLayoutItem *label = m_matrix(i, 0); | - |
| 585 | const QFormLayoutItem *field = m_matrix(i, 1); | - |
| 586 | if (label && (label->sizeHint.width() + (field ? field->minSize.width() : 0) <= width)) partially evaluated: label| yes Evaluation Count:33 | no Evaluation Count:0 |
evaluated: (label->sizeHint.width() + (field ? field->minSize.width() : 0) <= width)| yes Evaluation Count:31 | yes Evaluation Count:2 |
evaluated: field| yes Evaluation Count:27 | yes Evaluation Count:6 |
| 0-33 |
| 587 | maxLabelWidth = qMax(maxLabelWidth, label->sizeHint.width()); executed: maxLabelWidth = qMax(maxLabelWidth, label->sizeHint.width());Execution Count:31 | 31 |
| 588 | } executed: }Execution Count:33 | 33 |
| 589 | } else { executed: }Execution Count:18 | 18 |
| 590 | maxLabelWidth = width; | - |
| 591 | } | 0 |
| 592 | | - |
| 593 | QFormLayoutItem *prevItem1 = 0; | - |
| 594 | QFormLayoutItem *prevItem2 = 0; | - |
| 595 | bool prevRowSplit = false; | - |
| 596 | | - |
| 597 | for (int i = 0; i < rr; ++i) { evaluated: i < rr| yes Evaluation Count:33 | yes Evaluation Count:18 |
| 18-33 |
| 598 | QFormLayoutItem *label = m_matrix(i, 0); | - |
| 599 | QFormLayoutItem *field = m_matrix(i, 1); | - |
| 600 | | - |
| 601 | | - |
| 602 | if (!label && !field) partially evaluated: !label| no Evaluation Count:0 | yes Evaluation Count:33 |
| 0-33 |
| 603 | continue; never executed: continue; | 0 |
| 604 | | - |
| 605 | QSize min1; | - |
| 606 | QSize min2; | - |
| 607 | QSize sh1; | - |
| 608 | QSize sh2; | - |
| 609 | if (label) { partially evaluated: label| yes Evaluation Count:33 | no Evaluation Count:0 |
| 0-33 |
| 610 | min1 = label->minSize; | - |
| 611 | sh1 = label->sizeHint; | - |
| 612 | } executed: }Execution Count:33 | 33 |
| 613 | if (field) { evaluated: field| yes Evaluation Count:27 | yes Evaluation Count:6 |
| 6-27 |
| 614 | min2 = field->minSize; | - |
| 615 | sh2 = field->sizeHint; | - |
| 616 | } executed: }Execution Count:27 | 27 |
| 617 | | - |
| 618 | | - |
| 619 | | - |
| 620 | bool splitSideBySide = (rowWrapPolicy == QFormLayout::WrapLongRows) evaluated: (rowWrapPolicy == QFormLayout::WrapLongRows)| yes Evaluation Count:4 | yes Evaluation Count:29 |
| 4-29 |
| 621 | && ((maxLabelWidth < sh1.width()) || (width < (maxLabelWidth + min2.width()))); evaluated: (maxLabelWidth < sh1.width())| yes Evaluation Count:2 | yes Evaluation Count:2 |
partially evaluated: (width < (maxLabelWidth + min2.width()))| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
| 622 | | - |
| 623 | if (wrapAllRows || splitSideBySide) { partially evaluated: wrapAllRows| no Evaluation Count:0 | yes Evaluation Count:33 |
evaluated: splitSideBySide| yes Evaluation Count:2 | yes Evaluation Count:31 |
| 0-33 |
| 624 | if (label) { partially evaluated: label| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 625 | initLayoutStruct(vLayouts[vidx], label); | - |
| 626 | | - |
| 627 | if (vidx > 1) partially evaluated: vidx > 1| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
| 628 | vLayouts[vidx - 1].spacing = spacingHelper(q->parentWidget(), style, userVSpacing, splitSideBySide || prevRowSplit, label, 0, prevItem1, prevItem2); never executed: vLayouts[vidx - 1].spacing = spacingHelper(q->parentWidget(), style, userVSpacing, splitSideBySide || prevRowSplit, label, 0, prevItem1, prevItem2); | 0 |
| 629 | | - |
| 630 | label->vLayoutIndex = vidx; | - |
| 631 | label->sideBySide = false; | - |
| 632 | | - |
| 633 | prevItem1 = label; | - |
| 634 | prevItem2 = 0; | - |
| 635 | | - |
| 636 | if (vLayouts[vidx].stretch > 0) partially evaluated: vLayouts[vidx].stretch > 0| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
| 637 | addTopBottomStretch = false; never executed: addTopBottomStretch = false; | 0 |
| 638 | | - |
| 639 | ++vidx; | - |
| 640 | } executed: }Execution Count:2 | 2 |
| 641 | | - |
| 642 | if (field) { partially evaluated: field| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 643 | initLayoutStruct(vLayouts[vidx], field); | - |
| 644 | | - |
| 645 | if (vidx > 1) partially evaluated: vidx > 1| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 646 | vLayouts[vidx - 1].spacing = spacingHelper(q->parentWidget(), style, userVSpacing, splitSideBySide || prevRowSplit, field, 0, prevItem1, prevItem2); executed: vLayouts[vidx - 1].spacing = spacingHelper(q->parentWidget(), style, userVSpacing, splitSideBySide || prevRowSplit, field, 0, prevItem1, prevItem2);Execution Count:2 | 2 |
| 647 | | - |
| 648 | field->vLayoutIndex = vidx; | - |
| 649 | field->sideBySide = false; | - |
| 650 | | - |
| 651 | prevItem1 = field; | - |
| 652 | prevItem2 = 0; | - |
| 653 | | - |
| 654 | if (vLayouts[vidx].stretch > 0) partially evaluated: vLayouts[vidx].stretch > 0| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
| 655 | addTopBottomStretch = false; never executed: addTopBottomStretch = false; | 0 |
| 656 | | - |
| 657 | ++vidx; | - |
| 658 | } executed: }Execution Count:2 | 2 |
| 659 | | - |
| 660 | prevRowSplit = splitSideBySide; | - |
| 661 | } else { executed: }Execution Count:2 | 2 |
| 662 | | - |
| 663 | QSize max1(((1<<24)-1), ((1<<24)-1)); | - |
| 664 | QSize max2(((1<<24)-1), ((1<<24)-1)); | - |
| 665 | | - |
| 666 | int stretch1 = 0; | - |
| 667 | int stretch2 = 0; | - |
| 668 | bool expanding = false; | - |
| 669 | | - |
| 670 | if (label) { partially evaluated: label| yes Evaluation Count:31 | no Evaluation Count:0 |
| 0-31 |
| 671 | max1 = label->maxSize; | - |
| 672 | if (label->expandingDirections() & Qt::Vertical) partially evaluated: label->expandingDirections() & Qt::Vertical| no Evaluation Count:0 | yes Evaluation Count:31 |
| 0-31 |
| 673 | expanding = true; never executed: expanding = true; | 0 |
| 674 | | - |
| 675 | label->sideBySide = (field != 0); | - |
| 676 | label->vLayoutIndex = vidx; | - |
| 677 | stretch1 = label->vStretch(); | - |
| 678 | } executed: }Execution Count:31 | 31 |
| 679 | | - |
| 680 | if (field) { evaluated: field| yes Evaluation Count:25 | yes Evaluation Count:6 |
| 6-25 |
| 681 | max2 = field->maxSize; | - |
| 682 | if (field->expandingDirections() & Qt::Vertical) partially evaluated: field->expandingDirections() & Qt::Vertical| no Evaluation Count:0 | yes Evaluation Count:25 |
| 0-25 |
| 683 | expanding = true; never executed: expanding = true; | 0 |
| 684 | | - |
| 685 | field->sideBySide = (label || !field->fullRow); partially evaluated: label| yes Evaluation Count:25 | no Evaluation Count:0 |
never evaluated: !field->fullRow | 0-25 |
| 686 | field->vLayoutIndex = vidx; | - |
| 687 | stretch2 = field->vStretch(); | - |
| 688 | } executed: }Execution Count:25 | 25 |
| 689 | | - |
| 690 | vLayouts[vidx].init(qMax(stretch1, stretch2), qMax(min1.height(), min2.height())); | - |
| 691 | vLayouts[vidx].sizeHint = qMax(sh1.height(), sh2.height()); | - |
| 692 | vLayouts[vidx].maximumSize = qMin(max1.height(), max2.height()); | - |
| 693 | vLayouts[vidx].expansive = expanding || (vLayouts[vidx].stretch > 0); partially evaluated: expanding| no Evaluation Count:0 | yes Evaluation Count:31 |
partially evaluated: (vLayouts[vidx].stretch > 0)| no Evaluation Count:0 | yes Evaluation Count:31 |
| 0-31 |
| 694 | vLayouts[vidx].empty = false; | - |
| 695 | | - |
| 696 | if (vLayouts[vidx].stretch > 0) partially evaluated: vLayouts[vidx].stretch > 0| no Evaluation Count:0 | yes Evaluation Count:31 |
| 0-31 |
| 697 | addTopBottomStretch = false; never executed: addTopBottomStretch = false; | 0 |
| 698 | | - |
| 699 | if (vidx > 1) evaluated: vidx > 1| yes Evaluation Count:15 | yes Evaluation Count:16 |
| 15-16 |
| 700 | vLayouts[vidx - 1].spacing = spacingHelper(q->parentWidget(), style, userVSpacing, prevRowSplit, label, field, prevItem1, prevItem2); executed: vLayouts[vidx - 1].spacing = spacingHelper(q->parentWidget(), style, userVSpacing, prevRowSplit, label, field, prevItem1, prevItem2);Execution Count:15 | 15 |
| 701 | | - |
| 702 | if (label) { partially evaluated: label| yes Evaluation Count:31 | no Evaluation Count:0 |
| 0-31 |
| 703 | prevItem1 = label; | - |
| 704 | prevItem2 = field; | - |
| 705 | } else { executed: }Execution Count:31 | 31 |
| 706 | prevItem1 = field; | - |
| 707 | prevItem2 = 0; | - |
| 708 | } | 0 |
| 709 | | - |
| 710 | prevRowSplit = false; | - |
| 711 | ++vidx; | - |
| 712 | } executed: }Execution Count:31 | 31 |
| 713 | } | - |
| 714 | | - |
| 715 | if (addTopBottomStretch) { partially evaluated: addTopBottomStretch| yes Evaluation Count:18 | no Evaluation Count:0 |
| 0-18 |
| 716 | Qt::Alignment formAlignment = q->formAlignment(); | - |
| 717 | | - |
| 718 | if (!(formAlignment & Qt::AlignBottom)) { partially evaluated: !(formAlignment & Qt::AlignBottom)| yes Evaluation Count:18 | no Evaluation Count:0 |
| 0-18 |
| 719 | | - |
| 720 | vLayouts[vidx].init(1, 0); | - |
| 721 | vLayouts[vidx].expansive = true; | - |
| 722 | ++vidx; | - |
| 723 | } executed: }Execution Count:18 | 18 |
| 724 | | - |
| 725 | if (formAlignment & (Qt::AlignVCenter | Qt::AlignBottom)) { partially evaluated: formAlignment & (Qt::AlignVCenter | Qt::AlignBottom)| no Evaluation Count:0 | yes Evaluation Count:18 |
| 0-18 |
| 726 | | - |
| 727 | vLayouts[0].init(1, 0); | - |
| 728 | vLayouts[0].expansive = true; | - |
| 729 | } else { | 0 |
| 730 | vLayouts[0].init(0, 0); | - |
| 731 | } executed: }Execution Count:18 | 18 |
| 732 | } else { | - |
| 733 | vLayouts[0].init(0, 0); | - |
| 734 | } | 0 |
| 735 | | - |
| 736 | vLayoutCount = vidx; | - |
| 737 | dirty = false; | - |
| 738 | } executed: }Execution Count:18 | 18 |
| 739 | | - |
| 740 | void QFormLayoutPrivate::setupHorizontalLayoutData(int width) | - |
| 741 | { | - |
| 742 | QFormLayout * const q = q_func(); | - |
| 743 | | - |
| 744 | | - |
| 745 | | - |
| 746 | int fieldMaxWidth = 0; | - |
| 747 | | - |
| 748 | int rr = m_matrix.rowCount(); | - |
| 749 | bool wrapAllRows = (q->rowWrapPolicy() == QFormLayout::WrapAllRows); | - |
| 750 | | - |
| 751 | for (int i = 0; i < rr; ++i) { evaluated: i < rr| yes Evaluation Count:20 | yes Evaluation Count:12 |
| 12-20 |
| 752 | QFormLayoutItem *label = m_matrix(i, 0); | - |
| 753 | QFormLayoutItem *field = m_matrix(i, 1); | - |
| 754 | | - |
| 755 | | - |
| 756 | if (!label && !field) partially evaluated: !label| no Evaluation Count:0 | yes Evaluation Count:20 |
| 0-20 |
| 757 | continue; never executed: continue; | 0 |
| 758 | | - |
| 759 | if (label) { partially evaluated: label| yes Evaluation Count:20 | no Evaluation Count:0 |
| 0-20 |
| 760 | | - |
| 761 | | - |
| 762 | label->layoutWidth = (field && label->sideBySide) ? maxLabelWidth : label->sizeHint.width(); evaluated: field| yes Evaluation Count:16 | yes Evaluation Count:4 |
evaluated: label->sideBySide| yes Evaluation Count:13 | yes Evaluation Count:3 |
| 3-16 |
| 763 | label->layoutPos = 0; | - |
| 764 | } executed: }Execution Count:20 | 20 |
| 765 | | - |
| 766 | if (field) { evaluated: field| yes Evaluation Count:16 | yes Evaluation Count:4 |
| 4-16 |
| 767 | | - |
| 768 | int fldwidth = width - maxLabelWidth - field->sbsHSpace; | - |
| 769 | | - |
| 770 | | - |
| 771 | | - |
| 772 | | - |
| 773 | if (!field->sideBySide) { evaluated: !field->sideBySide| yes Evaluation Count:3 | yes Evaluation Count:13 |
| 3-13 |
| 774 | if (wrapAllRows || (!label && field->fullRow) || field->sizeHint.width() > fldwidth) { partially evaluated: wrapAllRows| no Evaluation Count:0 | yes Evaluation Count:3 |
partially evaluated: !label| no Evaluation Count:0 | yes Evaluation Count:3 |
never evaluated: field->fullRow partially evaluated: field->sizeHint.width() > fldwidth| no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
| 775 | field->layoutWidth = width; | - |
| 776 | field->layoutPos = 0; | - |
| 777 | } else { | 0 |
| 778 | field->layoutWidth = fldwidth; | - |
| 779 | field->layoutPos = width - fldwidth; | - |
| 780 | } executed: }Execution Count:3 | 3 |
| 781 | } else { | - |
| 782 | | - |
| 783 | field->layoutWidth = fldwidth; | - |
| 784 | field->layoutPos = width - fldwidth; | - |
| 785 | } executed: }Execution Count:13 | 13 |
| 786 | | - |
| 787 | fieldMaxWidth = qMax(fieldMaxWidth, field->maxSize.width()); | - |
| 788 | } executed: }Execution Count:16 | 16 |
| 789 | } executed: }Execution Count:20 | 20 |
| 790 | | - |
| 791 | formMaxWidth = maxLabelWidth + fieldMaxWidth; | - |
| 792 | } executed: }Execution Count:12 | 12 |
| 793 | | - |
| 794 | void QFormLayoutPrivate::calcSizeHints() | - |
| 795 | { | - |
| 796 | QFormLayout * const q = q_func(); | - |
| 797 | | - |
| 798 | int leftMargin, topMargin, rightMargin, bottomMargin; | - |
| 799 | q->getContentsMargins(&leftMargin, &topMargin, &rightMargin, &bottomMargin); | - |
| 800 | | - |
| 801 | updateSizes(); | - |
| 802 | setupVerticalLayoutData(QLAYOUTSIZE_MAX); | - |
| 803 | | - |
| 804 | | - |
| 805 | int h = topMargin + bottomMargin; | - |
| 806 | int mh = topMargin + bottomMargin; | - |
| 807 | | - |
| 808 | | - |
| 809 | int w = sh_width + leftMargin + rightMargin; | - |
| 810 | int mw = min_width + leftMargin + rightMargin; | - |
| 811 | | - |
| 812 | for (int i = 0; i < vLayoutCount; ++i) { evaluated: i < vLayoutCount| yes Evaluation Count:28 | yes Evaluation Count:7 |
| 7-28 |
| 813 | int spacing = vLayouts.at(i).spacing; | - |
| 814 | h += vLayouts.at(i).sizeHint + spacing; | - |
| 815 | mh += vLayouts.at(i).minimumSize + spacing; | - |
| 816 | } executed: }Execution Count:28 | 28 |
| 817 | | - |
| 818 | minSize.rwidth() = qMin(mw, QLAYOUTSIZE_MAX); | - |
| 819 | minSize.rheight() = qMin(mh, QLAYOUTSIZE_MAX); | - |
| 820 | prefSize.rwidth() = qMin(w, QLAYOUTSIZE_MAX); | - |
| 821 | prefSize.rheight() = qMin(h, QLAYOUTSIZE_MAX); | - |
| 822 | } executed: }Execution Count:7 | 7 |
| 823 | | - |
| 824 | int QFormLayoutPrivate::insertRow(int row) | - |
| 825 | { | - |
| 826 | int rowCnt = m_matrix.rowCount(); | - |
| 827 | if (uint(row) > uint(rowCnt)) evaluated: uint(row) > uint(rowCnt)| yes Evaluation Count:37 | yes Evaluation Count:9 |
| 9-37 |
| 828 | row = rowCnt; executed: row = rowCnt;Execution Count:37 | 37 |
| 829 | | - |
| 830 | insertRows(row, 1); | - |
| 831 | return row; executed: return row;Execution Count:46 | 46 |
| 832 | } | - |
| 833 | | - |
| 834 | void QFormLayoutPrivate::insertRows(int row, int count) | - |
| 835 | { | - |
| 836 | while (count > 0) { evaluated: count > 0| yes Evaluation Count:72 | yes Evaluation Count:52 |
| 52-72 |
| 837 | m_matrix.insertRow(row, 0); | - |
| 838 | --count; | - |
| 839 | } executed: }Execution Count:72 | 72 |
| 840 | } executed: }Execution Count:52 | 52 |
| 841 | | - |
| 842 | void QFormLayoutPrivate::setItem(int row, QFormLayout::ItemRole role, QLayoutItem *item) | - |
| 843 | { | - |
| 844 | const bool fullRow = role == QFormLayout::SpanningRole; | - |
| 845 | const int column = role == QFormLayout::SpanningRole ? 1 : static_cast<int>(role); evaluated: role == QFormLayout::SpanningRole| yes Evaluation Count:6 | yes Evaluation Count:93 |
| 6-93 |
| 846 | if (uint(row) >= uint(m_matrix.rowCount()) || uint(column) > 1U) { evaluated: uint(row) >= uint(m_matrix.rowCount())| yes Evaluation Count:2 | yes Evaluation Count:97 |
partially evaluated: uint(column) > 1U| no Evaluation Count:0 | yes Evaluation Count:97 |
| 0-97 |
| 847 | QMessageLogger("kernel/qformlayout.cpp", 956, __PRETTY_FUNCTION__).warning("QFormLayoutPrivate::setItem: Invalid cell (%d, %d)", row, column); | - |
| 848 | return; executed: return;Execution Count:2 | 2 |
| 849 | } | - |
| 850 | | - |
| 851 | if (!item) partially evaluated: !item| no Evaluation Count:0 | yes Evaluation Count:97 |
| 0-97 |
| 852 | return; | 0 |
| 853 | | - |
| 854 | if (m_matrix(row, column)) { evaluated: m_matrix(row, column)| yes Evaluation Count:2 | yes Evaluation Count:95 |
| 2-95 |
| 855 | QMessageLogger("kernel/qformlayout.cpp", 964, __PRETTY_FUNCTION__).warning("QFormLayoutPrivate::setItem: Cell (%d, %d) already occupied", row, column); | - |
| 856 | return; executed: return;Execution Count:2 | 2 |
| 857 | } | - |
| 858 | | - |
| 859 | QFormLayoutItem *i = new QFormLayoutItem(item); | - |
| 860 | i->fullRow = fullRow; | - |
| 861 | m_matrix(row, column) = i; | - |
| 862 | | - |
| 863 | m_things.append(i); | - |
| 864 | } executed: }Execution Count:95 | 95 |
| 865 | | - |
| 866 | void QFormLayoutPrivate::setLayout(int row, QFormLayout::ItemRole role, QLayout *layout) | - |
| 867 | { | - |
| 868 | if (layout) { partially evaluated: layout| yes Evaluation Count:20 | no Evaluation Count:0 |
| 0-20 |
| 869 | QFormLayout * const q = q_func(); | - |
| 870 | q->addChildLayout(layout); | - |
| 871 | setItem(row, role, layout); | - |
| 872 | } executed: }Execution Count:20 | 20 |
| 873 | } executed: }Execution Count:20 | 20 |
| 874 | | - |
| 875 | void QFormLayoutPrivate::setWidget(int row, QFormLayout::ItemRole role, QWidget *widget) | - |
| 876 | { | - |
| 877 | if (widget) { partially evaluated: widget| yes Evaluation Count:79 | no Evaluation Count:0 |
| 0-79 |
| 878 | QFormLayout * const q = q_func(); | - |
| 879 | q->addChildWidget(widget); | - |
| 880 | setItem(row, role, QLayoutPrivate::createWidgetItem(q, widget)); | - |
| 881 | } executed: }Execution Count:79 | 79 |
| 882 | } executed: }Execution Count:79 | 79 |
| 883 | | - |
| 884 | QStyle* QFormLayoutPrivate::getStyle() const | - |
| 885 | { | - |
| 886 | const QFormLayout * const q = q_func(); | - |
| 887 | | - |
| 888 | | - |
| 889 | if (QWidget *parentWidget = q->parentWidget()) partially evaluated: QWidget *parentWidget = q->parentWidget()| yes Evaluation Count:110 | no Evaluation Count:0 |
| 0-110 |
| 890 | return parentWidget->style(); executed: return parentWidget->style();Execution Count:110 | 110 |
| 891 | else | - |
| 892 | return QApplication::style(); never executed: return QApplication::style(); | 0 |
| 893 | } | - |
| 894 | QFormLayout::QFormLayout(QWidget *parent) | - |
| 895 | : QLayout(*new QFormLayoutPrivate, 0, parent) | - |
| 896 | { | - |
| 897 | } executed: }Execution Count:20 | 20 |
| 898 | | - |
| 899 | | - |
| 900 | | - |
| 901 | | - |
| 902 | QFormLayout::~QFormLayout() | - |
| 903 | { | - |
| 904 | QFormLayoutPrivate * const d = d_func(); | - |
| 905 | | - |
| 906 | | - |
| 907 | | - |
| 908 | | - |
| 909 | | - |
| 910 | | - |
| 911 | d->m_things.clear(); | - |
| 912 | qDeleteAll(d->m_matrix.storage()); | - |
| 913 | d->m_matrix.clear(); | - |
| 914 | } executed: }Execution Count:20 | 20 |
| 915 | | - |
| 916 | | - |
| 917 | | - |
| 918 | | - |
| 919 | | - |
| 920 | | - |
| 921 | | - |
| 922 | void QFormLayout::addRow(QWidget *label, QWidget *field) | - |
| 923 | { | - |
| 924 | insertRow(-1, label, field); | - |
| 925 | } executed: }Execution Count:10 | 10 |
| 926 | | - |
| 927 | | - |
| 928 | | - |
| 929 | | - |
| 930 | void QFormLayout::addRow(QWidget *label, QLayout *field) | - |
| 931 | { | - |
| 932 | insertRow(-1, label, field); | - |
| 933 | } executed: }Execution Count:1 | 1 |
| 934 | void QFormLayout::addRow(const QString &labelText, QWidget *field) | - |
| 935 | { | - |
| 936 | insertRow(-1, labelText, field); | - |
| 937 | } executed: }Execution Count:9 | 9 |
| 938 | | - |
| 939 | | - |
| 940 | | - |
| 941 | | - |
| 942 | | - |
| 943 | | - |
| 944 | | - |
| 945 | void QFormLayout::addRow(const QString &labelText, QLayout *field) | - |
| 946 | { | - |
| 947 | insertRow(-1, labelText, field); | - |
| 948 | } executed: }Execution Count:3 | 3 |
| 949 | | - |
| 950 | | - |
| 951 | | - |
| 952 | | - |
| 953 | | - |
| 954 | | - |
| 955 | | - |
| 956 | void QFormLayout::addRow(QWidget *widget) | - |
| 957 | { | - |
| 958 | insertRow(-1, widget); | - |
| 959 | } executed: }Execution Count:3 | 3 |
| 960 | | - |
| 961 | | - |
| 962 | | - |
| 963 | | - |
| 964 | | - |
| 965 | | - |
| 966 | | - |
| 967 | void QFormLayout::addRow(QLayout *layout) | - |
| 968 | { | - |
| 969 | insertRow(-1, layout); | - |
| 970 | } executed: }Execution Count:3 | 3 |
| 971 | void QFormLayout::insertRow(int row, QWidget *label, QWidget *field) | - |
| 972 | { | - |
| 973 | QFormLayoutPrivate * const d = d_func(); | - |
| 974 | | - |
| 975 | row = d->insertRow(row); | - |
| 976 | if (label) evaluated: label| yes Evaluation Count:26 | yes Evaluation Count:3 |
| 3-26 |
| 977 | d->setWidget(row, LabelRole, label); executed: d->setWidget(row, LabelRole, label);Execution Count:26 | 26 |
| 978 | if (field) evaluated: field| yes Evaluation Count:27 | yes Evaluation Count:2 |
| 2-27 |
| 979 | d->setWidget(row, FieldRole, field); executed: d->setWidget(row, FieldRole, field);Execution Count:27 | 27 |
| 980 | invalidate(); | - |
| 981 | } executed: }Execution Count:29 | 29 |
| 982 | | - |
| 983 | | - |
| 984 | | - |
| 985 | | - |
| 986 | void QFormLayout::insertRow(int row, QWidget *label, QLayout *field) | - |
| 987 | { | - |
| 988 | QFormLayoutPrivate * const d = d_func(); | - |
| 989 | | - |
| 990 | row = d->insertRow(row); | - |
| 991 | if (label) partially evaluated: label| yes Evaluation Count:11 | no Evaluation Count:0 |
| 0-11 |
| 992 | d->setWidget(row, LabelRole, label); executed: d->setWidget(row, LabelRole, label);Execution Count:11 | 11 |
| 993 | if (field) partially evaluated: field| yes Evaluation Count:11 | no Evaluation Count:0 |
| 0-11 |
| 994 | d->setLayout(row, FieldRole, field); executed: d->setLayout(row, FieldRole, field);Execution Count:11 | 11 |
| 995 | invalidate(); | - |
| 996 | } executed: }Execution Count:11 | 11 |
| 997 | void QFormLayout::insertRow(int row, const QString &labelText, QWidget *field) | - |
| 998 | { | - |
| 999 | QLabel *label = 0; | - |
| 1000 | if (!labelText.isEmpty()) { partially evaluated: !labelText.isEmpty()| yes Evaluation Count:13 | no Evaluation Count:0 |
| 0-13 |
| 1001 | label = new QLabel(labelText); | - |
| 1002 | | - |
| 1003 | label->setBuddy(field); | - |
| 1004 | | - |
| 1005 | } executed: }Execution Count:13 | 13 |
| 1006 | insertRow(row, label, field); | - |
| 1007 | } executed: }Execution Count:13 | 13 |
| 1008 | | - |
| 1009 | | - |
| 1010 | | - |
| 1011 | | - |
| 1012 | | - |
| 1013 | | - |
| 1014 | | - |
| 1015 | void QFormLayout::insertRow(int row, const QString &labelText, QLayout *field) | - |
| 1016 | { | - |
| 1017 | insertRow(row, labelText.isEmpty() ? 0 : new QLabel(labelText), field); | - |
| 1018 | } executed: }Execution Count:7 | 7 |
| 1019 | void QFormLayout::insertRow(int row, QWidget *widget) | - |
| 1020 | { | - |
| 1021 | QFormLayoutPrivate * const d = d_func(); | - |
| 1022 | | - |
| 1023 | if (!widget) { partially evaluated: !widget| no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
| 1024 | QMessageLogger("kernel/qformlayout.cpp", 1322, __PRETTY_FUNCTION__).warning("QFormLayout: Cannot add null field to %s", QString(objectName()).toLocal8Bit().constData()); | - |
| 1025 | return; | 0 |
| 1026 | } | - |
| 1027 | | - |
| 1028 | row = d->insertRow(row); | - |
| 1029 | d->setWidget(row, SpanningRole, widget); | - |
| 1030 | invalidate(); | - |
| 1031 | } executed: }Execution Count:3 | 3 |
| 1032 | void QFormLayout::insertRow(int row, QLayout *layout) | - |
| 1033 | { | - |
| 1034 | QFormLayoutPrivate * const d = d_func(); | - |
| 1035 | | - |
| 1036 | if (!layout) { partially evaluated: !layout| no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
| 1037 | QMessageLogger("kernel/qformlayout.cpp", 1343, __PRETTY_FUNCTION__).warning("QFormLayout: Cannot add null field to %s", QString(objectName()).toLocal8Bit().constData()); | - |
| 1038 | return; | 0 |
| 1039 | } | - |
| 1040 | | - |
| 1041 | row = d->insertRow(row); | - |
| 1042 | d->setLayout(row, SpanningRole, layout); | - |
| 1043 | invalidate(); | - |
| 1044 | } executed: }Execution Count:3 | 3 |
| 1045 | | - |
| 1046 | | - |
| 1047 | | - |
| 1048 | | - |
| 1049 | void QFormLayout::addItem(QLayoutItem *item) | - |
| 1050 | { | - |
| 1051 | QFormLayoutPrivate * const d = d_func(); | - |
| 1052 | | - |
| 1053 | int row = d->insertRow(d->m_matrix.rowCount()); | - |
| 1054 | d->setItem(row, FieldRole, item); | - |
| 1055 | invalidate(); | - |
| 1056 | } | 0 |
| 1057 | | - |
| 1058 | | - |
| 1059 | | - |
| 1060 | | - |
| 1061 | int QFormLayout::count() const | - |
| 1062 | { | - |
| 1063 | const QFormLayoutPrivate * const d = d_func(); | - |
| 1064 | return d->m_things.count(); executed: return d->m_things.count();Execution Count:33 | 33 |
| 1065 | } | - |
| 1066 | | - |
| 1067 | | - |
| 1068 | | - |
| 1069 | | - |
| 1070 | QLayoutItem *QFormLayout::itemAt(int index) const | - |
| 1071 | { | - |
| 1072 | const QFormLayoutPrivate * const d = d_func(); | - |
| 1073 | if (QFormLayoutItem *formItem = d->m_things.value(index)) evaluated: QFormLayoutItem *formItem = d->m_things.value(index)| yes Evaluation Count:168 | yes Evaluation Count:14 |
| 14-168 |
| 1074 | return formItem->item; executed: return formItem->item;Execution Count:168 | 168 |
| 1075 | return 0; executed: return 0;Execution Count:14 | 14 |
| 1076 | } | - |
| 1077 | | - |
| 1078 | | - |
| 1079 | | - |
| 1080 | | - |
| 1081 | QLayoutItem *QFormLayout::takeAt(int index) | - |
| 1082 | { | - |
| 1083 | QFormLayoutPrivate * const d = d_func(); | - |
| 1084 | | - |
| 1085 | const int storageIndex = storageIndexFromLayoutItem(d->m_matrix, d->m_things.value(index)); | - |
| 1086 | if (storageIndex == -1) { partially evaluated: storageIndex == -1| no Evaluation Count:0 | yes Evaluation Count:23 |
| 0-23 |
| 1087 | QMessageLogger("kernel/qformlayout.cpp", 1393, __PRETTY_FUNCTION__).warning("QFormLayout::takeAt: Invalid index %d", index); | - |
| 1088 | return 0; never executed: return 0; | 0 |
| 1089 | } | - |
| 1090 | | - |
| 1091 | int row, col; | - |
| 1092 | QFormLayoutPrivate::ItemMatrix::storageIndexToPosition(storageIndex, &row, &col); | - |
| 1093 | qt_noop(); | - |
| 1094 | | - |
| 1095 | QFormLayoutItem *item = d->m_matrix(row, col); | - |
| 1096 | qt_noop(); | - |
| 1097 | d->m_things.removeAt(index); | - |
| 1098 | d->m_matrix(row, col) = 0; | - |
| 1099 | | - |
| 1100 | invalidate(); | - |
| 1101 | | - |
| 1102 | | - |
| 1103 | QLayoutItem *i = item->item; | - |
| 1104 | item->item = 0; | - |
| 1105 | delete item; | - |
| 1106 | | - |
| 1107 | if (QLayout *l = i->layout()) { evaluated: QLayout *l = i->layout()| yes Evaluation Count:2 | yes Evaluation Count:21 |
| 2-21 |
| 1108 | | - |
| 1109 | if (l->parent() == this) partially evaluated: l->parent() == this| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 1110 | l->setParent(0); executed: l->setParent(0);Execution Count:2 | 2 |
| 1111 | } executed: }Execution Count:2 | 2 |
| 1112 | | - |
| 1113 | return i; executed: return i;Execution Count:23 | 23 |
| 1114 | } | - |
| 1115 | | - |
| 1116 | | - |
| 1117 | | - |
| 1118 | | - |
| 1119 | Qt::Orientations QFormLayout::expandingDirections() const | - |
| 1120 | { | - |
| 1121 | const QFormLayoutPrivate * const d = d_func(); | - |
| 1122 | QFormLayoutPrivate *e = const_cast<QFormLayoutPrivate *>(d); | - |
| 1123 | e->updateSizes(); | - |
| 1124 | | - |
| 1125 | Qt::Orientations o = 0; | - |
| 1126 | if (e->expandHorizontal) evaluated: e->expandHorizontal| yes Evaluation Count:1 | yes Evaluation Count:2 |
| 1-2 |
| 1127 | o = Qt::Horizontal; executed: o = Qt::Horizontal;Execution Count:1 | 1 |
| 1128 | if (e->expandVertical) partially evaluated: e->expandVertical| no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
| 1129 | o |= Qt::Vertical; never executed: o |= Qt::Vertical; | 0 |
| 1130 | return o; executed: return o;Execution Count:3 | 3 |
| 1131 | } | - |
| 1132 | | - |
| 1133 | | - |
| 1134 | | - |
| 1135 | | - |
| 1136 | bool QFormLayout::hasHeightForWidth() const | - |
| 1137 | { | - |
| 1138 | const QFormLayoutPrivate * const d = d_func(); | - |
| 1139 | QFormLayoutPrivate *e = const_cast<QFormLayoutPrivate *>(d); | - |
| 1140 | e->updateSizes(); | - |
| 1141 | return (d->has_hfw || rowWrapPolicy() == WrapLongRows); executed: return (d->has_hfw || rowWrapPolicy() == WrapLongRows);Execution Count:26 | 26 |
| 1142 | } | - |
| 1143 | | - |
| 1144 | | - |
| 1145 | | - |
| 1146 | | - |
| 1147 | int QFormLayout::heightForWidth(int width) const | - |
| 1148 | { | - |
| 1149 | const QFormLayoutPrivate * const d = d_func(); | - |
| 1150 | if (!hasHeightForWidth()) partially evaluated: !hasHeightForWidth()| no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
| 1151 | return -1; never executed: return -1; | 0 |
| 1152 | | - |
| 1153 | int leftMargin, topMargin, rightMargin, bottomMargin; | - |
| 1154 | getContentsMargins(&leftMargin, &topMargin, &rightMargin, &bottomMargin); | - |
| 1155 | | - |
| 1156 | int targetWidth = width - leftMargin - rightMargin; | - |
| 1157 | | - |
| 1158 | if (!d->haveHfwCached(targetWidth)) { evaluated: !d->haveHfwCached(targetWidth)| yes Evaluation Count:2 | yes Evaluation Count:1 |
| 1-2 |
| 1159 | QFormLayoutPrivate *dat = const_cast<QFormLayoutPrivate *>(d); | - |
| 1160 | dat->setupVerticalLayoutData(targetWidth); | - |
| 1161 | dat->setupHorizontalLayoutData(targetWidth); | - |
| 1162 | dat->recalcHFW(targetWidth); | - |
| 1163 | } executed: }Execution Count:2 | 2 |
| 1164 | if (targetWidth == d->sh_width) evaluated: targetWidth == d->sh_width| yes Evaluation Count:2 | yes Evaluation Count:1 |
| 1-2 |
| 1165 | return d->hfw_sh_height + topMargin + bottomMargin; executed: return d->hfw_sh_height + topMargin + bottomMargin;Execution Count:2 | 2 |
| 1166 | else | - |
| 1167 | return d->hfw_height + topMargin + bottomMargin; executed: return d->hfw_height + topMargin + bottomMargin;Execution Count:1 | 1 |
| 1168 | } | - |
| 1169 | | - |
| 1170 | | - |
| 1171 | | - |
| 1172 | | - |
| 1173 | void QFormLayout::setGeometry(const QRect &rect) | - |
| 1174 | { | - |
| 1175 | QFormLayoutPrivate * const d = d_func(); | - |
| 1176 | if (d->dirty || rect != geometry()) { partially evaluated: d->dirty| no Evaluation Count:0 | yes Evaluation Count:12 |
evaluated: rect != geometry()| yes Evaluation Count:10 | yes Evaluation Count:2 |
| 0-12 |
| 1177 | QRect cr = rect; | - |
| 1178 | int leftMargin, topMargin, rightMargin, bottomMargin; | - |
| 1179 | getContentsMargins(&leftMargin, &topMargin, &rightMargin, &bottomMargin); | - |
| 1180 | cr.adjust(+leftMargin, +topMargin, -rightMargin, -bottomMargin); | - |
| 1181 | | - |
| 1182 | bool hfw = hasHeightForWidth(); | - |
| 1183 | d->setupVerticalLayoutData(cr.width()); | - |
| 1184 | d->setupHorizontalLayoutData(cr.width()); | - |
| 1185 | if (hfw && (!d->haveHfwCached(cr.width()) || d->hfwLayouts.size() != d->vLayoutCount)) evaluated: hfw| yes Evaluation Count:2 | yes Evaluation Count:8 |
partially evaluated: !d->haveHfwCached(cr.width())| no Evaluation Count:0 | yes Evaluation Count:2 |
evaluated: d->hfwLayouts.size() != d->vLayoutCount| yes Evaluation Count:1 | yes Evaluation Count:1 |
| 0-8 |
| 1186 | d->recalcHFW(cr.width()); executed: d->recalcHFW(cr.width());Execution Count:1 | 1 |
| 1187 | if (hfw) { evaluated: hfw| yes Evaluation Count:2 | yes Evaluation Count:8 |
| 2-8 |
| 1188 | qGeomCalc(d->hfwLayouts, 0, d->vLayoutCount, cr.y(), cr.height()); | - |
| 1189 | d->arrangeWidgets(d->hfwLayouts, cr); | - |
| 1190 | } else { executed: }Execution Count:2 | 2 |
| 1191 | qGeomCalc(d->vLayouts, 0, d->vLayoutCount, cr.y(), cr.height()); | - |
| 1192 | d->arrangeWidgets(d->vLayouts, cr); | - |
| 1193 | } executed: }Execution Count:8 | 8 |
| 1194 | QLayout::setGeometry(rect); | - |
| 1195 | } executed: }Execution Count:10 | 10 |
| 1196 | } executed: }Execution Count:12 | 12 |
| 1197 | | - |
| 1198 | | - |
| 1199 | | - |
| 1200 | | - |
| 1201 | QSize QFormLayout::sizeHint() const | - |
| 1202 | { | - |
| 1203 | const QFormLayoutPrivate * const d = d_func(); | - |
| 1204 | if (!d->prefSize.isValid()) { partially evaluated: !d->prefSize.isValid()| no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
| 1205 | QFormLayoutPrivate *dat = const_cast<QFormLayoutPrivate *>(d); | - |
| 1206 | dat->calcSizeHints(); | - |
| 1207 | } | 0 |
| 1208 | return d->prefSize; executed: return d->prefSize;Execution Count:3 | 3 |
| 1209 | } | - |
| 1210 | | - |
| 1211 | | - |
| 1212 | | - |
| 1213 | | - |
| 1214 | QSize QFormLayout::minimumSize() const | - |
| 1215 | { | - |
| 1216 | | - |
| 1217 | const QFormLayoutPrivate * const d = d_func(); | - |
| 1218 | if (!d->minSize.isValid()) { partially evaluated: !d->minSize.isValid()| yes Evaluation Count:7 | no Evaluation Count:0 |
| 0-7 |
| 1219 | QFormLayoutPrivate *dat = const_cast<QFormLayoutPrivate *>(d); | - |
| 1220 | dat->calcSizeHints(); | - |
| 1221 | } executed: }Execution Count:7 | 7 |
| 1222 | return d->minSize; executed: return d->minSize;Execution Count:7 | 7 |
| 1223 | } | - |
| 1224 | | - |
| 1225 | | - |
| 1226 | | - |
| 1227 | | - |
| 1228 | void QFormLayout::invalidate() | - |
| 1229 | { | - |
| 1230 | QFormLayoutPrivate * const d = d_func(); | - |
| 1231 | d->dirty = true; | - |
| 1232 | d->sizesDirty = true; | - |
| 1233 | d->minSize = QSize(); | - |
| 1234 | d->prefSize = QSize(); | - |
| 1235 | d->formMaxWidth = -1; | - |
| 1236 | d->hfw_width = -1; | - |
| 1237 | d->sh_width = -1; | - |
| 1238 | d->layoutWidth = -1; | - |
| 1239 | d->hfw_sh_height = -1; | - |
| 1240 | QLayout::invalidate(); | - |
| 1241 | } executed: }Execution Count:109 | 109 |
| 1242 | | - |
| 1243 | | - |
| 1244 | | - |
| 1245 | | - |
| 1246 | | - |
| 1247 | | - |
| 1248 | int QFormLayout::rowCount() const | - |
| 1249 | { | - |
| 1250 | const QFormLayoutPrivate * const d = d_func(); | - |
| 1251 | return d->m_matrix.rowCount(); executed: return d->m_matrix.rowCount();Execution Count:42 | 42 |
| 1252 | } | - |
| 1253 | | - |
| 1254 | | - |
| 1255 | | - |
| 1256 | | - |
| 1257 | | - |
| 1258 | | - |
| 1259 | | - |
| 1260 | QLayoutItem *QFormLayout::itemAt(int row, ItemRole role) const | - |
| 1261 | { | - |
| 1262 | const QFormLayoutPrivate * const d = d_func(); | - |
| 1263 | if (uint(row) >= uint(d->m_matrix.rowCount())) partially evaluated: uint(row) >= uint(d->m_matrix.rowCount())| no Evaluation Count:0 | yes Evaluation Count:38 |
| 0-38 |
| 1264 | return 0; never executed: return 0; | 0 |
| 1265 | switch (role) { | - |
| 1266 | case SpanningRole: | - |
| 1267 | if (QFormLayoutItem *item = d->m_matrix(row, 1)) never evaluated: QFormLayoutItem *item = d->m_matrix(row, 1) | 0 |
| 1268 | if (item->fullRow) never evaluated: item->fullRow | 0 |
| 1269 | return item->item; never executed: return item->item; | 0 |
| 1270 | break; | 0 |
| 1271 | case LabelRole: | - |
| 1272 | case FieldRole: | - |
| 1273 | if (QFormLayoutItem *item = d->m_matrix(row, (role == LabelRole) ? 0 : 1)) evaluated: QFormLayoutItem *item = d->m_matrix(row, (role == LabelRole) ? 0 : 1)| yes Evaluation Count:32 | yes Evaluation Count:6 |
| 6-32 |
| 1274 | return item->item; executed: return item->item;Execution Count:32 | 32 |
| 1275 | break; executed: break;Execution Count:6 | 6 |
| 1276 | } | - |
| 1277 | return 0; executed: return 0;Execution Count:6 | 6 |
| 1278 | } | - |
| 1279 | void QFormLayout::getItemPosition(int index, int *rowPtr, ItemRole *rolePtr) const | - |
| 1280 | { | - |
| 1281 | const QFormLayoutPrivate * const d = d_func(); | - |
| 1282 | int col = -1; | - |
| 1283 | int row = -1; | - |
| 1284 | | - |
| 1285 | const int storageIndex = storageIndexFromLayoutItem(d->m_matrix, d->m_things.value(index)); | - |
| 1286 | if (storageIndex != -1) evaluated: storageIndex != -1| yes Evaluation Count:16 | yes Evaluation Count:4 |
| 4-16 |
| 1287 | QFormLayoutPrivate::ItemMatrix::storageIndexToPosition(storageIndex, &row, &col); executed: QFormLayoutPrivate::ItemMatrix::storageIndexToPosition(storageIndex, &row, &col);Execution Count:16 | 16 |
| 1288 | | - |
| 1289 | if (rowPtr) partially evaluated: rowPtr| yes Evaluation Count:20 | no Evaluation Count:0 |
| 0-20 |
| 1290 | *rowPtr = row; executed: *rowPtr = row;Execution Count:20 | 20 |
| 1291 | if (rolePtr && col != -1) { partially evaluated: rolePtr| yes Evaluation Count:20 | no Evaluation Count:0 |
evaluated: col != -1| yes Evaluation Count:16 | yes Evaluation Count:4 |
| 0-20 |
| 1292 | const bool spanning = col == 1 && d->m_matrix(row, col)->fullRow; evaluated: col == 1| yes Evaluation Count:9 | yes Evaluation Count:7 |
evaluated: d->m_matrix(row, col)->fullRow| yes Evaluation Count:1 | yes Evaluation Count:8 |
| 1-9 |
| 1293 | if (spanning) { evaluated: spanning| yes Evaluation Count:1 | yes Evaluation Count:15 |
| 1-15 |
| 1294 | *rolePtr = SpanningRole; | - |
| 1295 | } else { executed: }Execution Count:1 | 1 |
| 1296 | *rolePtr = ItemRole(col); | - |
| 1297 | } executed: }Execution Count:15 | 15 |
| 1298 | } | - |
| 1299 | } executed: }Execution Count:20 | 20 |
| 1300 | | - |
| 1301 | | - |
| 1302 | | - |
| 1303 | | - |
| 1304 | | - |
| 1305 | | - |
| 1306 | | - |
| 1307 | void QFormLayout::getLayoutPosition(QLayout *layout, int *rowPtr, ItemRole *rolePtr) const | - |
| 1308 | { | - |
| 1309 | int n = count(); | - |
| 1310 | int index = 0; | - |
| 1311 | while (index < n) { evaluated: index < n| yes Evaluation Count:26 | yes Evaluation Count:2 |
| 2-26 |
| 1312 | if (itemAt(index) == layout) evaluated: itemAt(index) == layout| yes Evaluation Count:5 | yes Evaluation Count:21 |
| 5-21 |
| 1313 | break; executed: break;Execution Count:5 | 5 |
| 1314 | ++index; | - |
| 1315 | } executed: }Execution Count:21 | 21 |
| 1316 | getItemPosition(index, rowPtr, rolePtr); | - |
| 1317 | } executed: }Execution Count:7 | 7 |
| 1318 | void QFormLayout::getWidgetPosition(QWidget *widget, int *rowPtr, ItemRole *rolePtr) const | - |
| 1319 | { | - |
| 1320 | getItemPosition(indexOf(widget), rowPtr, rolePtr); | - |
| 1321 | } executed: }Execution Count:13 | 13 |
| 1322 | QWidget *QFormLayout::labelForField(QWidget *field) const | - |
| 1323 | { | - |
| 1324 | const QFormLayoutPrivate * const d = d_func(); | - |
| 1325 | | - |
| 1326 | int row; | - |
| 1327 | ItemRole role; | - |
| 1328 | | - |
| 1329 | getWidgetPosition(field, &row, &role); | - |
| 1330 | | - |
| 1331 | if (row != -1 && role == FieldRole) { partially evaluated: row != -1| yes Evaluation Count:3 | no Evaluation Count:0 |
evaluated: role == FieldRole| yes Evaluation Count:2 | yes Evaluation Count:1 |
| 0-3 |
| 1332 | if (QFormLayoutItem *label = d->m_matrix(row, LabelRole)) evaluated: QFormLayoutItem *label = d->m_matrix(row, LabelRole)| yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
| 1333 | return label->widget(); executed: return label->widget();Execution Count:1 | 1 |
| 1334 | } executed: }Execution Count:1 | 1 |
| 1335 | return 0; executed: return 0;Execution Count:2 | 2 |
| 1336 | } | - |
| 1337 | | - |
| 1338 | | - |
| 1339 | | - |
| 1340 | | - |
| 1341 | QWidget *QFormLayout::labelForField(QLayout *field) const | - |
| 1342 | { | - |
| 1343 | const QFormLayoutPrivate * const d = d_func(); | - |
| 1344 | | - |
| 1345 | int row; | - |
| 1346 | ItemRole role; | - |
| 1347 | | - |
| 1348 | getLayoutPosition(field, &row, &role); | - |
| 1349 | | - |
| 1350 | if (row != -1 && role == FieldRole) { never evaluated: row != -1 never evaluated: role == FieldRole | 0 |
| 1351 | if (QFormLayoutItem *label = d->m_matrix(row, LabelRole)) never evaluated: QFormLayoutItem *label = d->m_matrix(row, LabelRole) | 0 |
| 1352 | return label->widget(); never executed: return label->widget(); | 0 |
| 1353 | } | 0 |
| 1354 | return 0; never executed: return 0; | 0 |
| 1355 | } | - |
| 1356 | void QFormLayout::setFieldGrowthPolicy(FieldGrowthPolicy policy) | - |
| 1357 | { | - |
| 1358 | QFormLayoutPrivate * const d = d_func(); | - |
| 1359 | if (FieldGrowthPolicy(d->fieldGrowthPolicy) != policy) { partially evaluated: FieldGrowthPolicy(d->fieldGrowthPolicy) != policy| yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
| 1360 | d->fieldGrowthPolicy = policy; | - |
| 1361 | invalidate(); | - |
| 1362 | } executed: }Execution Count:4 | 4 |
| 1363 | } executed: }Execution Count:4 | 4 |
| 1364 | | - |
| 1365 | QFormLayout::FieldGrowthPolicy QFormLayout::fieldGrowthPolicy() const | - |
| 1366 | { | - |
| 1367 | const QFormLayoutPrivate * const d = d_func(); | - |
| 1368 | if (d->fieldGrowthPolicy == DefaultFieldGrowthPolicy) { evaluated: d->fieldGrowthPolicy == DefaultFieldGrowthPolicy| yes Evaluation Count:9 | yes Evaluation Count:20 |
| 9-20 |
| 1369 | return QFormLayout::FieldGrowthPolicy(d->getStyle()->styleHint(QStyle::SH_FormLayoutFieldGrowthPolicy)); executed: return QFormLayout::FieldGrowthPolicy(d->getStyle()->styleHint(QStyle::SH_FormLayoutFieldGrowthPolicy));Execution Count:9 | 9 |
| 1370 | } else { | - |
| 1371 | return QFormLayout::FieldGrowthPolicy(d->fieldGrowthPolicy); executed: return QFormLayout::FieldGrowthPolicy(d->fieldGrowthPolicy);Execution Count:20 | 20 |
| 1372 | } | - |
| 1373 | } | - |
| 1374 | void QFormLayout::setRowWrapPolicy(RowWrapPolicy policy) | - |
| 1375 | { | - |
| 1376 | QFormLayoutPrivate * const d = d_func(); | - |
| 1377 | if (RowWrapPolicy(d->rowWrapPolicy) != policy) { partially evaluated: RowWrapPolicy(d->rowWrapPolicy) != policy| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 1378 | d->rowWrapPolicy = policy; | - |
| 1379 | invalidate(); | - |
| 1380 | } executed: }Execution Count:1 | 1 |
| 1381 | } executed: }Execution Count:1 | 1 |
| 1382 | | - |
| 1383 | QFormLayout::RowWrapPolicy QFormLayout::rowWrapPolicy() const | - |
| 1384 | { | - |
| 1385 | const QFormLayoutPrivate * const d = d_func(); | - |
| 1386 | if (d->rowWrapPolicy == DefaultRowWrapPolicy) { evaluated: d->rowWrapPolicy == DefaultRowWrapPolicy| yes Evaluation Count:49 | yes Evaluation Count:17 |
| 17-49 |
| 1387 | return QFormLayout::RowWrapPolicy(d->getStyle()->styleHint(QStyle::SH_FormLayoutWrapPolicy)); executed: return QFormLayout::RowWrapPolicy(d->getStyle()->styleHint(QStyle::SH_FormLayoutWrapPolicy));Execution Count:49 | 49 |
| 1388 | } else { | - |
| 1389 | return QFormLayout::RowWrapPolicy(d->rowWrapPolicy); executed: return QFormLayout::RowWrapPolicy(d->rowWrapPolicy);Execution Count:17 | 17 |
| 1390 | } | - |
| 1391 | } | - |
| 1392 | void QFormLayout::setLabelAlignment(Qt::Alignment alignment) | - |
| 1393 | { | - |
| 1394 | QFormLayoutPrivate * const d = d_func(); | - |
| 1395 | if (d->labelAlignment != alignment) { never evaluated: d->labelAlignment != alignment | 0 |
| 1396 | d->labelAlignment = alignment; | - |
| 1397 | invalidate(); | - |
| 1398 | } | 0 |
| 1399 | } | 0 |
| 1400 | | - |
| 1401 | Qt::Alignment QFormLayout::labelAlignment() const | - |
| 1402 | { | - |
| 1403 | const QFormLayoutPrivate * const d = d_func(); | - |
| 1404 | if (!d->labelAlignment) { partially evaluated: !d->labelAlignment| yes Evaluation Count:21 | no Evaluation Count:0 |
| 0-21 |
| 1405 | return Qt::Alignment(d->getStyle()->styleHint(QStyle::SH_FormLayoutLabelAlignment)); executed: return Qt::Alignment(d->getStyle()->styleHint(QStyle::SH_FormLayoutLabelAlignment));Execution Count:21 | 21 |
| 1406 | } else { | - |
| 1407 | return d->labelAlignment; never executed: return d->labelAlignment; | 0 |
| 1408 | } | - |
| 1409 | } | - |
| 1410 | void QFormLayout::setFormAlignment(Qt::Alignment alignment) | - |
| 1411 | { | - |
| 1412 | QFormLayoutPrivate * const d = d_func(); | - |
| 1413 | if (d->formAlignment != alignment) { never evaluated: d->formAlignment != alignment | 0 |
| 1414 | d->formAlignment = alignment; | - |
| 1415 | invalidate(); | - |
| 1416 | } | 0 |
| 1417 | } | 0 |
| 1418 | | - |
| 1419 | Qt::Alignment QFormLayout::formAlignment() const | - |
| 1420 | { | - |
| 1421 | const QFormLayoutPrivate * const d = d_func(); | - |
| 1422 | if (!d->formAlignment) { partially evaluated: !d->formAlignment| yes Evaluation Count:31 | no Evaluation Count:0 |
| 0-31 |
| 1423 | return Qt::Alignment(d->getStyle()->styleHint(QStyle::SH_FormLayoutFormAlignment)); executed: return Qt::Alignment(d->getStyle()->styleHint(QStyle::SH_FormLayoutFormAlignment));Execution Count:31 | 31 |
| 1424 | } else { | - |
| 1425 | return d->formAlignment; never executed: return d->formAlignment; | 0 |
| 1426 | } | - |
| 1427 | } | - |
| 1428 | void QFormLayout::setHorizontalSpacing(int spacing) | - |
| 1429 | { | - |
| 1430 | QFormLayoutPrivate * const d = d_func(); | - |
| 1431 | if (spacing != d->hSpacing) { partially evaluated: spacing != d->hSpacing| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 1432 | d->hSpacing = spacing; | - |
| 1433 | invalidate(); | - |
| 1434 | } executed: }Execution Count:2 | 2 |
| 1435 | } executed: }Execution Count:2 | 2 |
| 1436 | | - |
| 1437 | int QFormLayout::horizontalSpacing() const | - |
| 1438 | { | - |
| 1439 | const QFormLayoutPrivate * const d = d_func(); | - |
| 1440 | if (d->hSpacing >= 0) { evaluated: d->hSpacing >= 0| yes Evaluation Count:1 | yes Evaluation Count:11 |
| 1-11 |
| 1441 | return d->hSpacing; executed: return d->hSpacing;Execution Count:1 | 1 |
| 1442 | } else { | - |
| 1443 | return qSmartSpacing(this, QStyle::PM_LayoutHorizontalSpacing); executed: return qSmartSpacing(this, QStyle::PM_LayoutHorizontalSpacing);Execution Count:11 | 11 |
| 1444 | } | - |
| 1445 | } | - |
| 1446 | void QFormLayout::setVerticalSpacing(int spacing) | - |
| 1447 | { | - |
| 1448 | QFormLayoutPrivate * const d = d_func(); | - |
| 1449 | if (spacing != d->vSpacing) { partially evaluated: spacing != d->vSpacing| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 1450 | d->vSpacing = spacing; | - |
| 1451 | invalidate(); | - |
| 1452 | } executed: }Execution Count:2 | 2 |
| 1453 | } executed: }Execution Count:2 | 2 |
| 1454 | | - |
| 1455 | int QFormLayout::verticalSpacing() const | - |
| 1456 | { | - |
| 1457 | const QFormLayoutPrivate * const d = d_func(); | - |
| 1458 | if (d->vSpacing >= 0) { evaluated: d->vSpacing >= 0| yes Evaluation Count:1 | yes Evaluation Count:29 |
| 1-29 |
| 1459 | return d->vSpacing; executed: return d->vSpacing;Execution Count:1 | 1 |
| 1460 | } else { | - |
| 1461 | return qSmartSpacing(this, QStyle::PM_LayoutVerticalSpacing); executed: return qSmartSpacing(this, QStyle::PM_LayoutVerticalSpacing);Execution Count:29 | 29 |
| 1462 | } | - |
| 1463 | } | - |
| 1464 | | - |
| 1465 | | - |
| 1466 | | - |
| 1467 | | - |
| 1468 | | - |
| 1469 | | - |
| 1470 | | - |
| 1471 | void QFormLayout::setSpacing(int spacing) | - |
| 1472 | { | - |
| 1473 | QFormLayoutPrivate * const d = d_func(); | - |
| 1474 | d->vSpacing = d->hSpacing = spacing; | - |
| 1475 | invalidate(); | - |
| 1476 | } | 0 |
| 1477 | | - |
| 1478 | | - |
| 1479 | | - |
| 1480 | | - |
| 1481 | | - |
| 1482 | | - |
| 1483 | | - |
| 1484 | int QFormLayout::spacing() const | - |
| 1485 | { | - |
| 1486 | int hSpacing = horizontalSpacing(); | - |
| 1487 | if (hSpacing == verticalSpacing()) { partially evaluated: hSpacing == verticalSpacing()| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 1488 | return hSpacing; executed: return hSpacing;Execution Count:1 | 1 |
| 1489 | } else { | - |
| 1490 | return -1; never executed: return -1; | 0 |
| 1491 | } | - |
| 1492 | } | - |
| 1493 | | - |
| 1494 | void QFormLayoutPrivate::arrangeWidgets(const QVector<QLayoutStruct>& layouts, QRect &rect) | - |
| 1495 | { | - |
| 1496 | QFormLayout * const q = q_func(); | - |
| 1497 | | - |
| 1498 | int i; | - |
| 1499 | const int rr = m_matrix.rowCount(); | - |
| 1500 | QWidget *w = q->parentWidget(); | - |
| 1501 | Qt::LayoutDirection layoutDirection = w ? w->layoutDirection() : QApplication::layoutDirection(); partially evaluated: w| yes Evaluation Count:10 | no Evaluation Count:0 |
| 0-10 |
| 1502 | | - |
| 1503 | Qt::Alignment formAlignment = fixedAlignment(q->formAlignment(), layoutDirection); | - |
| 1504 | int leftOffset = 0; | - |
| 1505 | int delta = rect.width() - formMaxWidth; | - |
| 1506 | if (formAlignment & (Qt::AlignHCenter | Qt::AlignRight) && delta > 0) { partially evaluated: formAlignment & (Qt::AlignHCenter | Qt::AlignRight)| no Evaluation Count:0 | yes Evaluation Count:10 |
never evaluated: delta > 0 | 0-10 |
| 1507 | leftOffset = delta; | - |
| 1508 | if (formAlignment & Qt::AlignHCenter) never evaluated: formAlignment & Qt::AlignHCenter | 0 |
| 1509 | leftOffset >>= 1; never executed: leftOffset >>= 1; | 0 |
| 1510 | } | 0 |
| 1511 | | - |
| 1512 | for (i = 0; i < rr; ++i) { evaluated: i < rr| yes Evaluation Count:18 | yes Evaluation Count:10 |
| 10-18 |
| 1513 | QFormLayoutItem *label = m_matrix(i, 0); | - |
| 1514 | QFormLayoutItem *field = m_matrix(i, 1); | - |
| 1515 | | - |
| 1516 | if (label) { partially evaluated: label| yes Evaluation Count:18 | no Evaluation Count:0 |
| 0-18 |
| 1517 | int height = layouts.at(label->vLayoutIndex).size; | - |
| 1518 | if ((label->expandingDirections() & Qt::Vertical) == 0) { partially evaluated: (label->expandingDirections() & Qt::Vertical) == 0| yes Evaluation Count:18 | no Evaluation Count:0 |
| 0-18 |
| 1519 | | - |
| 1520 | | - |
| 1521 | | - |
| 1522 | | - |
| 1523 | | - |
| 1524 | | - |
| 1525 | height = qMin(height, | - |
| 1526 | qMin(label->sizeHint.height() * 7 / 4, | - |
| 1527 | label->maxSize.height())); | - |
| 1528 | } executed: }Execution Count:18 | 18 |
| 1529 | | - |
| 1530 | QSize sz(qMin(label->layoutWidth, label->sizeHint.width()), height); | - |
| 1531 | int x = leftOffset + rect.x() + label->layoutPos; | - |
| 1532 | if (fixedAlignment(q->labelAlignment(), layoutDirection) & Qt::AlignRight) partially evaluated: fixedAlignment(q->labelAlignment(), layoutDirection) & Qt::AlignRight| no Evaluation Count:0 | yes Evaluation Count:18 |
| 0-18 |
| 1533 | x += label->layoutWidth - sz.width(); never executed: x += label->layoutWidth - sz.width(); | 0 |
| 1534 | QPoint p(x, layouts.at(label->vLayoutIndex).pos); | - |
| 1535 | | - |
| 1536 | | - |
| 1537 | label->setGeometry(QStyle::visualRect(layoutDirection, rect, QRect(p, sz))); | - |
| 1538 | } executed: }Execution Count:18 | 18 |
| 1539 | | - |
| 1540 | if (field) { evaluated: field| yes Evaluation Count:14 | yes Evaluation Count:4 |
| 4-14 |
| 1541 | QSize sz(field->layoutWidth, layouts.at(field->vLayoutIndex).size); | - |
| 1542 | QPoint p(field->layoutPos + leftOffset + rect.x(), layouts.at(field->vLayoutIndex).pos); | - |
| 1543 | | - |
| 1544 | | - |
| 1545 | | - |
| 1546 | | - |
| 1547 | | - |
| 1548 | | - |
| 1549 | if (field->maxSize.isValid()) partially evaluated: field->maxSize.isValid()| yes Evaluation Count:14 | no Evaluation Count:0 |
| 0-14 |
| 1550 | sz = sz.boundedTo(field->maxSize); executed: sz = sz.boundedTo(field->maxSize);Execution Count:14 | 14 |
| 1551 | | - |
| 1552 | field->setGeometry(QStyle::visualRect(layoutDirection, rect, QRect(p, sz))); | - |
| 1553 | } executed: }Execution Count:14 | 14 |
| 1554 | } executed: }Execution Count:18 | 18 |
| 1555 | } executed: }Execution Count:10 | 10 |
| 1556 | void QFormLayout::setWidget(int row, ItemRole role, QWidget *widget) | - |
| 1557 | { | - |
| 1558 | QFormLayoutPrivate * const d = d_func(); | - |
| 1559 | int rowCnt = rowCount(); | - |
| 1560 | if (row >= rowCnt) evaluated: row >= rowCnt| yes Evaluation Count:4 | yes Evaluation Count:8 |
| 4-8 |
| 1561 | d->insertRows(rowCnt, row - rowCnt + 1); executed: d->insertRows(rowCnt, row - rowCnt + 1);Execution Count:4 | 4 |
| 1562 | d->setWidget(row, role, widget); | - |
| 1563 | } executed: }Execution Count:12 | 12 |
| 1564 | void QFormLayout::setLayout(int row, ItemRole role, QLayout *layout) | - |
| 1565 | { | - |
| 1566 | QFormLayoutPrivate * const d = d_func(); | - |
| 1567 | int rowCnt = rowCount(); | - |
| 1568 | if (row >= rowCnt) evaluated: row >= rowCnt| yes Evaluation Count:2 | yes Evaluation Count:4 |
| 2-4 |
| 1569 | d->insertRows(rowCnt, row - rowCnt + 1); executed: d->insertRows(rowCnt, row - rowCnt + 1);Execution Count:2 | 2 |
| 1570 | d->setLayout(row, role, layout); | - |
| 1571 | } executed: }Execution Count:6 | 6 |
| 1572 | void QFormLayout::setItem(int row, ItemRole role, QLayoutItem *item) | - |
| 1573 | { | - |
| 1574 | QFormLayoutPrivate * const d = d_func(); | - |
| 1575 | int rowCnt = rowCount(); | - |
| 1576 | if (row >= rowCnt) never evaluated: row >= rowCnt | 0 |
| 1577 | d->insertRows(rowCnt, row - rowCnt + 1); never executed: d->insertRows(rowCnt, row - rowCnt + 1); | 0 |
| 1578 | d->setItem(row, role, item); | - |
| 1579 | } | 0 |
| 1580 | | - |
| 1581 | | - |
| 1582 | | - |
| 1583 | | - |
| 1584 | | - |
| 1585 | void QFormLayout::resetFieldGrowthPolicy() | - |
| 1586 | { | - |
| 1587 | QFormLayoutPrivate * const d = d_func(); | - |
| 1588 | d->fieldGrowthPolicy = DefaultFieldGrowthPolicy; | - |
| 1589 | } | 0 |
| 1590 | | - |
| 1591 | | - |
| 1592 | | - |
| 1593 | | - |
| 1594 | | - |
| 1595 | void QFormLayout::resetRowWrapPolicy() | - |
| 1596 | { | - |
| 1597 | QFormLayoutPrivate * const d = d_func(); | - |
| 1598 | d->rowWrapPolicy = DefaultRowWrapPolicy; | - |
| 1599 | } | 0 |
| 1600 | | - |
| 1601 | | - |
| 1602 | | - |
| 1603 | | - |
| 1604 | | - |
| 1605 | void QFormLayout::resetFormAlignment() | - |
| 1606 | { | - |
| 1607 | QFormLayoutPrivate * const d = d_func(); | - |
| 1608 | d->formAlignment = 0; | - |
| 1609 | } | 0 |
| 1610 | | - |
| 1611 | | - |
| 1612 | | - |
| 1613 | | - |
| 1614 | | - |
| 1615 | void QFormLayout::resetLabelAlignment() | - |
| 1616 | { | - |
| 1617 | QFormLayoutPrivate * const d = d_func(); | - |
| 1618 | d->labelAlignment = 0; | - |
| 1619 | } | 0 |
| 1620 | | - |
| 1621 | | - |
| | |