| Line | Source | Count |
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | | - |
| 5 | | - |
| 6 | | - |
| 7 | | - |
| 8 | | - |
| 9 | | - |
| 10 | | - |
| 11 | | - |
| 12 | | - |
| 13 | | - |
| 14 | | - |
| 15 | | - |
| 16 | | - |
| 17 | | - |
| 18 | | - |
| 19 | | - |
| 20 | | - |
| 21 | | - |
| 22 | | - |
| 23 | | - |
| 24 | | - |
| 25 | | - |
| 26 | | - |
| 27 | | - |
| 28 | | - |
| 29 | | - |
| 30 | | - |
| 31 | | - |
| 32 | | - |
| 33 | | - |
| 34 | | - |
| 35 | | - |
| 36 | | - |
| 37 | | - |
| 38 | | - |
| 39 | | - |
| 40 | #include "qgridlayout.h" | - |
| 41 | #include "qapplication.h" | - |
| 42 | #include "qwidget.h" | - |
| 43 | #include "qlist.h" | - |
| 44 | #include "qsizepolicy.h" | - |
| 45 | #include "qvector.h" | - |
| 46 | #include "qvarlengtharray.h" | - |
| 47 | #include "qlayoutengine_p.h" | - |
| 48 | #include "qlayout_p.h" | - |
| 49 | | - |
| 50 | QT_BEGIN_NAMESPACE | - |
| 51 | | - |
| 52 | struct QGridLayoutSizeTriple | - |
| 53 | { | - |
| 54 | QSize minS; | - |
| 55 | QSize hint; | - |
| 56 | QSize maxS; | - |
| 57 | }; | - |
| 58 | | - |
| 59 | | - |
| 60 | | - |
| 61 | | - |
| 62 | | - |
| 63 | | - |
| 64 | | - |
| 65 | class QGridBox | - |
| 66 | { | - |
| 67 | public: | - |
| 68 | QGridBox(QLayoutItem *lit) { item_ = lit; } | - |
| 69 | | - |
| 70 | QGridBox(const QLayout *l, QWidget *wid) { item_ = QLayoutPrivate::createWidgetItem(l, wid); } | - |
| 71 | ~QGridBox() { delete item_; } | - |
| 72 | | - |
| 73 | QSize sizeHint() const { return item_->sizeHint(); } | - |
| 74 | QSize minimumSize() const { return item_->minimumSize(); } | - |
| 75 | QSize maximumSize() const { return item_->maximumSize(); } | - |
| 76 | Qt::Orientations expandingDirections() const { return item_->expandingDirections(); } | - |
| 77 | bool isEmpty() const { return item_->isEmpty(); } | - |
| 78 | | - |
| 79 | bool hasHeightForWidth() const { return item_->hasHeightForWidth(); } | - |
| 80 | int heightForWidth(int w) const { return item_->heightForWidth(w); } | - |
| 81 | | - |
| 82 | void setAlignment(Qt::Alignment a) { item_->setAlignment(a); } | - |
| 83 | void setGeometry(const QRect &r) { item_->setGeometry(r); } | - |
| 84 | Qt::Alignment alignment() const { return item_->alignment(); } | - |
| 85 | QLayoutItem *item() { return item_; } | - |
| 86 | void setItem(QLayoutItem *newitem) { item_ = newitem; } | - |
| 87 | QLayoutItem *takeItem() { QLayoutItem *i = item_; item_ = 0; return i; } | - |
| 88 | | - |
| 89 | int hStretch() { return item_->widget() ? | - |
| 90 | item_->widget()->sizePolicy().horizontalStretch() : 0; } | - |
| 91 | int vStretch() { return item_->widget() ? | - |
| 92 | item_->widget()->sizePolicy().verticalStretch() : 0; } | - |
| 93 | | - |
| 94 | private: | - |
| 95 | friend class QGridLayoutPrivate; | - |
| 96 | friend class QGridLayout; | - |
| 97 | | - |
| 98 | inline int toRow(int rr) const { return torow >= 0 ? torow : rr - 1; } | - |
| 99 | inline int toCol(int cc) const { return tocol >= 0 ? tocol : cc - 1; } | - |
| 100 | | - |
| 101 | QLayoutItem *item_; | - |
| 102 | int row, col; | - |
| 103 | int torow, tocol; | - |
| 104 | }; | - |
| 105 | | - |
| 106 | class QGridLayoutPrivate : public QLayoutPrivate | - |
| 107 | { | - |
| 108 | Q_DECLARE_PUBLIC(QGridLayout) | - |
| 109 | public: | - |
| 110 | QGridLayoutPrivate(); | - |
| 111 | | - |
| 112 | void add(QGridBox*, int row, int col); | - |
| 113 | void add(QGridBox*, int row1, int row2, int col1, int col2); | - |
| 114 | QSize sizeHint(int hSpacing, int vSpacing) const; | - |
| 115 | QSize minimumSize(int hSpacing, int vSpacing) const; | - |
| 116 | QSize maximumSize(int hSpacing, int vSpacing) const; | - |
| 117 | | - |
| 118 | Qt::Orientations expandingDirections(int hSpacing, int vSpacing) const; | - |
| 119 | | - |
| 120 | void distribute(QRect rect, int hSpacing, int vSpacing); | - |
| 121 | inline int numRows() const { return rr; } | - |
| 122 | inline int numCols() const { return cc; } | - |
| 123 | inline void expand(int rows, int cols) | - |
| 124 | { setSize(qMax(rows, rr), qMax(cols, cc)); } | - |
| 125 | inline void setRowStretch(int r, int s) | - |
| 126 | { expand(r + 1, 0); rStretch[r] = s; setDirty(); } | - |
| 127 | inline void setColStretch(int c, int s) | - |
| 128 | { expand(0, c + 1); cStretch[c] = s; setDirty(); } | - |
| 129 | inline int rowStretch(int r) const { return rStretch.at(r); } | - |
| 130 | inline int colStretch(int c) const { return cStretch.at(c); } | - |
| 131 | inline void setRowMinimumHeight(int r, int s) | - |
| 132 | { expand(r + 1, 0); rMinHeights[r] = s; setDirty(); } | - |
| 133 | inline void setColumnMinimumWidth(int c, int s) | - |
| 134 | { expand(0, c + 1); cMinWidths[c] = s; setDirty(); } | - |
| 135 | inline int rowSpacing(int r) const { return rMinHeights.at(r); } | - |
| 136 | inline int colSpacing(int c) const { return cMinWidths.at(c); } | - |
| 137 | | - |
| 138 | inline void setReversed(bool r, bool c) { hReversed = c; vReversed = r; } | - |
| 139 | inline bool horReversed() const { return hReversed; } | - |
| 140 | inline bool verReversed() const { return vReversed; } | - |
| 141 | inline void setDirty() { needRecalc = true; hfw_width = -1; } | - |
| 142 | inline bool isDirty() const { return needRecalc; } | - |
| 143 | bool hasHeightForWidth(int hSpacing, int vSpacing); | - |
| 144 | int heightForWidth(int width, int hSpacing, int vSpacing); | - |
| 145 | int minimumHeightForWidth(int width, int hSpacing, int vSpacing); | - |
| 146 | | - |
| 147 | inline void getNextPos(int &row, int &col) { row = nextR; col = nextC; } | - |
| 148 | inline int count() const { return things.count(); } | - |
| 149 | QRect cellRect(int row, int col) const; | - |
| 150 | | - |
| 151 | inline QLayoutItem *itemAt(int index) const { | - |
| 152 | if (index < things.count()) | - |
| 153 | return things.at(index)->item(); | - |
| 154 | else | - |
| 155 | return 0; | - |
| 156 | } | - |
| 157 | inline QLayoutItem *takeAt(int index) { | - |
| 158 | Q_Q(QGridLayout); | - |
| 159 | if (index < things.count()) { | - |
| 160 | if (QGridBox *b = things.takeAt(index)) { | - |
| 161 | QLayoutItem *item = b->takeItem(); | - |
| 162 | if (QLayout *l = item->layout()) { | - |
| 163 | | - |
| 164 | if (l->parent() == q) | - |
| 165 | l->setParent(0); | - |
| 166 | } | - |
| 167 | delete b; | - |
| 168 | return item; | - |
| 169 | } | - |
| 170 | } | - |
| 171 | return 0; | - |
| 172 | } | - |
| 173 | QLayoutItem* replaceAt(int index, QLayoutItem *newitem) Q_DECL_OVERRIDE | - |
| 174 | { | - |
| 175 | if (!newitem) | - |
| 176 | return 0; | - |
| 177 | QLayoutItem *item = 0; | - |
| 178 | QGridBox *b = things.value(index); | - |
| 179 | if (b) { | - |
| 180 | item = b->takeItem(); | - |
| 181 | b->setItem(newitem); | - |
| 182 | } | - |
| 183 | return item; | - |
| 184 | } | - |
| 185 | | - |
| 186 | void getItemPosition(int index, int *row, int *column, int *rowSpan, int *columnSpan) const { | - |
| 187 | if (index < things.count()) { | - |
| 188 | const QGridBox *b = things.at(index); | - |
| 189 | int toRow = b->toRow(rr); | - |
| 190 | int toCol = b->toCol(cc); | - |
| 191 | *row = b->row; | - |
| 192 | *column = b->col; | - |
| 193 | *rowSpan = toRow - *row + 1; | - |
| 194 | *columnSpan = toCol - *column +1; | - |
| 195 | } | - |
| 196 | } | - |
| 197 | void deleteAll(); | - |
| 198 | | - |
| 199 | private: | - |
| 200 | void setNextPosAfter(int r, int c); | - |
| 201 | void recalcHFW(int w); | - |
| 202 | void addHfwData(QGridBox *box, int width); | - |
| 203 | void init(); | - |
| 204 | QSize findSize(int QLayoutStruct::*, int hSpacing, int vSpacing) const; | - |
| 205 | void addData(QGridBox *b, const QGridLayoutSizeTriple &sizes, bool r, bool c); | - |
| 206 | void setSize(int rows, int cols); | - |
| 207 | void setupSpacings(QVector<QLayoutStruct> &chain, QGridBox *grid[], int fixedSpacing, | - |
| 208 | Qt::Orientation orientation); | - |
| 209 | void setupLayoutData(int hSpacing, int vSpacing); | - |
| 210 | void setupHfwLayoutData(); | - |
| 211 | void effectiveMargins(int *left, int *top, int *right, int *bottom) const; | - |
| 212 | | - |
| 213 | int rr; | - |
| 214 | int cc; | - |
| 215 | QVector<QLayoutStruct> rowData; | - |
| 216 | QVector<QLayoutStruct> colData; | - |
| 217 | QVector<QLayoutStruct> *hfwData; | - |
| 218 | QVector<int> rStretch; | - |
| 219 | QVector<int> cStretch; | - |
| 220 | QVector<int> rMinHeights; | - |
| 221 | QVector<int> cMinWidths; | - |
| 222 | QList<QGridBox *> things; | - |
| 223 | | - |
| 224 | int hfw_width; | - |
| 225 | int hfw_height; | - |
| 226 | int hfw_minheight; | - |
| 227 | int nextR; | - |
| 228 | int nextC; | - |
| 229 | | - |
| 230 | int horizontalSpacing; | - |
| 231 | int verticalSpacing; | - |
| 232 | int leftMargin; | - |
| 233 | int topMargin; | - |
| 234 | int rightMargin; | - |
| 235 | int bottomMargin; | - |
| 236 | | - |
| 237 | uint hReversed : 1; | - |
| 238 | uint vReversed : 1; | - |
| 239 | uint needRecalc : 1; | - |
| 240 | uint has_hfw : 1; | - |
| 241 | uint addVertical : 1; | - |
| 242 | }; | - |
| 243 | | - |
| 244 | void QGridLayoutPrivate::effectiveMargins(int *left, int *top, int *right, int *bottom) const | - |
| 245 | { | - |
| 246 | int l = leftMargin; | - |
| 247 | int t = topMargin; | - |
| 248 | int r = rightMargin; | - |
| 249 | int b = bottomMargin; | - |
| 250 | #ifdef Q_OS_MAC | - |
| 251 | int leftMost = INT_MAX; | - |
| 252 | int topMost = INT_MAX; | - |
| 253 | int rightMost = 0; | - |
| 254 | int bottomMost = 0; | - |
| 255 | | - |
| 256 | QWidget *w = 0; | - |
| 257 | const int n = things.count(); | - |
| 258 | for (int i = 0; i < n; ++i) { | - |
| 259 | QGridBox *box = things.at(i); | - |
| 260 | QLayoutItem *itm = box->item(); | - |
| 261 | w = itm->widget(); | - |
| 262 | if (w) { | - |
| 263 | bool visualHReversed = hReversed != (w->layoutDirection() == Qt::RightToLeft); | - |
| 264 | QRect lir = itm->geometry(); | - |
| 265 | QRect wr = w->geometry(); | - |
| 266 | if (box->col <= leftMost) { | - |
| 267 | if (box->col < leftMost) { | - |
| 268 | | - |
| 269 | leftMost = box->col; | - |
| 270 | if (visualHReversed) | - |
| 271 | r = rightMargin; | - |
| 272 | else | - |
| 273 | l = leftMargin; | - |
| 274 | } | - |
| 275 | if (visualHReversed) { | - |
| 276 | r = qMax(r, wr.right() - lir.right()); | - |
| 277 | } else { | - |
| 278 | l = qMax(l, lir.left() - wr.left()); | - |
| 279 | } | - |
| 280 | } | - |
| 281 | if (box->row <= topMost) { | - |
| 282 | if (box->row < topMost) { | - |
| 283 | | - |
| 284 | topMost = box->row; | - |
| 285 | if (vReversed) | - |
| 286 | b = bottomMargin; | - |
| 287 | else | - |
| 288 | t = topMargin; | - |
| 289 | } | - |
| 290 | if (vReversed) | - |
| 291 | b = qMax(b, wr.bottom() - lir.bottom()); | - |
| 292 | else | - |
| 293 | t = qMax(t, lir.top() - wr.top()); | - |
| 294 | } | - |
| 295 | if (box->toCol(cc) >= rightMost) { | - |
| 296 | if (box->toCol(cc) > rightMost) { | - |
| 297 | | - |
| 298 | rightMost = box->toCol(cc); | - |
| 299 | if (visualHReversed) | - |
| 300 | l = leftMargin; | - |
| 301 | else | - |
| 302 | r = rightMargin; | - |
| 303 | } | - |
| 304 | if (visualHReversed) { | - |
| 305 | l = qMax(l, lir.left() - wr.left()); | - |
| 306 | } else { | - |
| 307 | r = qMax(r, wr.right() - lir.right()); | - |
| 308 | } | - |
| 309 | | - |
| 310 | } | - |
| 311 | if (box->toRow(rr) >= bottomMost) { | - |
| 312 | if (box->toRow(rr) > bottomMost) { | - |
| 313 | | - |
| 314 | bottomMost = box->toRow(rr); | - |
| 315 | if (vReversed) | - |
| 316 | t = topMargin; | - |
| 317 | else | - |
| 318 | b = bottomMargin; | - |
| 319 | } | - |
| 320 | if (vReversed) | - |
| 321 | t = qMax(t, lir.top() - wr.top()); | - |
| 322 | else | - |
| 323 | b = qMax(b, wr.bottom() - lir.bottom()); | - |
| 324 | } | - |
| 325 | } | - |
| 326 | } | - |
| 327 | | - |
| 328 | #endif | - |
| 329 | if (left) | - |
| 330 | *left = l; | - |
| 331 | if (top) | - |
| 332 | *top = t; | - |
| 333 | if (right) | - |
| 334 | *right = r; | - |
| 335 | if (bottom) | - |
| 336 | *bottom = b; | - |
| 337 | } | - |
| 338 | | - |
| 339 | QGridLayoutPrivate::QGridLayoutPrivate() | - |
| 340 | { | - |
| 341 | addVertical = false; | - |
| 342 | setDirty(); | - |
| 343 | rr = cc = 0; | - |
| 344 | nextR = nextC = 0; | - |
| 345 | hfwData = 0; | - |
| 346 | hReversed = false; | - |
| 347 | vReversed = false; | - |
| 348 | horizontalSpacing = -1; | - |
| 349 | verticalSpacing = -1; | - |
| 350 | } | - |
| 351 | | - |
| 352 | #if 0 | - |
| 353 | QGridLayoutPrivate::QGridLayoutPrivate(int nRows, int nCols) | - |
| 354 | : rowData(0), colData(0) | - |
| 355 | { | - |
| 356 | init(); | - |
| 357 | if (nRows < 0) { | - |
| 358 | nRows = 1; | - |
| 359 | addVertical = false; | - |
| 360 | } | - |
| 361 | if (nCols < 0) { | - |
| 362 | nCols = 1; | - |
| 363 | addVertical = true; | - |
| 364 | } | - |
| 365 | setSize(nRows, nCols); | - |
| 366 | } | - |
| 367 | #endif | - |
| 368 | | - |
| 369 | void QGridLayoutPrivate::deleteAll() | - |
| 370 | { | - |
| 371 | while (!things.isEmpty()) | - |
| 372 | delete things.takeFirst(); | - |
| 373 | delete hfwData; | - |
| 374 | } | - |
| 375 | | - |
| 376 | bool QGridLayoutPrivate::hasHeightForWidth(int hSpacing, int vSpacing) | - |
| 377 | { | - |
| 378 | setupLayoutData(hSpacing, vSpacing); | - |
| 379 | return has_hfw; | - |
| 380 | } | - |
| 381 | | - |
| 382 | | - |
| 383 | | - |
| 384 | | - |
| 385 | | - |
| 386 | void QGridLayoutPrivate::recalcHFW(int w) | - |
| 387 | { | - |
| 388 | | - |
| 389 | | - |
| 390 | | - |
| 391 | | - |
| 392 | if (!hfwData) | - |
| 393 | hfwData = new QVector<QLayoutStruct>(rr); | - |
| 394 | setupHfwLayoutData(); | - |
| 395 | QVector<QLayoutStruct> &rData = *hfwData; | - |
| 396 | | - |
| 397 | int h = 0; | - |
| 398 | int mh = 0; | - |
| 399 | for (int r = 0; r < rr; r++) { | - |
| 400 | int spacing = rData.at(r).spacing; | - |
| 401 | h += rData.at(r).sizeHint + spacing; | - |
| 402 | mh += rData.at(r).minimumSize + spacing; | - |
| 403 | } | - |
| 404 | | - |
| 405 | hfw_width = w; | - |
| 406 | hfw_height = qMin(QLAYOUTSIZE_MAX, h); | - |
| 407 | hfw_minheight = qMin(QLAYOUTSIZE_MAX, mh); | - |
| 408 | } | - |
| 409 | | - |
| 410 | int QGridLayoutPrivate::heightForWidth(int w, int hSpacing, int vSpacing) | - |
| 411 | { | - |
| 412 | setupLayoutData(hSpacing, vSpacing); | - |
| 413 | if (!has_hfw) | - |
| 414 | return -1; | - |
| 415 | int left, top, right, bottom; | - |
| 416 | effectiveMargins(&left, &top, &right, &bottom); | - |
| 417 | | - |
| 418 | int hMargins = left + right; | - |
| 419 | if (w - hMargins != hfw_width) { | - |
| 420 | qGeomCalc(colData, 0, cc, 0, w - hMargins); | - |
| 421 | recalcHFW(w - hMargins); | - |
| 422 | } | - |
| 423 | return hfw_height + top + bottom; | - |
| 424 | } | - |
| 425 | | - |
| 426 | int QGridLayoutPrivate::minimumHeightForWidth(int w, int hSpacing, int vSpacing) | - |
| 427 | { | - |
| 428 | (void)heightForWidth(w, hSpacing, vSpacing); | - |
| 429 | if (!has_hfw) | - |
| 430 | return -1; | - |
| 431 | int top, bottom; | - |
| 432 | effectiveMargins(0, &top, 0, &bottom); | - |
| 433 | return hfw_minheight + top + bottom; | - |
| 434 | } | - |
| 435 | | - |
| 436 | QSize QGridLayoutPrivate::findSize(int QLayoutStruct::*size, int hSpacing, int vSpacing) const | - |
| 437 | { | - |
| 438 | QGridLayoutPrivate *that = const_cast<QGridLayoutPrivate*>(this); | - |
| 439 | that->setupLayoutData(hSpacing, vSpacing); | - |
| 440 | | - |
| 441 | int w = 0; | - |
| 442 | int h = 0; | - |
| 443 | | - |
| 444 | for (int r = 0; r < rr; r++) | - |
| 445 | h += rowData.at(r).*size + rowData.at(r).spacing; | - |
| 446 | for (int c = 0; c < cc; c++) | - |
| 447 | w += colData.at(c).*size + colData.at(c).spacing; | - |
| 448 | | - |
| 449 | w = qMin(QLAYOUTSIZE_MAX, w); | - |
| 450 | h = qMin(QLAYOUTSIZE_MAX, h); | - |
| 451 | | - |
| 452 | return QSize(w, h); | - |
| 453 | } | - |
| 454 | | - |
| 455 | Qt::Orientations QGridLayoutPrivate::expandingDirections(int hSpacing, int vSpacing) const | - |
| 456 | { | - |
| 457 | QGridLayoutPrivate *that = const_cast<QGridLayoutPrivate*>(this); | - |
| 458 | that->setupLayoutData(hSpacing, vSpacing); | - |
| 459 | Qt::Orientations ret; | - |
| 460 | | - |
| 461 | for (int r = 0; r < rr; r++) { | - |
| 462 | if (rowData.at(r).expansive) { | - |
| 463 | ret |= Qt::Vertical; | - |
| 464 | break; | - |
| 465 | } | - |
| 466 | } | - |
| 467 | for (int c = 0; c < cc; c++) { | - |
| 468 | if (colData.at(c).expansive) { | - |
| 469 | ret |= Qt::Horizontal; | - |
| 470 | break; | - |
| 471 | } | - |
| 472 | } | - |
| 473 | return ret; | - |
| 474 | } | - |
| 475 | | - |
| 476 | QSize QGridLayoutPrivate::sizeHint(int hSpacing, int vSpacing) const | - |
| 477 | { | - |
| 478 | return findSize(&QLayoutStruct::sizeHint, hSpacing, vSpacing); | - |
| 479 | } | - |
| 480 | | - |
| 481 | QSize QGridLayoutPrivate::maximumSize(int hSpacing, int vSpacing) const | - |
| 482 | { | - |
| 483 | return findSize(&QLayoutStruct::maximumSize, hSpacing, vSpacing); | - |
| 484 | } | - |
| 485 | | - |
| 486 | QSize QGridLayoutPrivate::minimumSize(int hSpacing, int vSpacing) const | - |
| 487 | { | - |
| 488 | return findSize(&QLayoutStruct::minimumSize, hSpacing, vSpacing); | - |
| 489 | } | - |
| 490 | | - |
| 491 | void QGridLayoutPrivate::setSize(int r, int c) | - |
| 492 | { | - |
| 493 | if ((int)rowData.size() < r) { | - |
| 494 | int newR = qMax(r, rr * 2); | - |
| 495 | rowData.resize(newR); | - |
| 496 | rStretch.resize(newR); | - |
| 497 | rMinHeights.resize(newR); | - |
| 498 | for (int i = rr; i < newR; i++) { | - |
| 499 | rowData[i].init(); | - |
| 500 | rowData[i].maximumSize = 0; | - |
| 501 | rowData[i].pos = 0; | - |
| 502 | rowData[i].size = 0; | - |
| 503 | rStretch[i] = 0; | - |
| 504 | rMinHeights[i] = 0; | - |
| 505 | } | - |
| 506 | } | - |
| 507 | if ((int)colData.size() < c) { | - |
| 508 | int newC = qMax(c, cc * 2); | - |
| 509 | colData.resize(newC); | - |
| 510 | cStretch.resize(newC); | - |
| 511 | cMinWidths.resize(newC); | - |
| 512 | for (int i = cc; i < newC; i++) { | - |
| 513 | colData[i].init(); | - |
| 514 | colData[i].maximumSize = 0; | - |
| 515 | colData[i].pos = 0; | - |
| 516 | colData[i].size = 0; | - |
| 517 | cStretch[i] = 0; | - |
| 518 | cMinWidths[i] = 0; | - |
| 519 | } | - |
| 520 | } | - |
| 521 | | - |
| 522 | if (hfwData && (int)hfwData->size() < r) { | - |
| 523 | delete hfwData; | - |
| 524 | hfwData = 0; | - |
| 525 | hfw_width = -1; | - |
| 526 | } | - |
| 527 | rr = r; | - |
| 528 | cc = c; | - |
| 529 | } | - |
| 530 | | - |
| 531 | void QGridLayoutPrivate::setNextPosAfter(int row, int col) | - |
| 532 | { | - |
| 533 | if (addVertical) { | - |
| 534 | if (col > nextC || (col == nextC && row >= nextR)) { | - |
| 535 | nextR = row + 1; | - |
| 536 | nextC = col; | - |
| 537 | if (nextR >= rr) { | - |
| 538 | nextR = 0; | - |
| 539 | nextC++; | - |
| 540 | } | - |
| 541 | } | - |
| 542 | } else { | - |
| 543 | if (row > nextR || (row == nextR && col >= nextC)) { | - |
| 544 | nextR = row; | - |
| 545 | nextC = col + 1; | - |
| 546 | if (nextC >= cc) { | - |
| 547 | nextC = 0; | - |
| 548 | nextR++; | - |
| 549 | } | - |
| 550 | } | - |
| 551 | } | - |
| 552 | } | - |
| 553 | | - |
| 554 | void QGridLayoutPrivate::add(QGridBox *box, int row, int col) | - |
| 555 | { | - |
| 556 | expand(row + 1, col + 1); | - |
| 557 | box->row = box->torow = row; | - |
| 558 | box->col = box->tocol = col; | - |
| 559 | things.append(box); | - |
| 560 | setDirty(); | - |
| 561 | setNextPosAfter(row, col); | - |
| 562 | } | - |
| 563 | | - |
| 564 | void QGridLayoutPrivate::add(QGridBox *box, int row1, int row2, int col1, int col2) | - |
| 565 | { | - |
| 566 | if (Q_UNLIKELY(row2 >= 0 && row2 < row1)))| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 567 | qWarning("QGridLayout: Multi-cell fromRow greater than toRow"); never executed: QMessageLogger(__FILE__, 567, __PRETTY_FUNCTION__).warning("QGridLayout: Multi-cell fromRow greater than toRow"); | 0 |
| 568 | if (Q_UNLIKELY(col2 >= 0 && col2 < col1)))| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 569 | qWarning("QGridLayout: Multi-cell fromCol greater than toCol"); never executed: QMessageLogger(__FILE__, 569, __PRETTY_FUNCTION__).warning("QGridLayout: Multi-cell fromCol greater than toCol"); | 0 |
| 570 | if (row1 == row2 && col1 == col2) {| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 571 | add(box, row1, col1); | - |
| 572 | return; never executed: return; | 0 |
| 573 | } | - |
| 574 | expand(qMax(row1, row2) + 1, qMax(col1, col2) + 1); | - |
| 575 | box->row = row1; | - |
| 576 | box->col = col1; | - |
| 577 | | - |
| 578 | box->torow = row2; | - |
| 579 | box->tocol = col2; | - |
| 580 | | - |
| 581 | things.append(box); | - |
| 582 | setDirty(); | - |
| 583 | if (col2 < 0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 584 | col2 = cc - 1; never executed: col2 = cc - 1; | 0 |
| 585 | | - |
| 586 | setNextPosAfter(row2, col2); | - |
| 587 | } never executed: end of block | 0 |
| 588 | | - |
| 589 | void QGridLayoutPrivate::addData(QGridBox *box, const QGridLayoutSizeTriple &sizes, bool r, bool c) | - |
| 590 | { | - |
| 591 | const QWidget *widget = box->item()->widget(); | - |
| 592 | | - |
| 593 | if (box->isEmpty() && widget) | - |
| 594 | return; | - |
| 595 | | - |
| 596 | if (c) { | - |
| 597 | QLayoutStruct *data = &colData[box->col]; | - |
| 598 | if (!cStretch.at(box->col)) | - |
| 599 | data->stretch = qMax(data->stretch, box->hStretch()); | - |
| 600 | data->sizeHint = qMax(sizes.hint.width(), data->sizeHint); | - |
| 601 | data->minimumSize = qMax(sizes.minS.width(), data->minimumSize); | - |
| 602 | | - |
| 603 | qMaxExpCalc(data->maximumSize, data->expansive, data->empty, sizes.maxS.width(), | - |
| 604 | box->expandingDirections() & Qt::Horizontal, box->isEmpty()); | - |
| 605 | } | - |
| 606 | if (r) { | - |
| 607 | QLayoutStruct *data = &rowData[box->row]; | - |
| 608 | if (!rStretch.at(box->row)) | - |
| 609 | data->stretch = qMax(data->stretch, box->vStretch()); | - |
| 610 | data->sizeHint = qMax(sizes.hint.height(), data->sizeHint); | - |
| 611 | data->minimumSize = qMax(sizes.minS.height(), data->minimumSize); | - |
| 612 | | - |
| 613 | qMaxExpCalc(data->maximumSize, data->expansive, data->empty, sizes.maxS.height(), | - |
| 614 | box->expandingDirections() & Qt::Vertical, box->isEmpty()); | - |
| 615 | } | - |
| 616 | } | - |
| 617 | | - |
| 618 | static void initEmptyMultiBox(QVector<QLayoutStruct> &chain, int start, int end) | - |
| 619 | { | - |
| 620 | for (int i = start; i <= end; i++) { | - |
| 621 | QLayoutStruct *data = &chain[i]; | - |
| 622 | if (data->empty && data->maximumSize == 0) | - |
| 623 | data->maximumSize = QWIDGETSIZE_MAX; | - |
| 624 | data->empty = false; | - |
| 625 | } | - |
| 626 | } | - |
| 627 | | - |
| 628 | static void distributeMultiBox(QVector<QLayoutStruct> &chain, int start, int end, int minSize, | - |
| 629 | int sizeHint, QVector<int> &stretchArray, int stretch) | - |
| 630 | { | - |
| 631 | int i; | - |
| 632 | int w = 0; | - |
| 633 | int wh = 0; | - |
| 634 | int max = 0; | - |
| 635 | | - |
| 636 | for (i = start; i <= end; i++) { | - |
| 637 | QLayoutStruct *data = &chain[i]; | - |
| 638 | w += data->minimumSize; | - |
| 639 | wh += data->sizeHint; | - |
| 640 | max += data->maximumSize; | - |
| 641 | if (stretchArray.at(i) == 0) | - |
| 642 | data->stretch = qMax(data->stretch, stretch); | - |
| 643 | | - |
| 644 | if (i != end) { | - |
| 645 | int spacing = data->spacing; | - |
| 646 | w += spacing; | - |
| 647 | wh += spacing; | - |
| 648 | max += spacing; | - |
| 649 | } | - |
| 650 | } | - |
| 651 | | - |
| 652 | if (max < minSize) { | - |
| 653 | | - |
| 654 | | - |
| 655 | | - |
| 656 | | - |
| 657 | | - |
| 658 | | - |
| 659 | | - |
| 660 | qGeomCalc(chain, start, end - start + 1, 0, minSize); | - |
| 661 | int pos = 0; | - |
| 662 | for (i = start; i <= end; i++) { | - |
| 663 | QLayoutStruct *data = &chain[i]; | - |
| 664 | int nextPos = (i == end) ? minSize : chain.at(i + 1).pos; | - |
| 665 | int realSize = nextPos - pos; | - |
| 666 | if (i != end) | - |
| 667 | realSize -= data->spacing; | - |
| 668 | if (data->minimumSize < realSize) | - |
| 669 | data->minimumSize = realSize; | - |
| 670 | if (data->maximumSize < data->minimumSize) | - |
| 671 | data->maximumSize = data->minimumSize; | - |
| 672 | pos = nextPos; | - |
| 673 | } | - |
| 674 | } else if (w < minSize) { | - |
| 675 | qGeomCalc(chain, start, end - start + 1, 0, minSize); | - |
| 676 | for (i = start; i <= end; i++) { | - |
| 677 | QLayoutStruct *data = &chain[i]; | - |
| 678 | if (data->minimumSize < data->size) | - |
| 679 | data->minimumSize = data->size; | - |
| 680 | } | - |
| 681 | } | - |
| 682 | | - |
| 683 | if (wh < sizeHint) { | - |
| 684 | qGeomCalc(chain, start, end - start + 1, 0, sizeHint); | - |
| 685 | for (i = start; i <= end; i++) { | - |
| 686 | QLayoutStruct *data = &chain[i]; | - |
| 687 | if (data->sizeHint < data->size) | - |
| 688 | data->sizeHint = data->size; | - |
| 689 | } | - |
| 690 | } | - |
| 691 | } | - |
| 692 | | - |
| 693 | static QGridBox *&gridAt(QGridBox *grid[], int r, int c, int cc, | - |
| 694 | Qt::Orientation orientation = Qt::Vertical) | - |
| 695 | { | - |
| 696 | if (orientation == Qt::Horizontal) | - |
| 697 | qSwap(r, c); | - |
| 698 | return grid[(r * cc) + c]; | - |
| 699 | } | - |
| 700 | | - |
| 701 | void QGridLayoutPrivate::setupSpacings(QVector<QLayoutStruct> &chain, | - |
| 702 | QGridBox *grid[], int fixedSpacing, | - |
| 703 | Qt::Orientation orientation) | - |
| 704 | { | - |
| 705 | Q_Q(QGridLayout); | - |
| 706 | int numRows = rr; | - |
| 707 | int numColumns = cc; | - |
| 708 | | - |
| 709 | if (orientation == Qt::Horizontal) { | - |
| 710 | qSwap(numRows, numColumns); | - |
| 711 | } | - |
| 712 | | - |
| 713 | QStyle *style = 0; | - |
| 714 | if (fixedSpacing < 0) { | - |
| 715 | if (QWidget *parentWidget = q->parentWidget()) | - |
| 716 | style = parentWidget->style(); | - |
| 717 | } | - |
| 718 | | - |
| 719 | for (int c = 0; c < numColumns; ++c) { | - |
| 720 | QGridBox *previousBox = 0; | - |
| 721 | int previousRow = -1; | - |
| 722 | | - |
| 723 | for (int r = 0; r < numRows; ++r) { | - |
| 724 | if (chain.at(r).empty) | - |
| 725 | continue; | - |
| 726 | | - |
| 727 | QGridBox *box = gridAt(grid, r, c, cc, orientation); | - |
| 728 | if (previousRow != -1 && (!box || previousBox != box)) { | - |
| 729 | int spacing = fixedSpacing; | - |
| 730 | if (spacing < 0) { | - |
| 731 | QSizePolicy::ControlTypes controlTypes1 = QSizePolicy::DefaultType; | - |
| 732 | QSizePolicy::ControlTypes controlTypes2 = QSizePolicy::DefaultType; | - |
| 733 | if (previousBox) | - |
| 734 | controlTypes1 = previousBox->item()->controlTypes(); | - |
| 735 | if (box) | - |
| 736 | controlTypes2 = box->item()->controlTypes(); | - |
| 737 | | - |
| 738 | if ((orientation == Qt::Horizontal && hReversed) | - |
| 739 | || (orientation == Qt::Vertical && vReversed)) | - |
| 740 | qSwap(controlTypes1, controlTypes2); | - |
| 741 | | - |
| 742 | if (style) | - |
| 743 | spacing = style->combinedLayoutSpacing(controlTypes1, controlTypes2, | - |
| 744 | orientation, 0, q->parentWidget()); | - |
| 745 | } else { | - |
| 746 | if (orientation == Qt::Vertical) { | - |
| 747 | QGridBox *sibling = vReversed ? previousBox : box; | - |
| 748 | if (sibling) { | - |
| 749 | QWidget *wid = sibling->item()->widget(); | - |
| 750 | if (wid) | - |
| 751 | spacing = qMax(spacing, sibling->item()->geometry().top() - wid->geometry().top() ); | - |
| 752 | } | - |
| 753 | } | - |
| 754 | } | - |
| 755 | | - |
| 756 | if (spacing > chain.at(previousRow).spacing) | - |
| 757 | chain[previousRow].spacing = spacing; | - |
| 758 | } | - |
| 759 | | - |
| 760 | previousBox = box; | - |
| 761 | previousRow = r; | - |
| 762 | } | - |
| 763 | } | - |
| 764 | } | - |
| 765 | | - |
| 766 | | - |
| 767 | | - |
| 768 | void QGridLayoutPrivate::setupLayoutData(int hSpacing, int vSpacing) | - |
| 769 | { | - |
| 770 | Q_Q(QGridLayout); | - |
| 771 | | - |
| 772 | #ifndef QT_LAYOUT_DISABLE_CACHING | - |
| 773 | if (!needRecalc) | - |
| 774 | return; | - |
| 775 | #endif | - |
| 776 | has_hfw = false; | - |
| 777 | int i; | - |
| 778 | | - |
| 779 | for (i = 0; i < rr; i++) { | - |
| 780 | rowData[i].init(rStretch.at(i), rMinHeights.at(i)); | - |
| 781 | rowData[i].maximumSize = rStretch.at(i) ? QLAYOUTSIZE_MAX : rMinHeights.at(i); | - |
| 782 | } | - |
| 783 | for (i = 0; i < cc; i++) { | - |
| 784 | colData[i].init(cStretch.at(i), cMinWidths.at(i)); | - |
| 785 | colData[i].maximumSize = cStretch.at(i) ? QLAYOUTSIZE_MAX : cMinWidths.at(i); | - |
| 786 | } | - |
| 787 | | - |
| 788 | int n = things.size(); | - |
| 789 | QVarLengthArray<QGridLayoutSizeTriple> sizes(n); | - |
| 790 | | - |
| 791 | bool has_multi = false; | - |
| 792 | | - |
| 793 | | - |
| 794 | | - |
| 795 | | - |
| 796 | | - |
| 797 | QVarLengthArray<QGridBox *> grid(rr * cc); | - |
| 798 | memset(grid.data(), 0, rr * cc * sizeof(QGridBox *)); | - |
| 799 | | - |
| 800 | | - |
| 801 | | - |
| 802 | | - |
| 803 | | - |
| 804 | for (i = 0; i < n; ++i) { | - |
| 805 | QGridBox * const box = things.at(i); | - |
| 806 | sizes[i].minS = box->minimumSize(); | - |
| 807 | sizes[i].hint = box->sizeHint(); | - |
| 808 | sizes[i].maxS = box->maximumSize(); | - |
| 809 | | - |
| 810 | if (box->hasHeightForWidth()) | - |
| 811 | has_hfw = true; | - |
| 812 | | - |
| 813 | if (box->row == box->toRow(rr)) { | - |
| 814 | addData(box, sizes[i], true, false); | - |
| 815 | } else { | - |
| 816 | initEmptyMultiBox(rowData, box->row, box->toRow(rr)); | - |
| 817 | has_multi = true; | - |
| 818 | } | - |
| 819 | | - |
| 820 | if (box->col == box->toCol(cc)) { | - |
| 821 | addData(box, sizes[i], false, true); | - |
| 822 | } else { | - |
| 823 | initEmptyMultiBox(colData, box->col, box->toCol(cc)); | - |
| 824 | has_multi = true; | - |
| 825 | } | - |
| 826 | | - |
| 827 | for (int r = box->row; r <= box->toRow(rr); ++r) { | - |
| 828 | for (int c = box->col; c <= box->toCol(cc); ++c) { | - |
| 829 | gridAt(grid.data(), r, c, cc) = box; | - |
| 830 | } | - |
| 831 | } | - |
| 832 | } | - |
| 833 | | - |
| 834 | setupSpacings(colData, grid.data(), hSpacing, Qt::Horizontal); | - |
| 835 | setupSpacings(rowData, grid.data(), vSpacing, Qt::Vertical); | - |
| 836 | | - |
| 837 | | - |
| 838 | | - |
| 839 | | - |
| 840 | | - |
| 841 | | - |
| 842 | if (has_multi) { | - |
| 843 | for (i = 0; i < n; ++i) { | - |
| 844 | QGridBox * const box = things.at(i); | - |
| 845 | | - |
| 846 | if (box->row != box->toRow(rr)) | - |
| 847 | distributeMultiBox(rowData, box->row, box->toRow(rr), sizes[i].minS.height(), | - |
| 848 | sizes[i].hint.height(), rStretch, box->vStretch()); | - |
| 849 | if (box->col != box->toCol(cc)) | - |
| 850 | distributeMultiBox(colData, box->col, box->toCol(cc), sizes[i].minS.width(), | - |
| 851 | sizes[i].hint.width(), cStretch, box->hStretch()); | - |
| 852 | } | - |
| 853 | } | - |
| 854 | | - |
| 855 | for (i = 0; i < rr; i++) | - |
| 856 | rowData[i].expansive = rowData.at(i).expansive || rowData.at(i).stretch > 0; | - |
| 857 | for (i = 0; i < cc; i++) | - |
| 858 | colData[i].expansive = colData.at(i).expansive || colData.at(i).stretch > 0; | - |
| 859 | | - |
| 860 | q->getContentsMargins(&leftMargin, &topMargin, &rightMargin, &bottomMargin); | - |
| 861 | | - |
| 862 | needRecalc = false; | - |
| 863 | } | - |
| 864 | | - |
| 865 | void QGridLayoutPrivate::addHfwData(QGridBox *box, int width) | - |
| 866 | { | - |
| 867 | QVector<QLayoutStruct> &rData = *hfwData; | - |
| 868 | if (box->hasHeightForWidth()) { | - |
| 869 | int hint = box->heightForWidth(width); | - |
| 870 | rData[box->row].sizeHint = qMax(hint, rData.at(box->row).sizeHint); | - |
| 871 | rData[box->row].minimumSize = qMax(hint, rData.at(box->row).minimumSize); | - |
| 872 | } else { | - |
| 873 | QSize hint = box->sizeHint(); | - |
| 874 | QSize minS = box->minimumSize(); | - |
| 875 | rData[box->row].sizeHint = qMax(hint.height(), rData.at(box->row).sizeHint); | - |
| 876 | rData[box->row].minimumSize = qMax(minS.height(), rData.at(box->row).minimumSize); | - |
| 877 | } | - |
| 878 | } | - |
| 879 | | - |
| 880 | | - |
| 881 | | - |
| 882 | | - |
| 883 | | - |
| 884 | | - |
| 885 | void QGridLayoutPrivate::setupHfwLayoutData() | - |
| 886 | { | - |
| 887 | QVector<QLayoutStruct> &rData = *hfwData; | - |
| 888 | for (int i = 0; i < rr; i++) { | - |
| 889 | rData[i] = rowData.at(i); | - |
| 890 | rData[i].minimumSize = rData[i].sizeHint = rMinHeights.at(i); | - |
| 891 | } | - |
| 892 | | - |
| 893 | for (int pass = 0; pass < 2; ++pass) { | - |
| 894 | for (int i = 0; i < things.size(); ++i) { | - |
| 895 | QGridBox *box = things.at(i); | - |
| 896 | int r1 = box->row; | - |
| 897 | int c1 = box->col; | - |
| 898 | int r2 = box->toRow(rr); | - |
| 899 | int c2 = box->toCol(cc); | - |
| 900 | int w = colData.at(c2).pos + colData.at(c2).size - colData.at(c1).pos; | - |
| 901 | | - |
| 902 | if (r1 == r2) { | - |
| 903 | if (pass == 0) | - |
| 904 | addHfwData(box, w); | - |
| 905 | } else { | - |
| 906 | if (pass == 0) { | - |
| 907 | initEmptyMultiBox(rData, r1, r2); | - |
| 908 | } else { | - |
| 909 | QSize hint = box->sizeHint(); | - |
| 910 | QSize min = box->minimumSize(); | - |
| 911 | if (box->hasHeightForWidth()) { | - |
| 912 | int hfwh = box->heightForWidth(w); | - |
| 913 | if (hfwh > hint.height()) | - |
| 914 | hint.setHeight(hfwh); | - |
| 915 | if (hfwh > min.height()) | - |
| 916 | min.setHeight(hfwh); | - |
| 917 | } | - |
| 918 | distributeMultiBox(rData, r1, r2, min.height(), hint.height(), | - |
| 919 | rStretch, box->vStretch()); | - |
| 920 | } | - |
| 921 | } | - |
| 922 | } | - |
| 923 | } | - |
| 924 | for (int i = 0; i < rr; i++) | - |
| 925 | rData[i].expansive = rData.at(i).expansive || rData.at(i).stretch > 0; | - |
| 926 | } | - |
| 927 | | - |
| 928 | void QGridLayoutPrivate::distribute(QRect r, int hSpacing, int vSpacing) | - |
| 929 | { | - |
| 930 | Q_Q(QGridLayout); | - |
| 931 | bool visualHReversed = hReversed; | - |
| 932 | QWidget *parent = q->parentWidget(); | - |
| 933 | if (parent && parent->isRightToLeft()) | - |
| 934 | visualHReversed = !visualHReversed; | - |
| 935 | | - |
| 936 | setupLayoutData(hSpacing, vSpacing); | - |
| 937 | | - |
| 938 | int left, top, right, bottom; | - |
| 939 | effectiveMargins(&left, &top, &right, &bottom); | - |
| 940 | r.adjust(+left, +top, -right, -bottom); | - |
| 941 | | - |
| 942 | qGeomCalc(colData, 0, cc, r.x(), r.width()); | - |
| 943 | QVector<QLayoutStruct> *rDataPtr; | - |
| 944 | if (has_hfw) { | - |
| 945 | recalcHFW(r.width()); | - |
| 946 | qGeomCalc(*hfwData, 0, rr, r.y(), r.height()); | - |
| 947 | rDataPtr = hfwData; | - |
| 948 | } else { | - |
| 949 | qGeomCalc(rowData, 0, rr, r.y(), r.height()); | - |
| 950 | rDataPtr = &rowData; | - |
| 951 | } | - |
| 952 | QVector<QLayoutStruct> &rData = *rDataPtr; | - |
| 953 | int i; | - |
| 954 | | - |
| 955 | bool reverse = ((r.bottom() > rect.bottom()) || (r.bottom() == rect.bottom() | - |
| 956 | && ((r.right() > rect.right()) != visualHReversed))); | - |
| 957 | int n = things.size(); | - |
| 958 | for (i = 0; i < n; ++i) { | - |
| 959 | QGridBox *box = things.at(reverse ? n-i-1 : i); | - |
| 960 | int r2 = box->toRow(rr); | - |
| 961 | int c2 = box->toCol(cc); | - |
| 962 | | - |
| 963 | int x = colData.at(box->col).pos; | - |
| 964 | int y = rData.at(box->row).pos; | - |
| 965 | int x2p = colData.at(c2).pos + colData.at(c2).size; | - |
| 966 | int y2p = rData.at(r2).pos + rData.at(r2).size; | - |
| 967 | int w = x2p - x; | - |
| 968 | int h = y2p - y; | - |
| 969 | | - |
| 970 | if (visualHReversed) | - |
| 971 | x = r.left() + r.right() - x - w + 1; | - |
| 972 | if (vReversed) | - |
| 973 | y = r.top() + r.bottom() - y - h + 1; | - |
| 974 | | - |
| 975 | box->setGeometry(QRect(x, y, w, h)); | - |
| 976 | } | - |
| 977 | } | - |
| 978 | | - |
| 979 | QRect QGridLayoutPrivate::cellRect(int row, int col) const | - |
| 980 | { | - |
| 981 | if (row < 0 || row >= rr || col < 0 || col >= cc) | - |
| 982 | return QRect(); | - |
| 983 | | - |
| 984 | const QVector<QLayoutStruct> *rDataPtr; | - |
| 985 | if (has_hfw && hfwData) | - |
| 986 | rDataPtr = hfwData; | - |
| 987 | else | - |
| 988 | rDataPtr = &rowData; | - |
| 989 | return QRect(colData.at(col).pos, rDataPtr->at(row).pos, | - |
| 990 | colData.at(col).size, rDataPtr->at(row).size); | - |
| 991 | } | - |
| 992 | | - |
| 993 | | - |
| 994 | | - |
| 995 | | - |
| 996 | | - |
| 997 | | - |
| 998 | | - |
| 999 | | - |
| 1000 | | - |
| 1001 | | - |
| 1002 | | - |
| 1003 | | - |
| 1004 | | - |
| 1005 | | - |
| 1006 | | - |
| 1007 | | - |
| 1008 | | - |
| 1009 | | - |
| 1010 | | - |
| 1011 | | - |
| 1012 | | - |
| 1013 | | - |
| 1014 | | - |
| 1015 | | - |
| 1016 | | - |
| 1017 | | - |
| 1018 | | - |
| 1019 | | - |
| 1020 | | - |
| 1021 | | - |
| 1022 | | - |
| 1023 | | - |
| 1024 | | - |
| 1025 | | - |
| 1026 | | - |
| 1027 | | - |
| 1028 | | - |
| 1029 | | - |
| 1030 | | - |
| 1031 | | - |
| 1032 | | - |
| 1033 | | - |
| 1034 | | - |
| 1035 | | - |
| 1036 | | - |
| 1037 | | - |
| 1038 | | - |
| 1039 | | - |
| 1040 | | - |
| 1041 | | - |
| 1042 | | - |
| 1043 | | - |
| 1044 | | - |
| 1045 | | - |
| 1046 | | - |
| 1047 | | - |
| 1048 | | - |
| 1049 | | - |
| 1050 | | - |
| 1051 | | - |
| 1052 | | - |
| 1053 | | - |
| 1054 | | - |
| 1055 | | - |
| 1056 | | - |
| 1057 | | - |
| 1058 | | - |
| 1059 | | - |
| 1060 | | - |
| 1061 | | - |
| 1062 | | - |
| 1063 | | - |
| 1064 | | - |
| 1065 | | - |
| 1066 | | - |
| 1067 | | - |
| 1068 | | - |
| 1069 | | - |
| 1070 | | - |
| 1071 | | - |
| 1072 | | - |
| 1073 | QGridLayout::QGridLayout(QWidget *parent) | - |
| 1074 | : QLayout(*new QGridLayoutPrivate, 0, parent) | - |
| 1075 | { | - |
| 1076 | Q_D(QGridLayout); | - |
| 1077 | d->expand(1, 1); | - |
| 1078 | } | - |
| 1079 | | - |
| 1080 | | - |
| 1081 | | - |
| 1082 | | - |
| 1083 | | - |
| 1084 | | - |
| 1085 | | - |
| 1086 | | - |
| 1087 | QGridLayout::QGridLayout() | - |
| 1088 | : QLayout(*new QGridLayoutPrivate, 0, 0) | - |
| 1089 | { | - |
| 1090 | Q_D(QGridLayout); | - |
| 1091 | d->expand(1, 1); | - |
| 1092 | } | - |
| 1093 | | - |
| 1094 | | - |
| 1095 | | - |
| 1096 | | - |
| 1097 | | - |
| 1098 | | - |
| 1099 | | - |
| 1100 | | - |
| 1101 | | - |
| 1102 | | - |
| 1103 | | - |
| 1104 | | - |
| 1105 | | - |
| 1106 | void QGridLayout::setDefaultPositioning(int n, Qt::Orientation orient) | - |
| 1107 | { | - |
| 1108 | Q_D(QGridLayout); | - |
| 1109 | if (orient == Qt::Horizontal) { | - |
| 1110 | d->expand(1, n); | - |
| 1111 | d->addVertical = false; | - |
| 1112 | } else { | - |
| 1113 | d->expand(n,1); | - |
| 1114 | d->addVertical = true; | - |
| 1115 | } | - |
| 1116 | } | - |
| 1117 | | - |
| 1118 | | - |
| 1119 | | - |
| 1120 | | - |
| 1121 | | - |
| 1122 | | - |
| 1123 | | - |
| 1124 | | - |
| 1125 | QGridLayout::~QGridLayout() | - |
| 1126 | { | - |
| 1127 | Q_D(QGridLayout); | - |
| 1128 | d->deleteAll(); | - |
| 1129 | } | - |
| 1130 | | - |
| 1131 | | - |
| 1132 | | - |
| 1133 | | - |
| 1134 | | - |
| 1135 | | - |
| 1136 | | - |
| 1137 | | - |
| 1138 | | - |
| 1139 | | - |
| 1140 | | - |
| 1141 | | - |
| 1142 | void QGridLayout::setHorizontalSpacing(int spacing) | - |
| 1143 | { | - |
| 1144 | Q_D(QGridLayout); | - |
| 1145 | d->horizontalSpacing = spacing; | - |
| 1146 | invalidate(); | - |
| 1147 | } | - |
| 1148 | | - |
| 1149 | int QGridLayout::horizontalSpacing() const | - |
| 1150 | { | - |
| 1151 | Q_D(const QGridLayout); | - |
| 1152 | if (d->horizontalSpacing >= 0) { | - |
| 1153 | return d->horizontalSpacing; | - |
| 1154 | } else { | - |
| 1155 | return qSmartSpacing(this, QStyle::PM_LayoutHorizontalSpacing); | - |
| 1156 | } | - |
| 1157 | } | - |
| 1158 | | - |
| 1159 | | - |
| 1160 | | - |
| 1161 | | - |
| 1162 | | - |
| 1163 | | - |
| 1164 | | - |
| 1165 | | - |
| 1166 | | - |
| 1167 | | - |
| 1168 | | - |
| 1169 | | - |
| 1170 | void QGridLayout::setVerticalSpacing(int spacing) | - |
| 1171 | { | - |
| 1172 | Q_D(QGridLayout); | - |
| 1173 | d->verticalSpacing = spacing; | - |
| 1174 | invalidate(); | - |
| 1175 | } | - |
| 1176 | | - |
| 1177 | int QGridLayout::verticalSpacing() const | - |
| 1178 | { | - |
| 1179 | Q_D(const QGridLayout); | - |
| 1180 | if (d->verticalSpacing >= 0) { | - |
| 1181 | return d->verticalSpacing; | - |
| 1182 | } else { | - |
| 1183 | return qSmartSpacing(this, QStyle::PM_LayoutVerticalSpacing); | - |
| 1184 | } | - |
| 1185 | } | - |
| 1186 | | - |
| 1187 | | - |
| 1188 | | - |
| 1189 | | - |
| 1190 | | - |
| 1191 | | - |
| 1192 | | - |
| 1193 | void QGridLayout::setSpacing(int spacing) | - |
| 1194 | { | - |
| 1195 | Q_D(QGridLayout); | - |
| 1196 | d->horizontalSpacing = d->verticalSpacing = spacing; | - |
| 1197 | invalidate(); | - |
| 1198 | } | - |
| 1199 | | - |
| 1200 | | - |
| 1201 | | - |
| 1202 | | - |
| 1203 | | - |
| 1204 | | - |
| 1205 | | - |
| 1206 | int QGridLayout::spacing() const | - |
| 1207 | { | - |
| 1208 | int hSpacing = horizontalSpacing(); | - |
| 1209 | if (hSpacing == verticalSpacing()) { | - |
| 1210 | return hSpacing; | - |
| 1211 | } else { | - |
| 1212 | return -1; | - |
| 1213 | } | - |
| 1214 | } | - |
| 1215 | | - |
| 1216 | | - |
| 1217 | | - |
| 1218 | | - |
| 1219 | int QGridLayout::rowCount() const | - |
| 1220 | { | - |
| 1221 | Q_D(const QGridLayout); | - |
| 1222 | return d->numRows(); | - |
| 1223 | } | - |
| 1224 | | - |
| 1225 | | - |
| 1226 | | - |
| 1227 | | - |
| 1228 | int QGridLayout::columnCount() const | - |
| 1229 | { | - |
| 1230 | Q_D(const QGridLayout); | - |
| 1231 | return d->numCols(); | - |
| 1232 | } | - |
| 1233 | | - |
| 1234 | | - |
| 1235 | | - |
| 1236 | | - |
| 1237 | QSize QGridLayout::sizeHint() const | - |
| 1238 | { | - |
| 1239 | Q_D(const QGridLayout); | - |
| 1240 | QSize result(d->sizeHint(horizontalSpacing(), verticalSpacing())); | - |
| 1241 | int left, top, right, bottom; | - |
| 1242 | d->effectiveMargins(&left, &top, &right, &bottom); | - |
| 1243 | result += QSize(left + right, top + bottom); | - |
| 1244 | return result; | - |
| 1245 | } | - |
| 1246 | | - |
| 1247 | | - |
| 1248 | | - |
| 1249 | | - |
| 1250 | QSize QGridLayout::minimumSize() const | - |
| 1251 | { | - |
| 1252 | Q_D(const QGridLayout); | - |
| 1253 | QSize result(d->minimumSize(horizontalSpacing(), verticalSpacing())); | - |
| 1254 | int left, top, right, bottom; | - |
| 1255 | d->effectiveMargins(&left, &top, &right, &bottom); | - |
| 1256 | result += QSize(left + right, top + bottom); | - |
| 1257 | return result; | - |
| 1258 | } | - |
| 1259 | | - |
| 1260 | | - |
| 1261 | | - |
| 1262 | | - |
| 1263 | QSize QGridLayout::maximumSize() const | - |
| 1264 | { | - |
| 1265 | Q_D(const QGridLayout); | - |
| 1266 | | - |
| 1267 | QSize s = d->maximumSize(horizontalSpacing(), verticalSpacing()); | - |
| 1268 | int left, top, right, bottom; | - |
| 1269 | d->effectiveMargins(&left, &top, &right, &bottom); | - |
| 1270 | s += QSize(left + right, top + bottom); | - |
| 1271 | s = s.boundedTo(QSize(QLAYOUTSIZE_MAX, QLAYOUTSIZE_MAX)); | - |
| 1272 | if (alignment() & Qt::AlignHorizontal_Mask) | - |
| 1273 | s.setWidth(QLAYOUTSIZE_MAX); | - |
| 1274 | if (alignment() & Qt::AlignVertical_Mask) | - |
| 1275 | s.setHeight(QLAYOUTSIZE_MAX); | - |
| 1276 | return s; | - |
| 1277 | } | - |
| 1278 | | - |
| 1279 | | - |
| 1280 | | - |
| 1281 | | - |
| 1282 | bool QGridLayout::hasHeightForWidth() const | - |
| 1283 | { | - |
| 1284 | return const_cast<QGridLayout*>(this)->d_func()->hasHeightForWidth(horizontalSpacing(), verticalSpacing()); | - |
| 1285 | } | - |
| 1286 | | - |
| 1287 | | - |
| 1288 | | - |
| 1289 | | - |
| 1290 | int QGridLayout::heightForWidth(int w) const | - |
| 1291 | { | - |
| 1292 | Q_D(const QGridLayout); | - |
| 1293 | QGridLayoutPrivate *dat = const_cast<QGridLayoutPrivate *>(d); | - |
| 1294 | return dat->heightForWidth(w, horizontalSpacing(), verticalSpacing()); | - |
| 1295 | } | - |
| 1296 | | - |
| 1297 | | - |
| 1298 | | - |
| 1299 | | - |
| 1300 | int QGridLayout::minimumHeightForWidth(int w) const | - |
| 1301 | { | - |
| 1302 | Q_D(const QGridLayout); | - |
| 1303 | QGridLayoutPrivate *dat = const_cast<QGridLayoutPrivate *>(d); | - |
| 1304 | return dat->minimumHeightForWidth(w, horizontalSpacing(), verticalSpacing()); | - |
| 1305 | } | - |
| 1306 | | - |
| 1307 | | - |
| 1308 | | - |
| 1309 | | - |
| 1310 | int QGridLayout::count() const | - |
| 1311 | { | - |
| 1312 | Q_D(const QGridLayout); | - |
| 1313 | return d->count(); | - |
| 1314 | } | - |
| 1315 | | - |
| 1316 | | - |
| 1317 | | - |
| 1318 | | - |
| 1319 | | - |
| 1320 | QLayoutItem *QGridLayout::itemAt(int index) const | - |
| 1321 | { | - |
| 1322 | Q_D(const QGridLayout); | - |
| 1323 | return d->itemAt(index); | - |
| 1324 | } | - |
| 1325 | | - |
| 1326 | | - |
| 1327 | | - |
| 1328 | | - |
| 1329 | | - |
| 1330 | | - |
| 1331 | | - |
| 1332 | | - |
| 1333 | | - |
| 1334 | QLayoutItem *QGridLayout::itemAtPosition(int row, int column) const | - |
| 1335 | { | - |
| 1336 | Q_D(const QGridLayout); | - |
| 1337 | int n = d->things.count(); | - |
| 1338 | for (int i = 0; i < n; ++i) { | - |
| 1339 | QGridBox *box = d->things.at(i); | - |
| 1340 | if (row >= box->row && row <= box->toRow(d->rr) | - |
| 1341 | && column >= box->col && column <= box->toCol(d->cc)) { | - |
| 1342 | return box->item(); | - |
| 1343 | } | - |
| 1344 | } | - |
| 1345 | return 0; | - |
| 1346 | } | - |
| 1347 | | - |
| 1348 | | - |
| 1349 | | - |
| 1350 | | - |
| 1351 | QLayoutItem *QGridLayout::takeAt(int index) | - |
| 1352 | { | - |
| 1353 | Q_D(QGridLayout); | - |
| 1354 | return d->takeAt(index); | - |
| 1355 | } | - |
| 1356 | | - |
| 1357 | | - |
| 1358 | | - |
| 1359 | | - |
| 1360 | | - |
| 1361 | | - |
| 1362 | | - |
| 1363 | | - |
| 1364 | | - |
| 1365 | | - |
| 1366 | void QGridLayout::getItemPosition(int index, int *row, int *column, int *rowSpan, int *columnSpan) const | - |
| 1367 | { | - |
| 1368 | Q_D(const QGridLayout); | - |
| 1369 | d->getItemPosition(index, row, column, rowSpan, columnSpan); | - |
| 1370 | } | - |
| 1371 | | - |
| 1372 | | - |
| 1373 | | - |
| 1374 | | - |
| 1375 | | - |
| 1376 | void QGridLayout::setGeometry(const QRect &rect) | - |
| 1377 | { | - |
| 1378 | Q_D(QGridLayout); | - |
| 1379 | if (d->isDirty() || rect != geometry()) { | - |
| 1380 | QRect cr = alignment() ? alignmentRect(rect) : rect; | - |
| 1381 | d->distribute(cr, horizontalSpacing(), verticalSpacing()); | - |
| 1382 | QLayout::setGeometry(rect); | - |
| 1383 | } | - |
| 1384 | } | - |
| 1385 | | - |
| 1386 | | - |
| 1387 | | - |
| 1388 | | - |
| 1389 | | - |
| 1390 | | - |
| 1391 | | - |
| 1392 | | - |
| 1393 | | - |
| 1394 | | - |
| 1395 | QRect QGridLayout::cellRect(int row, int column) const | - |
| 1396 | { | - |
| 1397 | Q_D(const QGridLayout); | - |
| 1398 | return d->cellRect(row, column); | - |
| 1399 | } | - |
| 1400 | | - |
| 1401 | | - |
| 1402 | | - |
| 1403 | | - |
| 1404 | void QGridLayout::addItem(QLayoutItem *item) | - |
| 1405 | { | - |
| 1406 | Q_D(QGridLayout); | - |
| 1407 | int r, c; | - |
| 1408 | d->getNextPos(r, c); | - |
| 1409 | addItem(item, r, c); | - |
| 1410 | } | - |
| 1411 | | - |
| 1412 | | - |
| 1413 | | - |
| 1414 | | - |
| 1415 | | - |
| 1416 | | - |
| 1417 | | - |
| 1418 | | - |
| 1419 | | - |
| 1420 | | - |
| 1421 | | - |
| 1422 | void QGridLayout::addItem(QLayoutItem *item, int row, int column, int rowSpan, int columnSpan, Qt::Alignment alignment) | - |
| 1423 | { | - |
| 1424 | Q_D(QGridLayout); | - |
| 1425 | QGridBox *b = new QGridBox(item); | - |
| 1426 | b->setAlignment(alignment); | - |
| 1427 | d->add(b, row, (rowSpan < 0) ? -1 : row + rowSpan - 1, column, (columnSpan < 0) ? -1 : column + columnSpan - 1); | - |
| 1428 | invalidate(); | - |
| 1429 | } | - |
| 1430 | | - |
| 1431 | | - |
| 1432 | | - |
| 1433 | | - |
| 1434 | | - |
| 1435 | | - |
| 1436 | | - |
| 1437 | | - |
| 1438 | | - |
| 1439 | void QGridLayout::addWidget(QWidget *widget, int row, int column, Qt::Alignment alignment) | - |
| 1440 | { | - |
| 1441 | Q_D(QGridLayout); | - |
| 1442 | if (!d->checkWidget(widget))| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1443 | return; never executed: return; | 0 |
| 1444 | if (Q_UNLIKELY(row < 0 || column < 0))) {| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1445 | qWarning("QGridLayout: Cannot add %s/%s to %s/%s at row %d column %d", | - |
| 1446 | widget->metaObject()->className(), widget->objectName().toLocal8Bit().data(), | - |
| 1447 | metaObject()->className(), objectName().toLocal8Bit().data(), row, column); | - |
| 1448 | return; never executed: return; | 0 |
| 1449 | } | - |
| 1450 | addChildWidget(widget); | - |
| 1451 | QWidgetItem *b = QLayoutPrivate::createWidgetItem(this, widget); | - |
| 1452 | addItem(b, row, column, 1, 1, alignment); | - |
| 1453 | } never executed: end of block | 0 |
| 1454 | | - |
| 1455 | | - |
| 1456 | | - |
| 1457 | | - |
| 1458 | | - |
| 1459 | | - |
| 1460 | | - |
| 1461 | | - |
| 1462 | | - |
| 1463 | | - |
| 1464 | | - |
| 1465 | | - |
| 1466 | | - |
| 1467 | void QGridLayout::addWidget(QWidget *widget, int fromRow, int fromColumn, | - |
| 1468 | int rowSpan, int columnSpan, Qt::Alignment alignment) | - |
| 1469 | { | - |
| 1470 | Q_D(QGridLayout); | - |
| 1471 | if (!d->checkWidget(widget)) | - |
| 1472 | return; | - |
| 1473 | int toRow = (rowSpan < 0) ? -1 : fromRow + rowSpan - 1; | - |
| 1474 | int toColumn = (columnSpan < 0) ? -1 : fromColumn + columnSpan - 1; | - |
| 1475 | addChildWidget(widget); | - |
| 1476 | QGridBox *b = new QGridBox(this, widget); | - |
| 1477 | b->setAlignment(alignment); | - |
| 1478 | d->add(b, fromRow, toRow, fromColumn, toColumn); | - |
| 1479 | invalidate(); | - |
| 1480 | } | - |
| 1481 | | - |
| 1482 | | - |
| 1483 | | - |
| 1484 | | - |
| 1485 | | - |
| 1486 | | - |
| 1487 | | - |
| 1488 | | - |
| 1489 | | - |
| 1490 | | - |
| 1491 | | - |
| 1492 | | - |
| 1493 | | - |
| 1494 | | - |
| 1495 | | - |
| 1496 | | - |
| 1497 | | - |
| 1498 | | - |
| 1499 | | - |
| 1500 | | - |
| 1501 | | - |
| 1502 | | - |
| 1503 | void QGridLayout::addLayout(QLayout *layout, int row, int column, Qt::Alignment alignment) | - |
| 1504 | { | - |
| 1505 | Q_D(QGridLayout); | - |
| 1506 | if (!d->checkLayout(layout)) | - |
| 1507 | return; | - |
| 1508 | if (!adoptLayout(layout)) | - |
| 1509 | return; | - |
| 1510 | QGridBox *b = new QGridBox(layout); | - |
| 1511 | b->setAlignment(alignment); | - |
| 1512 | d->add(b, row, column); | - |
| 1513 | } | - |
| 1514 | | - |
| 1515 | | - |
| 1516 | | - |
| 1517 | | - |
| 1518 | | - |
| 1519 | | - |
| 1520 | | - |
| 1521 | | - |
| 1522 | | - |
| 1523 | | - |
| 1524 | void QGridLayout::addLayout(QLayout *layout, int row, int column, | - |
| 1525 | int rowSpan, int columnSpan, Qt::Alignment alignment) | - |
| 1526 | { | - |
| 1527 | Q_D(QGridLayout); | - |
| 1528 | if (!d->checkLayout(layout)) | - |
| 1529 | return; | - |
| 1530 | if (!adoptLayout(layout)) | - |
| 1531 | return; | - |
| 1532 | QGridBox *b = new QGridBox(layout); | - |
| 1533 | b->setAlignment(alignment); | - |
| 1534 | d->add(b, row, (rowSpan < 0) ? -1 : row + rowSpan - 1, column, (columnSpan < 0) ? -1 : column + columnSpan - 1); | - |
| 1535 | } | - |
| 1536 | | - |
| 1537 | | - |
| 1538 | | - |
| 1539 | | - |
| 1540 | | - |
| 1541 | | - |
| 1542 | | - |
| 1543 | | - |
| 1544 | | - |
| 1545 | | - |
| 1546 | | - |
| 1547 | | - |
| 1548 | | - |
| 1549 | | - |
| 1550 | void QGridLayout::setRowStretch(int row, int stretch) | - |
| 1551 | { | - |
| 1552 | Q_D(QGridLayout); | - |
| 1553 | d->setRowStretch(row, stretch); | - |
| 1554 | invalidate(); | - |
| 1555 | } | - |
| 1556 | | - |
| 1557 | | - |
| 1558 | | - |
| 1559 | | - |
| 1560 | | - |
| 1561 | | - |
| 1562 | int QGridLayout::rowStretch(int row) const | - |
| 1563 | { | - |
| 1564 | Q_D(const QGridLayout); | - |
| 1565 | return d->rowStretch(row); | - |
| 1566 | } | - |
| 1567 | | - |
| 1568 | | - |
| 1569 | | - |
| 1570 | | - |
| 1571 | | - |
| 1572 | | - |
| 1573 | int QGridLayout::columnStretch(int column) const | - |
| 1574 | { | - |
| 1575 | Q_D(const QGridLayout); | - |
| 1576 | return d->colStretch(column); | - |
| 1577 | } | - |
| 1578 | | - |
| 1579 | | - |
| 1580 | | - |
| 1581 | | - |
| 1582 | | - |
| 1583 | | - |
| 1584 | | - |
| 1585 | | - |
| 1586 | | - |
| 1587 | | - |
| 1588 | | - |
| 1589 | | - |
| 1590 | | - |
| 1591 | | - |
| 1592 | | - |
| 1593 | | - |
| 1594 | | - |
| 1595 | | - |
| 1596 | void QGridLayout::setColumnStretch(int column, int stretch) | - |
| 1597 | { | - |
| 1598 | Q_D(QGridLayout); | - |
| 1599 | d->setColStretch(column, stretch); | - |
| 1600 | invalidate(); | - |
| 1601 | } | - |
| 1602 | | - |
| 1603 | | - |
| 1604 | | - |
| 1605 | | - |
| 1606 | | - |
| 1607 | | - |
| 1608 | | - |
| 1609 | | - |
| 1610 | void QGridLayout::setRowMinimumHeight(int row, int minSize) | - |
| 1611 | { | - |
| 1612 | Q_D(QGridLayout); | - |
| 1613 | d->setRowMinimumHeight(row, minSize); | - |
| 1614 | invalidate(); | - |
| 1615 | } | - |
| 1616 | | - |
| 1617 | | - |
| 1618 | | - |
| 1619 | | - |
| 1620 | | - |
| 1621 | | - |
| 1622 | int QGridLayout::rowMinimumHeight(int row) const | - |
| 1623 | { | - |
| 1624 | Q_D(const QGridLayout); | - |
| 1625 | return d->rowSpacing(row); | - |
| 1626 | } | - |
| 1627 | | - |
| 1628 | | - |
| 1629 | | - |
| 1630 | | - |
| 1631 | | - |
| 1632 | | - |
| 1633 | void QGridLayout::setColumnMinimumWidth(int column, int minSize) | - |
| 1634 | { | - |
| 1635 | Q_D(QGridLayout); | - |
| 1636 | d->setColumnMinimumWidth(column, minSize); | - |
| 1637 | invalidate(); | - |
| 1638 | } | - |
| 1639 | | - |
| 1640 | | - |
| 1641 | | - |
| 1642 | | - |
| 1643 | | - |
| 1644 | | - |
| 1645 | int QGridLayout::columnMinimumWidth(int column) const | - |
| 1646 | { | - |
| 1647 | Q_D(const QGridLayout); | - |
| 1648 | return d->colSpacing(column); | - |
| 1649 | } | - |
| 1650 | | - |
| 1651 | | - |
| 1652 | | - |
| 1653 | | - |
| 1654 | Qt::Orientations QGridLayout::expandingDirections() const | - |
| 1655 | { | - |
| 1656 | Q_D(const QGridLayout); | - |
| 1657 | return d->expandingDirections(horizontalSpacing(), verticalSpacing()); | - |
| 1658 | } | - |
| 1659 | | - |
| 1660 | | - |
| 1661 | | - |
| 1662 | | - |
| 1663 | void QGridLayout::setOriginCorner(Qt::Corner corner) | - |
| 1664 | { | - |
| 1665 | Q_D(QGridLayout); | - |
| 1666 | d->setReversed(corner == Qt::BottomLeftCorner || corner == Qt::BottomRightCorner, | - |
| 1667 | corner == Qt::TopRightCorner || corner == Qt::BottomRightCorner); | - |
| 1668 | } | - |
| 1669 | | - |
| 1670 | | - |
| 1671 | | - |
| 1672 | | - |
| 1673 | | - |
| 1674 | Qt::Corner QGridLayout::originCorner() const | - |
| 1675 | { | - |
| 1676 | Q_D(const QGridLayout); | - |
| 1677 | if (d->horReversed()) { | - |
| 1678 | return d->verReversed() ? Qt::BottomRightCorner : Qt::TopRightCorner; | - |
| 1679 | } else { | - |
| 1680 | return d->verReversed() ? Qt::BottomLeftCorner : Qt::TopLeftCorner; | - |
| 1681 | } | - |
| 1682 | } | - |
| 1683 | | - |
| 1684 | | - |
| 1685 | | - |
| 1686 | | - |
| 1687 | void QGridLayout::invalidate() | - |
| 1688 | { | - |
| 1689 | Q_D(QGridLayout); | - |
| 1690 | d->setDirty(); | - |
| 1691 | QLayout::invalidate(); | - |
| 1692 | } | - |
| 1693 | | - |
| 1694 | QT_END_NAMESPACE | - |
| 1695 | | - |
| 1696 | #include "moc_qgridlayout.cpp" | - |
| | |