| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/widgets/kernel/qlayoutengine.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||
| 3 | - | |||||||||||||||||||||||||
| 4 | - | |||||||||||||||||||||||||
| 5 | - | |||||||||||||||||||||||||
| 6 | - | |||||||||||||||||||||||||
| 7 | - | |||||||||||||||||||||||||
| 8 | - | |||||||||||||||||||||||||
| 9 | - | |||||||||||||||||||||||||
| 10 | typedef qint64 Fixed64; | - | ||||||||||||||||||||||||
| 11 | static inline Fixed64 toFixed(int i) { return never executed: (Fixed64)i * 256;return (Fixed64)i * 256;never executed: }return (Fixed64)i * 256; | 0 | ||||||||||||||||||||||||
| 12 | static inline int fRound(Fixed64 i) { | - | ||||||||||||||||||||||||
| 13 | return never executed: (i % 256 < 128) ? i / 256 : 1 + i / 256;return (i % 256 < 128) ? i / 256 : 1 + i / 256;never executed: return (i % 256 < 128) ? i / 256 : 1 + i / 256; | 0 | ||||||||||||||||||||||||
| 14 | } | - | ||||||||||||||||||||||||
| 15 | void qGeomCalc(QVector<QLayoutStruct> &chain, int start, int count, | - | ||||||||||||||||||||||||
| 16 | int pos, int space, int spacer) | - | ||||||||||||||||||||||||
| 17 | { | - | ||||||||||||||||||||||||
| 18 | int cHint = 0; | - | ||||||||||||||||||||||||
| 19 | int cMin = 0; | - | ||||||||||||||||||||||||
| 20 | int cMax = 0; | - | ||||||||||||||||||||||||
| 21 | int sumStretch = 0; | - | ||||||||||||||||||||||||
| 22 | int sumSpacing = 0; | - | ||||||||||||||||||||||||
| 23 | int expandingCount = 0; | - | ||||||||||||||||||||||||
| 24 | - | |||||||||||||||||||||||||
| 25 | bool allEmptyNonstretch = true; | - | ||||||||||||||||||||||||
| 26 | int pendingSpacing = -1; | - | ||||||||||||||||||||||||
| 27 | int spacerCount = 0; | - | ||||||||||||||||||||||||
| 28 | int i; | - | ||||||||||||||||||||||||
| 29 | - | |||||||||||||||||||||||||
| 30 | for (i = start; i < start + count
| 0 | ||||||||||||||||||||||||
| 31 | QLayoutStruct *data = &chain[i]; | - | ||||||||||||||||||||||||
| 32 | - | |||||||||||||||||||||||||
| 33 | data->done = false; | - | ||||||||||||||||||||||||
| 34 | cHint += data->smartSizeHint(); | - | ||||||||||||||||||||||||
| 35 | cMin += data->minimumSize; | - | ||||||||||||||||||||||||
| 36 | cMax += data->maximumSize; | - | ||||||||||||||||||||||||
| 37 | sumStretch += data->stretch; | - | ||||||||||||||||||||||||
| 38 | if (!data->empty
| 0 | ||||||||||||||||||||||||
| 39 | - | |||||||||||||||||||||||||
| 40 | - | |||||||||||||||||||||||||
| 41 | - | |||||||||||||||||||||||||
| 42 | - | |||||||||||||||||||||||||
| 43 | if (pendingSpacing >= 0
| 0 | ||||||||||||||||||||||||
| 44 | sumSpacing += pendingSpacing; | - | ||||||||||||||||||||||||
| 45 | ++spacerCount; | - | ||||||||||||||||||||||||
| 46 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 47 | pendingSpacing = data->effectiveSpacer(spacer); | - | ||||||||||||||||||||||||
| 48 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 49 | if (data->expansive
| 0 | ||||||||||||||||||||||||
| 50 | expandingCount++; never executed: expandingCount++; | 0 | ||||||||||||||||||||||||
| 51 | allEmptyNonstretch = allEmptyNonstretch
| 0 | ||||||||||||||||||||||||
| 52 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 53 | - | |||||||||||||||||||||||||
| 54 | int extraspace = 0; | - | ||||||||||||||||||||||||
| 55 | - | |||||||||||||||||||||||||
| 56 | if (space < cMin + sumSpacing
| 0 | ||||||||||||||||||||||||
| 57 | - | |||||||||||||||||||||||||
| 58 | - | |||||||||||||||||||||||||
| 59 | - | |||||||||||||||||||||||||
| 60 | - | |||||||||||||||||||||||||
| 61 | int minSize = cMin + sumSpacing; | - | ||||||||||||||||||||||||
| 62 | - | |||||||||||||||||||||||||
| 63 | - | |||||||||||||||||||||||||
| 64 | if (spacer >= 0
| 0 | ||||||||||||||||||||||||
| 65 | spacer = minSize > 0
| 0 | ||||||||||||||||||||||||
| 66 | sumSpacing = spacer * spacerCount; | - | ||||||||||||||||||||||||
| 67 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 68 | - | |||||||||||||||||||||||||
| 69 | QVarLengthArray<int, 32> minimumSizes; | - | ||||||||||||||||||||||||
| 70 | minimumSizes.reserve(count); | - | ||||||||||||||||||||||||
| 71 | - | |||||||||||||||||||||||||
| 72 | for (i = start; i < start + count
| 0 | ||||||||||||||||||||||||
| 73 | minimumSizes << chain.at(i).minimumSize; never executed: minimumSizes << chain.at(i).minimumSize; | 0 | ||||||||||||||||||||||||
| 74 | - | |||||||||||||||||||||||||
| 75 | std::sort(minimumSizes.begin(), minimumSizes.end()); | - | ||||||||||||||||||||||||
| 76 | - | |||||||||||||||||||||||||
| 77 | int space_left = space - sumSpacing; | - | ||||||||||||||||||||||||
| 78 | - | |||||||||||||||||||||||||
| 79 | int sum = 0; | - | ||||||||||||||||||||||||
| 80 | int idx = 0; | - | ||||||||||||||||||||||||
| 81 | int space_used=0; | - | ||||||||||||||||||||||||
| 82 | int current = 0; | - | ||||||||||||||||||||||||
| 83 | while (idx < count
| 0 | ||||||||||||||||||||||||
| 84 | current = minimumSizes.at(idx); | - | ||||||||||||||||||||||||
| 85 | space_used = sum + current * (count - idx); | - | ||||||||||||||||||||||||
| 86 | sum += current; | - | ||||||||||||||||||||||||
| 87 | ++idx; | - | ||||||||||||||||||||||||
| 88 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 89 | --idx; | - | ||||||||||||||||||||||||
| 90 | int deficit = space_used - space_left; | - | ||||||||||||||||||||||||
| 91 | - | |||||||||||||||||||||||||
| 92 | int items = count - idx; | - | ||||||||||||||||||||||||
| 93 | - | |||||||||||||||||||||||||
| 94 | - | |||||||||||||||||||||||||
| 95 | - | |||||||||||||||||||||||||
| 96 | - | |||||||||||||||||||||||||
| 97 | - | |||||||||||||||||||||||||
| 98 | int deficitPerItem = deficit/items; | - | ||||||||||||||||||||||||
| 99 | int remainder = deficit % items; | - | ||||||||||||||||||||||||
| 100 | int maxval = current - deficitPerItem; | - | ||||||||||||||||||||||||
| 101 | - | |||||||||||||||||||||||||
| 102 | int rest = 0; | - | ||||||||||||||||||||||||
| 103 | for (i = start; i < start + count
| 0 | ||||||||||||||||||||||||
| 104 | int maxv = maxval; | - | ||||||||||||||||||||||||
| 105 | rest += remainder; | - | ||||||||||||||||||||||||
| 106 | if (rest >= items
| 0 | ||||||||||||||||||||||||
| 107 | maxv--; | - | ||||||||||||||||||||||||
| 108 | rest-=items; | - | ||||||||||||||||||||||||
| 109 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 110 | QLayoutStruct *data = &chain[i]; | - | ||||||||||||||||||||||||
| 111 | data->size = qMin(data->minimumSize, maxv); | - | ||||||||||||||||||||||||
| 112 | data->done = true; | - | ||||||||||||||||||||||||
| 113 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 114 | } never executed: else if (space < cHint + sumSpacingend of block
| 0 | ||||||||||||||||||||||||
| 115 | - | |||||||||||||||||||||||||
| 116 | - | |||||||||||||||||||||||||
| 117 | - | |||||||||||||||||||||||||
| 118 | - | |||||||||||||||||||||||||
| 119 | - | |||||||||||||||||||||||||
| 120 | - | |||||||||||||||||||||||||
| 121 | int n = count; | - | ||||||||||||||||||||||||
| 122 | int space_left = space - sumSpacing; | - | ||||||||||||||||||||||||
| 123 | int overdraft = cHint - space_left; | - | ||||||||||||||||||||||||
| 124 | - | |||||||||||||||||||||||||
| 125 | - | |||||||||||||||||||||||||
| 126 | for (i = start; i < start + count
| 0 | ||||||||||||||||||||||||
| 127 | QLayoutStruct *data = &chain[i]; | - | ||||||||||||||||||||||||
| 128 | if (!data->done
| 0 | ||||||||||||||||||||||||
| 129 | && data->minimumSize >= data->smartSizeHint()
| 0 | ||||||||||||||||||||||||
| 130 | data->size = data->smartSizeHint(); | - | ||||||||||||||||||||||||
| 131 | data->done = true; | - | ||||||||||||||||||||||||
| 132 | space_left -= data->smartSizeHint(); | - | ||||||||||||||||||||||||
| 133 | - | |||||||||||||||||||||||||
| 134 | n--; | - | ||||||||||||||||||||||||
| 135 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 136 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 137 | bool finished = n == 0; | - | ||||||||||||||||||||||||
| 138 | while (!finished
| 0 | ||||||||||||||||||||||||
| 139 | finished = true; | - | ||||||||||||||||||||||||
| 140 | Fixed64 fp_over = toFixed(overdraft); | - | ||||||||||||||||||||||||
| 141 | Fixed64 fp_w = 0; | - | ||||||||||||||||||||||||
| 142 | - | |||||||||||||||||||||||||
| 143 | for (i = start; i < start+count
| 0 | ||||||||||||||||||||||||
| 144 | QLayoutStruct *data = &chain[i]; | - | ||||||||||||||||||||||||
| 145 | if (data->done
| 0 | ||||||||||||||||||||||||
| 146 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
| 147 | - | |||||||||||||||||||||||||
| 148 | fp_w += fp_over / n; | - | ||||||||||||||||||||||||
| 149 | - | |||||||||||||||||||||||||
| 150 | - | |||||||||||||||||||||||||
| 151 | int w = fRound(fp_w); | - | ||||||||||||||||||||||||
| 152 | data->size = data->smartSizeHint() - w; | - | ||||||||||||||||||||||||
| 153 | fp_w -= toFixed(w); | - | ||||||||||||||||||||||||
| 154 | if (data->size < data->minimumSize
| 0 | ||||||||||||||||||||||||
| 155 | data->done = true; | - | ||||||||||||||||||||||||
| 156 | data->size = data->minimumSize; | - | ||||||||||||||||||||||||
| 157 | finished = false; | - | ||||||||||||||||||||||||
| 158 | overdraft -= data->smartSizeHint() - data->minimumSize; | - | ||||||||||||||||||||||||
| 159 | - | |||||||||||||||||||||||||
| 160 | n--; | - | ||||||||||||||||||||||||
| 161 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 162 | } | - | ||||||||||||||||||||||||
| 163 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 164 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 165 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 166 | int n = count; | - | ||||||||||||||||||||||||
| 167 | int space_left = space - sumSpacing; | - | ||||||||||||||||||||||||
| 168 | - | |||||||||||||||||||||||||
| 169 | for (i = start; i < start + count
| 0 | ||||||||||||||||||||||||
| 170 | QLayoutStruct *data = &chain[i]; | - | ||||||||||||||||||||||||
| 171 | if (!data->done
| 0 | ||||||||||||||||||||||||
| 172 | && (data->maximumSize <= data->smartSizeHint()
| 0 | ||||||||||||||||||||||||
| 173 | || (!allEmptyNonstretch
| 0 | ||||||||||||||||||||||||
| 174 | !data->expansive
| 0 | ||||||||||||||||||||||||
| 175 | data->size = data->smartSizeHint(); | - | ||||||||||||||||||||||||
| 176 | data->done = true; | - | ||||||||||||||||||||||||
| 177 | space_left -= data->size; | - | ||||||||||||||||||||||||
| 178 | sumStretch -= data->stretch; | - | ||||||||||||||||||||||||
| 179 | if (data->expansive
| 0 | ||||||||||||||||||||||||
| 180 | expandingCount--; never executed: expandingCount--; | 0 | ||||||||||||||||||||||||
| 181 | n--; | - | ||||||||||||||||||||||||
| 182 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 183 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 184 | extraspace = space_left; | - | ||||||||||||||||||||||||
| 185 | int surplus, deficit; | - | ||||||||||||||||||||||||
| 186 | do { | - | ||||||||||||||||||||||||
| 187 | surplus = deficit = 0; | - | ||||||||||||||||||||||||
| 188 | Fixed64 fp_space = toFixed(space_left); | - | ||||||||||||||||||||||||
| 189 | Fixed64 fp_w = 0; | - | ||||||||||||||||||||||||
| 190 | for (i = start; i < start + count
| 0 | ||||||||||||||||||||||||
| 191 | QLayoutStruct *data = &chain[i]; | - | ||||||||||||||||||||||||
| 192 | if (data->done
| 0 | ||||||||||||||||||||||||
| 193 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
| 194 | extraspace = 0; | - | ||||||||||||||||||||||||
| 195 | if (sumStretch > 0
| 0 | ||||||||||||||||||||||||
| 196 | fp_w += (fp_space * data->stretch) / sumStretch; | - | ||||||||||||||||||||||||
| 197 | } never executed: else if (expandingCount > 0end of block
| 0 | ||||||||||||||||||||||||
| 198 | fp_w += (fp_space * (data->expansive ? 1 : 0)) / expandingCount; | - | ||||||||||||||||||||||||
| 199 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 200 | fp_w += fp_space * 1 / n; | - | ||||||||||||||||||||||||
| 201 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 202 | int w = fRound(fp_w); | - | ||||||||||||||||||||||||
| 203 | data->size = w; | - | ||||||||||||||||||||||||
| 204 | fp_w -= toFixed(w); | - | ||||||||||||||||||||||||
| 205 | if (w < data->smartSizeHint()
| 0 | ||||||||||||||||||||||||
| 206 | deficit += data->smartSizeHint() - w; | - | ||||||||||||||||||||||||
| 207 | } never executed: else if (w > data->maximumSizeend of block
| 0 | ||||||||||||||||||||||||
| 208 | surplus += w - data->maximumSize; | - | ||||||||||||||||||||||||
| 209 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 210 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 211 | if (deficit > 0
| 0 | ||||||||||||||||||||||||
| 212 | - | |||||||||||||||||||||||||
| 213 | for (i = start; i < start+count
| 0 | ||||||||||||||||||||||||
| 214 | QLayoutStruct *data = &chain[i]; | - | ||||||||||||||||||||||||
| 215 | if (!data->done
| 0 | ||||||||||||||||||||||||
| 216 | data->size = data->smartSizeHint(); | - | ||||||||||||||||||||||||
| 217 | data->done = true; | - | ||||||||||||||||||||||||
| 218 | space_left -= data->smartSizeHint(); | - | ||||||||||||||||||||||||
| 219 | sumStretch -= data->stretch; | - | ||||||||||||||||||||||||
| 220 | if (data->expansive
| 0 | ||||||||||||||||||||||||
| 221 | expandingCount--; never executed: expandingCount--; | 0 | ||||||||||||||||||||||||
| 222 | n--; | - | ||||||||||||||||||||||||
| 223 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 224 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 225 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 226 | if (surplus > 0
| 0 | ||||||||||||||||||||||||
| 227 | - | |||||||||||||||||||||||||
| 228 | for (i = start; i < start + count
| 0 | ||||||||||||||||||||||||
| 229 | QLayoutStruct *data = &chain[i]; | - | ||||||||||||||||||||||||
| 230 | if (!data->done
| 0 | ||||||||||||||||||||||||
| 231 | data->size = data->maximumSize; | - | ||||||||||||||||||||||||
| 232 | data->done = true; | - | ||||||||||||||||||||||||
| 233 | space_left -= data->maximumSize; | - | ||||||||||||||||||||||||
| 234 | sumStretch -= data->stretch; | - | ||||||||||||||||||||||||
| 235 | if (data->expansive
| 0 | ||||||||||||||||||||||||
| 236 | expandingCount--; never executed: expandingCount--; | 0 | ||||||||||||||||||||||||
| 237 | n--; | - | ||||||||||||||||||||||||
| 238 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 239 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 240 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 241 | } never executed: while (n > 0end of block
| 0 | ||||||||||||||||||||||||
| 242 | if (n == 0
| 0 | ||||||||||||||||||||||||
| 243 | extraspace = space_left; never executed: extraspace = space_left; | 0 | ||||||||||||||||||||||||
| 244 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 245 | - | |||||||||||||||||||||||||
| 246 | - | |||||||||||||||||||||||||
| 247 | - | |||||||||||||||||||||||||
| 248 | - | |||||||||||||||||||||||||
| 249 | - | |||||||||||||||||||||||||
| 250 | - | |||||||||||||||||||||||||
| 251 | - | |||||||||||||||||||||||||
| 252 | int extra = extraspace / (spacerCount + 2); | - | ||||||||||||||||||||||||
| 253 | int p = pos + extra; | - | ||||||||||||||||||||||||
| 254 | for (i = start; i < start+count
| 0 | ||||||||||||||||||||||||
| 255 | QLayoutStruct *data = &chain[i]; | - | ||||||||||||||||||||||||
| 256 | data->pos = p; | - | ||||||||||||||||||||||||
| 257 | p += data->size; | - | ||||||||||||||||||||||||
| 258 | if (!data->empty
| 0 | ||||||||||||||||||||||||
| 259 | p += data->effectiveSpacer(spacer) + extra; never executed: p += data->effectiveSpacer(spacer) + extra; | 0 | ||||||||||||||||||||||||
| 260 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 261 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 262 | - | |||||||||||||||||||||||||
| 263 | __attribute__((visibility("default"))) QSize qSmartMinSize(const QSize &sizeHint, const QSize &minSizeHint, | - | ||||||||||||||||||||||||
| 264 | const QSize &minSize, const QSize &maxSize, | - | ||||||||||||||||||||||||
| 265 | const QSizePolicy &sizePolicy) | - | ||||||||||||||||||||||||
| 266 | { | - | ||||||||||||||||||||||||
| 267 | QSize s(0, 0); | - | ||||||||||||||||||||||||
| 268 | - | |||||||||||||||||||||||||
| 269 | if (sizePolicy.horizontalPolicy() != QSizePolicy::Ignored
| 0 | ||||||||||||||||||||||||
| 270 | if (sizePolicy.horizontalPolicy() & QSizePolicy::ShrinkFlag
| 0 | ||||||||||||||||||||||||
| 271 | s.setWidth(minSizeHint.width()); never executed: s.setWidth(minSizeHint.width()); | 0 | ||||||||||||||||||||||||
| 272 | else | - | ||||||||||||||||||||||||
| 273 | s.setWidth(qMax(sizeHint.width(), minSizeHint.width())); never executed: s.setWidth(qMax(sizeHint.width(), minSizeHint.width())); | 0 | ||||||||||||||||||||||||
| 274 | } | - | ||||||||||||||||||||||||
| 275 | - | |||||||||||||||||||||||||
| 276 | if (sizePolicy.verticalPolicy() != QSizePolicy::Ignored
| 0 | ||||||||||||||||||||||||
| 277 | if (sizePolicy.verticalPolicy() & QSizePolicy::ShrinkFlag
| 0 | ||||||||||||||||||||||||
| 278 | s.setHeight(minSizeHint.height()); | - | ||||||||||||||||||||||||
| 279 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 280 | s.setHeight(qMax(sizeHint.height(), minSizeHint.height())); | - | ||||||||||||||||||||||||
| 281 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 282 | } | - | ||||||||||||||||||||||||
| 283 | - | |||||||||||||||||||||||||
| 284 | s = s.boundedTo(maxSize); | - | ||||||||||||||||||||||||
| 285 | if (minSize.width() > 0
| 0 | ||||||||||||||||||||||||
| 286 | s.setWidth(minSize.width()); never executed: s.setWidth(minSize.width()); | 0 | ||||||||||||||||||||||||
| 287 | if (minSize.height() > 0
| 0 | ||||||||||||||||||||||||
| 288 | s.setHeight(minSize.height()); never executed: s.setHeight(minSize.height()); | 0 | ||||||||||||||||||||||||
| 289 | - | |||||||||||||||||||||||||
| 290 | return never executed: s.expandedTo(QSize(0,0));return s.expandedTo(QSize(0,0));never executed: return s.expandedTo(QSize(0,0)); | 0 | ||||||||||||||||||||||||
| 291 | } | - | ||||||||||||||||||||||||
| 292 | - | |||||||||||||||||||||||||
| 293 | __attribute__((visibility("default"))) QSize qSmartMinSize(const QWidgetItem *i) | - | ||||||||||||||||||||||||
| 294 | { | - | ||||||||||||||||||||||||
| 295 | QWidget *w = const_cast<QWidgetItem *>(i)->widget(); | - | ||||||||||||||||||||||||
| 296 | return never executed: qSmartMinSize(w->sizeHint(), w->minimumSizeHint(),return qSmartMinSize(w->sizeHint(), w->minimumSizeHint(), w->minimumSize(), w->maximumSize(), w->sizePolicy());never executed: return qSmartMinSize(w->sizeHint(), w->minimumSizeHint(), w->minimumSize(), w->maximumSize(), w->sizePolicy()); | 0 | ||||||||||||||||||||||||
| 297 | w->minimumSize(), w->maximumSize(), never executed: return qSmartMinSize(w->sizeHint(), w->minimumSizeHint(), w->minimumSize(), w->maximumSize(), w->sizePolicy()); | 0 | ||||||||||||||||||||||||
| 298 | w->sizePolicy()); never executed: return qSmartMinSize(w->sizeHint(), w->minimumSizeHint(), w->minimumSize(), w->maximumSize(), w->sizePolicy()); | 0 | ||||||||||||||||||||||||
| 299 | } | - | ||||||||||||||||||||||||
| 300 | - | |||||||||||||||||||||||||
| 301 | __attribute__((visibility("default"))) QSize qSmartMinSize(const QWidget *w) | - | ||||||||||||||||||||||||
| 302 | { | - | ||||||||||||||||||||||||
| 303 | return never executed: qSmartMinSize(w->sizeHint(), w->minimumSizeHint(),return qSmartMinSize(w->sizeHint(), w->minimumSizeHint(), w->minimumSize(), w->maximumSize(), w->sizePolicy());never executed: return qSmartMinSize(w->sizeHint(), w->minimumSizeHint(), w->minimumSize(), w->maximumSize(), w->sizePolicy()); | 0 | ||||||||||||||||||||||||
| 304 | w->minimumSize(), w->maximumSize(), never executed: return qSmartMinSize(w->sizeHint(), w->minimumSizeHint(), w->minimumSize(), w->maximumSize(), w->sizePolicy()); | 0 | ||||||||||||||||||||||||
| 305 | w->sizePolicy()); never executed: return qSmartMinSize(w->sizeHint(), w->minimumSizeHint(), w->minimumSize(), w->maximumSize(), w->sizePolicy()); | 0 | ||||||||||||||||||||||||
| 306 | } | - | ||||||||||||||||||||||||
| 307 | - | |||||||||||||||||||||||||
| 308 | __attribute__((visibility("default"))) QSize qSmartMaxSize(const QSize &sizeHint, | - | ||||||||||||||||||||||||
| 309 | const QSize &minSize, const QSize &maxSize, | - | ||||||||||||||||||||||||
| 310 | const QSizePolicy &sizePolicy, Qt::Alignment align) | - | ||||||||||||||||||||||||
| 311 | { | - | ||||||||||||||||||||||||
| 312 | if (align & Qt::AlignHorizontal_Mask
| 0 | ||||||||||||||||||||||||
| 313 | return never executed: QSize(QLAYOUTSIZE_MAX, QLAYOUTSIZE_MAX);return QSize(QLAYOUTSIZE_MAX, QLAYOUTSIZE_MAX);never executed: return QSize(QLAYOUTSIZE_MAX, QLAYOUTSIZE_MAX); | 0 | ||||||||||||||||||||||||
| 314 | QSize s = maxSize; | - | ||||||||||||||||||||||||
| 315 | QSize hint = sizeHint.expandedTo(minSize); | - | ||||||||||||||||||||||||
| 316 | if (s.width() == ((1<<24)-1)
| 0 | ||||||||||||||||||||||||
| 317 | if (!(sizePolicy.horizontalPolicy() & QSizePolicy::GrowFlag)
| 0 | ||||||||||||||||||||||||
| 318 | s.setWidth(hint.width()); never executed: s.setWidth(hint.width()); | 0 | ||||||||||||||||||||||||
| 319 | - | |||||||||||||||||||||||||
| 320 | if (s.height() == ((1<<24)-1)
| 0 | ||||||||||||||||||||||||
| 321 | if (!(sizePolicy.verticalPolicy() & QSizePolicy::GrowFlag)
| 0 | ||||||||||||||||||||||||
| 322 | s.setHeight(hint.height()); never executed: s.setHeight(hint.height()); | 0 | ||||||||||||||||||||||||
| 323 | - | |||||||||||||||||||||||||
| 324 | if (align & Qt::AlignHorizontal_Mask
| 0 | ||||||||||||||||||||||||
| 325 | s.setWidth(QLAYOUTSIZE_MAX); never executed: s.setWidth(QLAYOUTSIZE_MAX); | 0 | ||||||||||||||||||||||||
| 326 | if (align & Qt::AlignVertical_Mask
| 0 | ||||||||||||||||||||||||
| 327 | s.setHeight(QLAYOUTSIZE_MAX); never executed: s.setHeight(QLAYOUTSIZE_MAX); | 0 | ||||||||||||||||||||||||
| 328 | return never executed: s;return s;never executed: return s; | 0 | ||||||||||||||||||||||||
| 329 | } | - | ||||||||||||||||||||||||
| 330 | - | |||||||||||||||||||||||||
| 331 | __attribute__((visibility("default"))) QSize qSmartMaxSize(const QWidgetItem *i, Qt::Alignment align) | - | ||||||||||||||||||||||||
| 332 | { | - | ||||||||||||||||||||||||
| 333 | QWidget *w = const_cast<QWidgetItem*>(i)->widget(); | - | ||||||||||||||||||||||||
| 334 | - | |||||||||||||||||||||||||
| 335 | return never executed: qSmartMaxSize(w->sizeHint().expandedTo(w->minimumSizeHint()), w->minimumSize(), w->maximumSize(),return qSmartMaxSize(w->sizeHint().expandedTo(w->minimumSizeHint()), w->minimumSize(), w->maximumSize(), w->sizePolicy(), align);never executed: return qSmartMaxSize(w->sizeHint().expandedTo(w->minimumSizeHint()), w->minimumSize(), w->maximumSize(), w->sizePolicy(), align); | 0 | ||||||||||||||||||||||||
| 336 | w->sizePolicy(), align); never executed: return qSmartMaxSize(w->sizeHint().expandedTo(w->minimumSizeHint()), w->minimumSize(), w->maximumSize(), w->sizePolicy(), align); | 0 | ||||||||||||||||||||||||
| 337 | } | - | ||||||||||||||||||||||||
| 338 | - | |||||||||||||||||||||||||
| 339 | __attribute__((visibility("default"))) QSize qSmartMaxSize(const QWidget *w, Qt::Alignment align) | - | ||||||||||||||||||||||||
| 340 | { | - | ||||||||||||||||||||||||
| 341 | return never executed: qSmartMaxSize(w->sizeHint().expandedTo(w->minimumSizeHint()), w->minimumSize(), w->maximumSize(),return qSmartMaxSize(w->sizeHint().expandedTo(w->minimumSizeHint()), w->minimumSize(), w->maximumSize(), w->sizePolicy(), align);never executed: return qSmartMaxSize(w->sizeHint().expandedTo(w->minimumSizeHint()), w->minimumSize(), w->maximumSize(), w->sizePolicy(), align); | 0 | ||||||||||||||||||||||||
| 342 | w->sizePolicy(), align); never executed: return qSmartMaxSize(w->sizeHint().expandedTo(w->minimumSizeHint()), w->minimumSize(), w->maximumSize(), w->sizePolicy(), align); | 0 | ||||||||||||||||||||||||
| 343 | } | - | ||||||||||||||||||||||||
| 344 | - | |||||||||||||||||||||||||
| 345 | __attribute__((visibility("default"))) int qSmartSpacing(const QLayout *layout, QStyle::PixelMetric pm) | - | ||||||||||||||||||||||||
| 346 | { | - | ||||||||||||||||||||||||
| 347 | QObject *parent = layout->parent(); | - | ||||||||||||||||||||||||
| 348 | if (!parent
| 0 | ||||||||||||||||||||||||
| 349 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||||||||
| 350 | } else if (parent->isWidgetType()
| 0 | ||||||||||||||||||||||||
| 351 | QWidget *pw = static_cast<QWidget *>(parent); | - | ||||||||||||||||||||||||
| 352 | return never executed: pw->style()->pixelMetric(pm, 0, pw);return pw->style()->pixelMetric(pm, 0, pw);never executed: return pw->style()->pixelMetric(pm, 0, pw); | 0 | ||||||||||||||||||||||||
| 353 | } else { | - | ||||||||||||||||||||||||
| 354 | return never executed: static_cast<QLayout *>(parent)->spacing();return static_cast<QLayout *>(parent)->spacing();never executed: return static_cast<QLayout *>(parent)->spacing(); | 0 | ||||||||||||||||||||||||
| 355 | } | - | ||||||||||||||||||||||||
| 356 | } | - | ||||||||||||||||||||||||
| 357 | - | |||||||||||||||||||||||||
| 358 | - | |||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |