| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/widgets/kernel/qgridlayout.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||
| 3 | - | |||||||||||||||||||||||||
| 4 | struct QGridLayoutSizeTriple | - | ||||||||||||||||||||||||
| 5 | { | - | ||||||||||||||||||||||||
| 6 | QSize minS; | - | ||||||||||||||||||||||||
| 7 | QSize hint; | - | ||||||||||||||||||||||||
| 8 | QSize maxS; | - | ||||||||||||||||||||||||
| 9 | }; | - | ||||||||||||||||||||||||
| 10 | - | |||||||||||||||||||||||||
| 11 | - | |||||||||||||||||||||||||
| 12 | - | |||||||||||||||||||||||||
| 13 | - | |||||||||||||||||||||||||
| 14 | - | |||||||||||||||||||||||||
| 15 | - | |||||||||||||||||||||||||
| 16 | - | |||||||||||||||||||||||||
| 17 | class QGridBox | - | ||||||||||||||||||||||||
| 18 | { | - | ||||||||||||||||||||||||
| 19 | public: | - | ||||||||||||||||||||||||
| 20 | QGridBox(QLayoutItem *lit) { item_ = lit; } never executed: end of block | 0 | ||||||||||||||||||||||||
| 21 | - | |||||||||||||||||||||||||
| 22 | QGridBox(const QLayout *l, QWidget *wid) { item_ = QLayoutPrivate::createWidgetItem(l, wid); } never executed: end of block | 0 | ||||||||||||||||||||||||
| 23 | ~QGridBox() { delete item_; } never executed: end of block | 0 | ||||||||||||||||||||||||
| 24 | - | |||||||||||||||||||||||||
| 25 | QSize sizeHint() const { return never executed: item_->sizeHint();return item_->sizeHint();never executed: }return item_->sizeHint(); | 0 | ||||||||||||||||||||||||
| 26 | QSize minimumSize() const { return never executed: item_->minimumSize();return item_->minimumSize();never executed: }return item_->minimumSize(); | 0 | ||||||||||||||||||||||||
| 27 | QSize maximumSize() const { return never executed: item_->maximumSize();return item_->maximumSize();never executed: }return item_->maximumSize(); | 0 | ||||||||||||||||||||||||
| 28 | Qt::Orientations expandingDirections() const { return never executed: item_->expandingDirections();return item_->expandingDirections();never executed: }return item_->expandingDirections(); | 0 | ||||||||||||||||||||||||
| 29 | bool isEmpty() const { return never executed: item_->isEmpty();return item_->isEmpty();never executed: }return item_->isEmpty(); | 0 | ||||||||||||||||||||||||
| 30 | - | |||||||||||||||||||||||||
| 31 | bool hasHeightForWidth() const { return never executed: item_->hasHeightForWidth();return item_->hasHeightForWidth();never executed: }return item_->hasHeightForWidth(); | 0 | ||||||||||||||||||||||||
| 32 | int heightForWidth(int w) const { return never executed: item_->heightForWidth(w);return item_->heightForWidth(w);never executed: }return item_->heightForWidth(w); | 0 | ||||||||||||||||||||||||
| 33 | - | |||||||||||||||||||||||||
| 34 | void setAlignment(Qt::Alignment a) { item_->setAlignment(a); } never executed: end of block | 0 | ||||||||||||||||||||||||
| 35 | void setGeometry(const QRect &r) { item_->setGeometry(r); } never executed: end of block | 0 | ||||||||||||||||||||||||
| 36 | Qt::Alignment alignment() const { return never executed: item_->alignment();return item_->alignment();never executed: }return item_->alignment(); | 0 | ||||||||||||||||||||||||
| 37 | QLayoutItem *item() { return never executed: item_;return item_;never executed: }return item_; | 0 | ||||||||||||||||||||||||
| 38 | void setItem(QLayoutItem *newitem) { item_ = newitem; } never executed: end of block | 0 | ||||||||||||||||||||||||
| 39 | QLayoutItem *takeItem() { QLayoutItem *i = item_; item_ = 0; return never executed: i;return i;never executed: }return i; | 0 | ||||||||||||||||||||||||
| 40 | - | |||||||||||||||||||||||||
| 41 | int hStretch() { return never executed: item_->widget()return item_->widget() ? item_->widget()->sizePolicy().horizontalStretch() : 0;
never executed: return item_->widget() ? item_->widget()->sizePolicy().horizontalStretch() : 0; | 0 | ||||||||||||||||||||||||
| 42 | item_->widget()->sizePolicy().horizontalStretch() : 0; never executed: }return item_->widget() ? item_->widget()->sizePolicy().horizontalStretch() : 0; | 0 | ||||||||||||||||||||||||
| 43 | int vStretch() { return never executed: item_->widget()return item_->widget() ? item_->widget()->sizePolicy().verticalStretch() : 0;
never executed: return item_->widget() ? item_->widget()->sizePolicy().verticalStretch() : 0; | 0 | ||||||||||||||||||||||||
| 44 | item_->widget()->sizePolicy().verticalStretch() : 0; never executed: }return item_->widget() ? item_->widget()->sizePolicy().verticalStretch() : 0; | 0 | ||||||||||||||||||||||||
| 45 | - | |||||||||||||||||||||||||
| 46 | private: | - | ||||||||||||||||||||||||
| 47 | friend class QGridLayoutPrivate; | - | ||||||||||||||||||||||||
| 48 | friend class QGridLayout; | - | ||||||||||||||||||||||||
| 49 | - | |||||||||||||||||||||||||
| 50 | inline int toRow(int rr) const { return never executed: torow >= 0return torow >= 0 ? torow : rr - 1;
never executed: }return torow >= 0 ? torow : rr - 1; | 0 | ||||||||||||||||||||||||
| 51 | inline int toCol(int cc) const { return never executed: tocol >= 0return tocol >= 0 ? tocol : cc - 1;
never executed: }return tocol >= 0 ? tocol : cc - 1; | 0 | ||||||||||||||||||||||||
| 52 | - | |||||||||||||||||||||||||
| 53 | QLayoutItem *item_; | - | ||||||||||||||||||||||||
| 54 | int row, col; | - | ||||||||||||||||||||||||
| 55 | int torow, tocol; | - | ||||||||||||||||||||||||
| 56 | }; | - | ||||||||||||||||||||||||
| 57 | - | |||||||||||||||||||||||||
| 58 | class QGridLayoutPrivate : public QLayoutPrivate | - | ||||||||||||||||||||||||
| 59 | { | - | ||||||||||||||||||||||||
| 60 | inline QGridLayout* q_func() { return static_cast<QGridLayout *>(q_ptr); } inline const QGridLayout* q_func() const { return static_cast<const QGridLayout *>(q_ptr); } friend class QGridLayout; | - | ||||||||||||||||||||||||
| 61 | public: | - | ||||||||||||||||||||||||
| 62 | QGridLayoutPrivate(); | - | ||||||||||||||||||||||||
| 63 | - | |||||||||||||||||||||||||
| 64 | void add(QGridBox*, int row, int col); | - | ||||||||||||||||||||||||
| 65 | void add(QGridBox*, int row1, int row2, int col1, int col2); | - | ||||||||||||||||||||||||
| 66 | QSize sizeHint(int hSpacing, int vSpacing) const; | - | ||||||||||||||||||||||||
| 67 | QSize minimumSize(int hSpacing, int vSpacing) const; | - | ||||||||||||||||||||||||
| 68 | QSize maximumSize(int hSpacing, int vSpacing) const; | - | ||||||||||||||||||||||||
| 69 | - | |||||||||||||||||||||||||
| 70 | Qt::Orientations expandingDirections(int hSpacing, int vSpacing) const; | - | ||||||||||||||||||||||||
| 71 | - | |||||||||||||||||||||||||
| 72 | void distribute(QRect rect, int hSpacing, int vSpacing); | - | ||||||||||||||||||||||||
| 73 | inline int numRows() const { return never executed: rr;return rr;never executed: }return rr; | 0 | ||||||||||||||||||||||||
| 74 | inline int numCols() const { return never executed: cc;return cc;never executed: }return cc; | 0 | ||||||||||||||||||||||||
| 75 | inline void expand(int rows, int cols) | - | ||||||||||||||||||||||||
| 76 | { setSize(qMax(rows, rr), qMax(cols, cc)); } never executed: end of block | 0 | ||||||||||||||||||||||||
| 77 | inline void setRowStretch(int r, int s) | - | ||||||||||||||||||||||||
| 78 | { expand(r + 1, 0); rStretch[r] = s; setDirty(); } never executed: end of block | 0 | ||||||||||||||||||||||||
| 79 | inline void setColStretch(int c, int s) | - | ||||||||||||||||||||||||
| 80 | { expand(0, c + 1); cStretch[c] = s; setDirty(); } never executed: end of block | 0 | ||||||||||||||||||||||||
| 81 | inline int rowStretch(int r) const { return never executed: rStretch.at(r);return rStretch.at(r);never executed: }return rStretch.at(r); | 0 | ||||||||||||||||||||||||
| 82 | inline int colStretch(int c) const { return never executed: cStretch.at(c);return cStretch.at(c);never executed: }return cStretch.at(c); | 0 | ||||||||||||||||||||||||
| 83 | inline void setRowMinimumHeight(int r, int s) | - | ||||||||||||||||||||||||
| 84 | { expand(r + 1, 0); rMinHeights[r] = s; setDirty(); } never executed: end of block | 0 | ||||||||||||||||||||||||
| 85 | inline void setColumnMinimumWidth(int c, int s) | - | ||||||||||||||||||||||||
| 86 | { expand(0, c + 1); cMinWidths[c] = s; setDirty(); } never executed: end of block | 0 | ||||||||||||||||||||||||
| 87 | inline int rowSpacing(int r) const { return never executed: rMinHeights.at(r);return rMinHeights.at(r);never executed: }return rMinHeights.at(r); | 0 | ||||||||||||||||||||||||
| 88 | inline int colSpacing(int c) const { return never executed: cMinWidths.at(c);return cMinWidths.at(c);never executed: }return cMinWidths.at(c); | 0 | ||||||||||||||||||||||||
| 89 | - | |||||||||||||||||||||||||
| 90 | inline void setReversed(bool r, bool c) { hReversed = c; vReversed = r; } never executed: end of block | 0 | ||||||||||||||||||||||||
| 91 | inline bool horReversed() const { return never executed: hReversed;return hReversed;never executed: }return hReversed; | 0 | ||||||||||||||||||||||||
| 92 | inline bool verReversed() const { return never executed: vReversed;return vReversed;never executed: }return vReversed; | 0 | ||||||||||||||||||||||||
| 93 | inline void setDirty() { needRecalc = true; hfw_width = -1; } never executed: end of block | 0 | ||||||||||||||||||||||||
| 94 | inline bool isDirty() const { return never executed: needRecalc;return needRecalc;never executed: }return needRecalc; | 0 | ||||||||||||||||||||||||
| 95 | bool hasHeightForWidth(int hSpacing, int vSpacing); | - | ||||||||||||||||||||||||
| 96 | int heightForWidth(int width, int hSpacing, int vSpacing); | - | ||||||||||||||||||||||||
| 97 | int minimumHeightForWidth(int width, int hSpacing, int vSpacing); | - | ||||||||||||||||||||||||
| 98 | - | |||||||||||||||||||||||||
| 99 | inline void getNextPos(int &row, int &col) { row = nextR; col = nextC; } never executed: end of block | 0 | ||||||||||||||||||||||||
| 100 | inline int count() const { return never executed: things.count();return things.count();never executed: }return things.count(); | 0 | ||||||||||||||||||||||||
| 101 | QRect cellRect(int row, int col) const; | - | ||||||||||||||||||||||||
| 102 | - | |||||||||||||||||||||||||
| 103 | inline QLayoutItem *itemAt(int index) const { | - | ||||||||||||||||||||||||
| 104 | if (index < things.count()
| 0 | ||||||||||||||||||||||||
| 105 | return never executed: things.at(index)->item();return things.at(index)->item();never executed: return things.at(index)->item(); | 0 | ||||||||||||||||||||||||
| 106 | else | - | ||||||||||||||||||||||||
| 107 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 108 | } | - | ||||||||||||||||||||||||
| 109 | inline QLayoutItem *takeAt(int index) { | - | ||||||||||||||||||||||||
| 110 | QGridLayout * const q = q_func(); | - | ||||||||||||||||||||||||
| 111 | if (index < things.count()
| 0 | ||||||||||||||||||||||||
| 112 | if (QGridBox *b = things.takeAt(index)
| 0 | ||||||||||||||||||||||||
| 113 | QLayoutItem *item = b->takeItem(); | - | ||||||||||||||||||||||||
| 114 | if (QLayout *l = item->layout()
| 0 | ||||||||||||||||||||||||
| 115 | - | |||||||||||||||||||||||||
| 116 | if (l->parent() == q
| 0 | ||||||||||||||||||||||||
| 117 | l->setParent(0); never executed: l->setParent(0); | 0 | ||||||||||||||||||||||||
| 118 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 119 | delete b; | - | ||||||||||||||||||||||||
| 120 | return never executed: item;return item;never executed: return item; | 0 | ||||||||||||||||||||||||
| 121 | } | - | ||||||||||||||||||||||||
| 122 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 123 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 124 | } | - | ||||||||||||||||||||||||
| 125 | QLayoutItem* replaceAt(int index, QLayoutItem *newitem) override | - | ||||||||||||||||||||||||
| 126 | { | - | ||||||||||||||||||||||||
| 127 | if (!newitem
| 0 | ||||||||||||||||||||||||
| 128 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 129 | QLayoutItem *item = 0; | - | ||||||||||||||||||||||||
| 130 | QGridBox *b = things.value(index); | - | ||||||||||||||||||||||||
| 131 | if (b
| 0 | ||||||||||||||||||||||||
| 132 | item = b->takeItem(); | - | ||||||||||||||||||||||||
| 133 | b->setItem(newitem); | - | ||||||||||||||||||||||||
| 134 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 135 | return never executed: item;return item;never executed: return item; | 0 | ||||||||||||||||||||||||
| 136 | } | - | ||||||||||||||||||||||||
| 137 | - | |||||||||||||||||||||||||
| 138 | void getItemPosition(int index, int *row, int *column, int *rowSpan, int *columnSpan) const { | - | ||||||||||||||||||||||||
| 139 | if (index < things.count()
| 0 | ||||||||||||||||||||||||
| 140 | const QGridBox *b = things.at(index); | - | ||||||||||||||||||||||||
| 141 | int toRow = b->toRow(rr); | - | ||||||||||||||||||||||||
| 142 | int toCol = b->toCol(cc); | - | ||||||||||||||||||||||||
| 143 | *row = b->row; | - | ||||||||||||||||||||||||
| 144 | *column = b->col; | - | ||||||||||||||||||||||||
| 145 | *rowSpan = toRow - *row + 1; | - | ||||||||||||||||||||||||
| 146 | *columnSpan = toCol - *column +1; | - | ||||||||||||||||||||||||
| 147 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 148 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 149 | void deleteAll(); | - | ||||||||||||||||||||||||
| 150 | - | |||||||||||||||||||||||||
| 151 | private: | - | ||||||||||||||||||||||||
| 152 | void setNextPosAfter(int r, int c); | - | ||||||||||||||||||||||||
| 153 | void recalcHFW(int w); | - | ||||||||||||||||||||||||
| 154 | void addHfwData(QGridBox *box, int width); | - | ||||||||||||||||||||||||
| 155 | void init(); | - | ||||||||||||||||||||||||
| 156 | QSize findSize(int QLayoutStruct::*, int hSpacing, int vSpacing) const; | - | ||||||||||||||||||||||||
| 157 | void addData(QGridBox *b, const QGridLayoutSizeTriple &sizes, bool r, bool c); | - | ||||||||||||||||||||||||
| 158 | void setSize(int rows, int cols); | - | ||||||||||||||||||||||||
| 159 | void setupSpacings(QVector<QLayoutStruct> &chain, QGridBox *grid[], int fixedSpacing, | - | ||||||||||||||||||||||||
| 160 | Qt::Orientation orientation); | - | ||||||||||||||||||||||||
| 161 | void setupLayoutData(int hSpacing, int vSpacing); | - | ||||||||||||||||||||||||
| 162 | void setupHfwLayoutData(); | - | ||||||||||||||||||||||||
| 163 | void effectiveMargins(int *left, int *top, int *right, int *bottom) const; | - | ||||||||||||||||||||||||
| 164 | - | |||||||||||||||||||||||||
| 165 | int rr; | - | ||||||||||||||||||||||||
| 166 | int cc; | - | ||||||||||||||||||||||||
| 167 | QVector<QLayoutStruct> rowData; | - | ||||||||||||||||||||||||
| 168 | QVector<QLayoutStruct> colData; | - | ||||||||||||||||||||||||
| 169 | QVector<QLayoutStruct> *hfwData; | - | ||||||||||||||||||||||||
| 170 | QVector<int> rStretch; | - | ||||||||||||||||||||||||
| 171 | QVector<int> cStretch; | - | ||||||||||||||||||||||||
| 172 | QVector<int> rMinHeights; | - | ||||||||||||||||||||||||
| 173 | QVector<int> cMinWidths; | - | ||||||||||||||||||||||||
| 174 | QList<QGridBox *> things; | - | ||||||||||||||||||||||||
| 175 | - | |||||||||||||||||||||||||
| 176 | int hfw_width; | - | ||||||||||||||||||||||||
| 177 | int hfw_height; | - | ||||||||||||||||||||||||
| 178 | int hfw_minheight; | - | ||||||||||||||||||||||||
| 179 | int nextR; | - | ||||||||||||||||||||||||
| 180 | int nextC; | - | ||||||||||||||||||||||||
| 181 | - | |||||||||||||||||||||||||
| 182 | int horizontalSpacing; | - | ||||||||||||||||||||||||
| 183 | int verticalSpacing; | - | ||||||||||||||||||||||||
| 184 | int leftMargin; | - | ||||||||||||||||||||||||
| 185 | int topMargin; | - | ||||||||||||||||||||||||
| 186 | int rightMargin; | - | ||||||||||||||||||||||||
| 187 | int bottomMargin; | - | ||||||||||||||||||||||||
| 188 | - | |||||||||||||||||||||||||
| 189 | uint hReversed : 1; | - | ||||||||||||||||||||||||
| 190 | uint vReversed : 1; | - | ||||||||||||||||||||||||
| 191 | uint needRecalc : 1; | - | ||||||||||||||||||||||||
| 192 | uint has_hfw : 1; | - | ||||||||||||||||||||||||
| 193 | uint addVertical : 1; | - | ||||||||||||||||||||||||
| 194 | }; | - | ||||||||||||||||||||||||
| 195 | - | |||||||||||||||||||||||||
| 196 | void QGridLayoutPrivate::effectiveMargins(int *left, int *top, int *right, int *bottom) const | - | ||||||||||||||||||||||||
| 197 | { | - | ||||||||||||||||||||||||
| 198 | int l = leftMargin; | - | ||||||||||||||||||||||||
| 199 | int t = topMargin; | - | ||||||||||||||||||||||||
| 200 | int r = rightMargin; | - | ||||||||||||||||||||||||
| 201 | int b = bottomMargin; | - | ||||||||||||||||||||||||
| 202 | if (left
| 0 | ||||||||||||||||||||||||
| 203 | * never executed: left = l;*left = l;never executed: *left = l; | 0 | ||||||||||||||||||||||||
| 204 | if (top
| 0 | ||||||||||||||||||||||||
| 205 | * never executed: top = t;*top = t;never executed: *top = t; | 0 | ||||||||||||||||||||||||
| 206 | if (right
| 0 | ||||||||||||||||||||||||
| 207 | * never executed: right = r;*right = r;never executed: *right = r; | 0 | ||||||||||||||||||||||||
| 208 | if (bottom
| 0 | ||||||||||||||||||||||||
| 209 | * never executed: bottom = b;*bottom = b;never executed: *bottom = b; | 0 | ||||||||||||||||||||||||
| 210 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 211 | - | |||||||||||||||||||||||||
| 212 | QGridLayoutPrivate::QGridLayoutPrivate() | - | ||||||||||||||||||||||||
| 213 | { | - | ||||||||||||||||||||||||
| 214 | addVertical = false; | - | ||||||||||||||||||||||||
| 215 | setDirty(); | - | ||||||||||||||||||||||||
| 216 | rr = cc = 0; | - | ||||||||||||||||||||||||
| 217 | nextR = nextC = 0; | - | ||||||||||||||||||||||||
| 218 | hfwData = 0; | - | ||||||||||||||||||||||||
| 219 | hReversed = false; | - | ||||||||||||||||||||||||
| 220 | vReversed = false; | - | ||||||||||||||||||||||||
| 221 | horizontalSpacing = -1; | - | ||||||||||||||||||||||||
| 222 | verticalSpacing = -1; | - | ||||||||||||||||||||||||
| 223 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 224 | void QGridLayoutPrivate::deleteAll() | - | ||||||||||||||||||||||||
| 225 | { | - | ||||||||||||||||||||||||
| 226 | while (!things.isEmpty()
| 0 | ||||||||||||||||||||||||
| 227 | delete things.takeFirst(); never executed: delete things.takeFirst(); | 0 | ||||||||||||||||||||||||
| 228 | delete hfwData; | - | ||||||||||||||||||||||||
| 229 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 230 | - | |||||||||||||||||||||||||
| 231 | bool QGridLayoutPrivate::hasHeightForWidth(int hSpacing, int vSpacing) | - | ||||||||||||||||||||||||
| 232 | { | - | ||||||||||||||||||||||||
| 233 | setupLayoutData(hSpacing, vSpacing); | - | ||||||||||||||||||||||||
| 234 | return never executed: has_hfw;return has_hfw;never executed: return has_hfw; | 0 | ||||||||||||||||||||||||
| 235 | } | - | ||||||||||||||||||||||||
| 236 | - | |||||||||||||||||||||||||
| 237 | - | |||||||||||||||||||||||||
| 238 | - | |||||||||||||||||||||||||
| 239 | - | |||||||||||||||||||||||||
| 240 | - | |||||||||||||||||||||||||
| 241 | void QGridLayoutPrivate::recalcHFW(int w) | - | ||||||||||||||||||||||||
| 242 | { | - | ||||||||||||||||||||||||
| 243 | - | |||||||||||||||||||||||||
| 244 | - | |||||||||||||||||||||||||
| 245 | - | |||||||||||||||||||||||||
| 246 | - | |||||||||||||||||||||||||
| 247 | if (!hfwData
| 0 | ||||||||||||||||||||||||
| 248 | hfwData = new QVector<QLayoutStruct>(rr); never executed: hfwData = new QVector<QLayoutStruct>(rr); | 0 | ||||||||||||||||||||||||
| 249 | setupHfwLayoutData(); | - | ||||||||||||||||||||||||
| 250 | QVector<QLayoutStruct> &rData = *hfwData; | - | ||||||||||||||||||||||||
| 251 | - | |||||||||||||||||||||||||
| 252 | int h = 0; | - | ||||||||||||||||||||||||
| 253 | int mh = 0; | - | ||||||||||||||||||||||||
| 254 | for (int r = 0; r < rr
| 0 | ||||||||||||||||||||||||
| 255 | int spacing = rData.at(r).spacing; | - | ||||||||||||||||||||||||
| 256 | h += rData.at(r).sizeHint + spacing; | - | ||||||||||||||||||||||||
| 257 | mh += rData.at(r).minimumSize + spacing; | - | ||||||||||||||||||||||||
| 258 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 259 | - | |||||||||||||||||||||||||
| 260 | hfw_width = w; | - | ||||||||||||||||||||||||
| 261 | hfw_height = qMin(QLAYOUTSIZE_MAX, h); | - | ||||||||||||||||||||||||
| 262 | hfw_minheight = qMin(QLAYOUTSIZE_MAX, mh); | - | ||||||||||||||||||||||||
| 263 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 264 | - | |||||||||||||||||||||||||
| 265 | int QGridLayoutPrivate::heightForWidth(int w, int hSpacing, int vSpacing) | - | ||||||||||||||||||||||||
| 266 | { | - | ||||||||||||||||||||||||
| 267 | setupLayoutData(hSpacing, vSpacing); | - | ||||||||||||||||||||||||
| 268 | if (!has_hfw
| 0 | ||||||||||||||||||||||||
| 269 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||||||||
| 270 | int left, top, right, bottom; | - | ||||||||||||||||||||||||
| 271 | effectiveMargins(&left, &top, &right, &bottom); | - | ||||||||||||||||||||||||
| 272 | - | |||||||||||||||||||||||||
| 273 | int hMargins = left + right; | - | ||||||||||||||||||||||||
| 274 | if (w - hMargins != hfw_width
| 0 | ||||||||||||||||||||||||
| 275 | qGeomCalc(colData, 0, cc, 0, w - hMargins); | - | ||||||||||||||||||||||||
| 276 | recalcHFW(w - hMargins); | - | ||||||||||||||||||||||||
| 277 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 278 | return never executed: hfw_height + top + bottom;return hfw_height + top + bottom;never executed: return hfw_height + top + bottom; | 0 | ||||||||||||||||||||||||
| 279 | } | - | ||||||||||||||||||||||||
| 280 | - | |||||||||||||||||||||||||
| 281 | int QGridLayoutPrivate::minimumHeightForWidth(int w, int hSpacing, int vSpacing) | - | ||||||||||||||||||||||||
| 282 | { | - | ||||||||||||||||||||||||
| 283 | (void)heightForWidth(w, hSpacing, vSpacing); | - | ||||||||||||||||||||||||
| 284 | if (!has_hfw
| 0 | ||||||||||||||||||||||||
| 285 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||||||||
| 286 | int top, bottom; | - | ||||||||||||||||||||||||
| 287 | effectiveMargins(0, &top, 0, &bottom); | - | ||||||||||||||||||||||||
| 288 | return never executed: hfw_minheight + top + bottom;return hfw_minheight + top + bottom;never executed: return hfw_minheight + top + bottom; | 0 | ||||||||||||||||||||||||
| 289 | } | - | ||||||||||||||||||||||||
| 290 | - | |||||||||||||||||||||||||
| 291 | QSize QGridLayoutPrivate::findSize(int QLayoutStruct::*size, int hSpacing, int vSpacing) const | - | ||||||||||||||||||||||||
| 292 | { | - | ||||||||||||||||||||||||
| 293 | QGridLayoutPrivate *that = const_cast<QGridLayoutPrivate*>(this); | - | ||||||||||||||||||||||||
| 294 | that->setupLayoutData(hSpacing, vSpacing); | - | ||||||||||||||||||||||||
| 295 | - | |||||||||||||||||||||||||
| 296 | int w = 0; | - | ||||||||||||||||||||||||
| 297 | int h = 0; | - | ||||||||||||||||||||||||
| 298 | - | |||||||||||||||||||||||||
| 299 | for (int r = 0; r < rr
| 0 | ||||||||||||||||||||||||
| 300 | h += rowData.at(r).*size + rowData.at(r).spacing; never executed: h += rowData.at(r).*size + rowData.at(r).spacing; | 0 | ||||||||||||||||||||||||
| 301 | for (int c = 0; c < cc
| 0 | ||||||||||||||||||||||||
| 302 | w += colData.at(c).*size + colData.at(c).spacing; never executed: w += colData.at(c).*size + colData.at(c).spacing; | 0 | ||||||||||||||||||||||||
| 303 | - | |||||||||||||||||||||||||
| 304 | w = qMin(QLAYOUTSIZE_MAX, w); | - | ||||||||||||||||||||||||
| 305 | h = qMin(QLAYOUTSIZE_MAX, h); | - | ||||||||||||||||||||||||
| 306 | - | |||||||||||||||||||||||||
| 307 | return never executed: QSize(w, h);return QSize(w, h);never executed: return QSize(w, h); | 0 | ||||||||||||||||||||||||
| 308 | } | - | ||||||||||||||||||||||||
| 309 | - | |||||||||||||||||||||||||
| 310 | Qt::Orientations QGridLayoutPrivate::expandingDirections(int hSpacing, int vSpacing) const | - | ||||||||||||||||||||||||
| 311 | { | - | ||||||||||||||||||||||||
| 312 | QGridLayoutPrivate *that = const_cast<QGridLayoutPrivate*>(this); | - | ||||||||||||||||||||||||
| 313 | that->setupLayoutData(hSpacing, vSpacing); | - | ||||||||||||||||||||||||
| 314 | Qt::Orientations ret; | - | ||||||||||||||||||||||||
| 315 | - | |||||||||||||||||||||||||
| 316 | for (int r = 0; r < rr
| 0 | ||||||||||||||||||||||||
| 317 | if (rowData.at(r).expansive
| 0 | ||||||||||||||||||||||||
| 318 | ret |= Qt::Vertical; | - | ||||||||||||||||||||||||
| 319 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 320 | } | - | ||||||||||||||||||||||||
| 321 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 322 | for (int c = 0; c < cc
| 0 | ||||||||||||||||||||||||
| 323 | if (colData.at(c).expansive
| 0 | ||||||||||||||||||||||||
| 324 | ret |= Qt::Horizontal; | - | ||||||||||||||||||||||||
| 325 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 326 | } | - | ||||||||||||||||||||||||
| 327 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 328 | return never executed: ret;return ret;never executed: return ret; | 0 | ||||||||||||||||||||||||
| 329 | } | - | ||||||||||||||||||||||||
| 330 | - | |||||||||||||||||||||||||
| 331 | QSize QGridLayoutPrivate::sizeHint(int hSpacing, int vSpacing) const | - | ||||||||||||||||||||||||
| 332 | { | - | ||||||||||||||||||||||||
| 333 | return never executed: findSize(&QLayoutStruct::sizeHint, hSpacing, vSpacing);return findSize(&QLayoutStruct::sizeHint, hSpacing, vSpacing);never executed: return findSize(&QLayoutStruct::sizeHint, hSpacing, vSpacing); | 0 | ||||||||||||||||||||||||
| 334 | } | - | ||||||||||||||||||||||||
| 335 | - | |||||||||||||||||||||||||
| 336 | QSize QGridLayoutPrivate::maximumSize(int hSpacing, int vSpacing) const | - | ||||||||||||||||||||||||
| 337 | { | - | ||||||||||||||||||||||||
| 338 | return never executed: findSize(&QLayoutStruct::maximumSize, hSpacing, vSpacing);return findSize(&QLayoutStruct::maximumSize, hSpacing, vSpacing);never executed: return findSize(&QLayoutStruct::maximumSize, hSpacing, vSpacing); | 0 | ||||||||||||||||||||||||
| 339 | } | - | ||||||||||||||||||||||||
| 340 | - | |||||||||||||||||||||||||
| 341 | QSize QGridLayoutPrivate::minimumSize(int hSpacing, int vSpacing) const | - | ||||||||||||||||||||||||
| 342 | { | - | ||||||||||||||||||||||||
| 343 | return never executed: findSize(&QLayoutStruct::minimumSize, hSpacing, vSpacing);return findSize(&QLayoutStruct::minimumSize, hSpacing, vSpacing);never executed: return findSize(&QLayoutStruct::minimumSize, hSpacing, vSpacing); | 0 | ||||||||||||||||||||||||
| 344 | } | - | ||||||||||||||||||||||||
| 345 | - | |||||||||||||||||||||||||
| 346 | void QGridLayoutPrivate::setSize(int r, int c) | - | ||||||||||||||||||||||||
| 347 | { | - | ||||||||||||||||||||||||
| 348 | if ((
| 0 | ||||||||||||||||||||||||
| 349 | int newR = qMax(r, rr * 2); | - | ||||||||||||||||||||||||
| 350 | rowData.resize(newR); | - | ||||||||||||||||||||||||
| 351 | rStretch.resize(newR); | - | ||||||||||||||||||||||||
| 352 | rMinHeights.resize(newR); | - | ||||||||||||||||||||||||
| 353 | for (int i = rr; i < newR
| 0 | ||||||||||||||||||||||||
| 354 | rowData[i].init(); | - | ||||||||||||||||||||||||
| 355 | rowData[i].maximumSize = 0; | - | ||||||||||||||||||||||||
| 356 | rowData[i].pos = 0; | - | ||||||||||||||||||||||||
| 357 | rowData[i].size = 0; | - | ||||||||||||||||||||||||
| 358 | rStretch[i] = 0; | - | ||||||||||||||||||||||||
| 359 | rMinHeights[i] = 0; | - | ||||||||||||||||||||||||
| 360 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 361 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 362 | if ((
| 0 | ||||||||||||||||||||||||
| 363 | int newC = qMax(c, cc * 2); | - | ||||||||||||||||||||||||
| 364 | colData.resize(newC); | - | ||||||||||||||||||||||||
| 365 | cStretch.resize(newC); | - | ||||||||||||||||||||||||
| 366 | cMinWidths.resize(newC); | - | ||||||||||||||||||||||||
| 367 | for (int i = cc; i < newC
| 0 | ||||||||||||||||||||||||
| 368 | colData[i].init(); | - | ||||||||||||||||||||||||
| 369 | colData[i].maximumSize = 0; | - | ||||||||||||||||||||||||
| 370 | colData[i].pos = 0; | - | ||||||||||||||||||||||||
| 371 | colData[i].size = 0; | - | ||||||||||||||||||||||||
| 372 | cStretch[i] = 0; | - | ||||||||||||||||||||||||
| 373 | cMinWidths[i] = 0; | - | ||||||||||||||||||||||||
| 374 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 375 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 376 | - | |||||||||||||||||||||||||
| 377 | if (hfwData
| 0 | ||||||||||||||||||||||||
| 378 | delete hfwData; | - | ||||||||||||||||||||||||
| 379 | hfwData = 0; | - | ||||||||||||||||||||||||
| 380 | hfw_width = -1; | - | ||||||||||||||||||||||||
| 381 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 382 | rr = r; | - | ||||||||||||||||||||||||
| 383 | cc = c; | - | ||||||||||||||||||||||||
| 384 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 385 | - | |||||||||||||||||||||||||
| 386 | void QGridLayoutPrivate::setNextPosAfter(int row, int col) | - | ||||||||||||||||||||||||
| 387 | { | - | ||||||||||||||||||||||||
| 388 | if (addVertical
| 0 | ||||||||||||||||||||||||
| 389 | if (col > nextC
| 0 | ||||||||||||||||||||||||
| 390 | nextR = row + 1; | - | ||||||||||||||||||||||||
| 391 | nextC = col; | - | ||||||||||||||||||||||||
| 392 | if (nextR >= rr
| 0 | ||||||||||||||||||||||||
| 393 | nextR = 0; | - | ||||||||||||||||||||||||
| 394 | nextC++; | - | ||||||||||||||||||||||||
| 395 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 396 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 397 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 398 | if (row > nextR
| 0 | ||||||||||||||||||||||||
| 399 | nextR = row; | - | ||||||||||||||||||||||||
| 400 | nextC = col + 1; | - | ||||||||||||||||||||||||
| 401 | if (nextC >= cc
| 0 | ||||||||||||||||||||||||
| 402 | nextC = 0; | - | ||||||||||||||||||||||||
| 403 | nextR++; | - | ||||||||||||||||||||||||
| 404 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 405 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 406 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 407 | } | - | ||||||||||||||||||||||||
| 408 | - | |||||||||||||||||||||||||
| 409 | void QGridLayoutPrivate::add(QGridBox *box, int row, int col) | - | ||||||||||||||||||||||||
| 410 | { | - | ||||||||||||||||||||||||
| 411 | expand(row + 1, col + 1); | - | ||||||||||||||||||||||||
| 412 | box->row = box->torow = row; | - | ||||||||||||||||||||||||
| 413 | box->col = box->tocol = col; | - | ||||||||||||||||||||||||
| 414 | things.append(box); | - | ||||||||||||||||||||||||
| 415 | setDirty(); | - | ||||||||||||||||||||||||
| 416 | setNextPosAfter(row, col); | - | ||||||||||||||||||||||||
| 417 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 418 | - | |||||||||||||||||||||||||
| 419 | void QGridLayoutPrivate::add(QGridBox *box, int row1, int row2, int col1, int col2) | - | ||||||||||||||||||||||||
| 420 | { | - | ||||||||||||||||||||||||
| 421 | if (row2 >= 0
| 0 | ||||||||||||||||||||||||
| 422 | QMessageLogger(__FILE__, 561, __PRETTY_FUNCTION__).warning("QGridLayout: Multi-cell fromRow greater than toRow"); never executed: QMessageLogger(__FILE__, 561, __PRETTY_FUNCTION__).warning("QGridLayout: Multi-cell fromRow greater than toRow"); | 0 | ||||||||||||||||||||||||
| 423 | if (col2 >= 0
| 0 | ||||||||||||||||||||||||
| 424 | QMessageLogger(__FILE__, 563, __PRETTY_FUNCTION__).warning("QGridLayout: Multi-cell fromCol greater than toCol"); never executed: QMessageLogger(__FILE__, 563, __PRETTY_FUNCTION__).warning("QGridLayout: Multi-cell fromCol greater than toCol"); | 0 | ||||||||||||||||||||||||
| 425 | if (row1 == row2
| 0 | ||||||||||||||||||||||||
| 426 | add(box, row1, col1); | - | ||||||||||||||||||||||||
| 427 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 428 | } | - | ||||||||||||||||||||||||
| 429 | expand(qMax(row1, row2) + 1, qMax(col1, col2) + 1); | - | ||||||||||||||||||||||||
| 430 | box->row = row1; | - | ||||||||||||||||||||||||
| 431 | box->col = col1; | - | ||||||||||||||||||||||||
| 432 | - | |||||||||||||||||||||||||
| 433 | box->torow = row2; | - | ||||||||||||||||||||||||
| 434 | box->tocol = col2; | - | ||||||||||||||||||||||||
| 435 | - | |||||||||||||||||||||||||
| 436 | things.append(box); | - | ||||||||||||||||||||||||
| 437 | setDirty(); | - | ||||||||||||||||||||||||
| 438 | if (col2 < 0
| 0 | ||||||||||||||||||||||||
| 439 | col2 = cc - 1; never executed: col2 = cc - 1; | 0 | ||||||||||||||||||||||||
| 440 | - | |||||||||||||||||||||||||
| 441 | setNextPosAfter(row2, col2); | - | ||||||||||||||||||||||||
| 442 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 443 | - | |||||||||||||||||||||||||
| 444 | void QGridLayoutPrivate::addData(QGridBox *box, const QGridLayoutSizeTriple &sizes, bool r, bool c) | - | ||||||||||||||||||||||||
| 445 | { | - | ||||||||||||||||||||||||
| 446 | const QWidget *widget = box->item()->widget(); | - | ||||||||||||||||||||||||
| 447 | - | |||||||||||||||||||||||||
| 448 | if (box->isEmpty()
| 0 | ||||||||||||||||||||||||
| 449 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 450 | - | |||||||||||||||||||||||||
| 451 | if (c
| 0 | ||||||||||||||||||||||||
| 452 | QLayoutStruct *data = &colData[box->col]; | - | ||||||||||||||||||||||||
| 453 | if (!cStretch.at(box->col)
| 0 | ||||||||||||||||||||||||
| 454 | data->stretch = qMax(data->stretch, box->hStretch()); never executed: data->stretch = qMax(data->stretch, box->hStretch()); | 0 | ||||||||||||||||||||||||
| 455 | data->sizeHint = qMax(sizes.hint.width(), data->sizeHint); | - | ||||||||||||||||||||||||
| 456 | data->minimumSize = qMax(sizes.minS.width(), data->minimumSize); | - | ||||||||||||||||||||||||
| 457 | - | |||||||||||||||||||||||||
| 458 | qMaxExpCalc(data->maximumSize, data->expansive, data->empty, sizes.maxS.width(), | - | ||||||||||||||||||||||||
| 459 | box->expandingDirections() & Qt::Horizontal, box->isEmpty()); | - | ||||||||||||||||||||||||
| 460 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 461 | if (r
| 0 | ||||||||||||||||||||||||
| 462 | QLayoutStruct *data = &rowData[box->row]; | - | ||||||||||||||||||||||||
| 463 | if (!rStretch.at(box->row)
| 0 | ||||||||||||||||||||||||
| 464 | data->stretch = qMax(data->stretch, box->vStretch()); never executed: data->stretch = qMax(data->stretch, box->vStretch()); | 0 | ||||||||||||||||||||||||
| 465 | data->sizeHint = qMax(sizes.hint.height(), data->sizeHint); | - | ||||||||||||||||||||||||
| 466 | data->minimumSize = qMax(sizes.minS.height(), data->minimumSize); | - | ||||||||||||||||||||||||
| 467 | - | |||||||||||||||||||||||||
| 468 | qMaxExpCalc(data->maximumSize, data->expansive, data->empty, sizes.maxS.height(), | - | ||||||||||||||||||||||||
| 469 | box->expandingDirections() & Qt::Vertical, box->isEmpty()); | - | ||||||||||||||||||||||||
| 470 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 471 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 472 | - | |||||||||||||||||||||||||
| 473 | static void initEmptyMultiBox(QVector<QLayoutStruct> &chain, int start, int end) | - | ||||||||||||||||||||||||
| 474 | { | - | ||||||||||||||||||||||||
| 475 | for (int i = start; i <= end
| 0 | ||||||||||||||||||||||||
| 476 | QLayoutStruct *data = &chain[i]; | - | ||||||||||||||||||||||||
| 477 | if (data->empty
| 0 | ||||||||||||||||||||||||
| 478 | data->maximumSize = ((1<<24)-1); never executed: data->maximumSize = ((1<<24)-1); | 0 | ||||||||||||||||||||||||
| 479 | data->empty = false; | - | ||||||||||||||||||||||||
| 480 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 481 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 482 | - | |||||||||||||||||||||||||
| 483 | static void distributeMultiBox(QVector<QLayoutStruct> &chain, int start, int end, int minSize, | - | ||||||||||||||||||||||||
| 484 | int sizeHint, QVector<int> &stretchArray, int stretch) | - | ||||||||||||||||||||||||
| 485 | { | - | ||||||||||||||||||||||||
| 486 | int i; | - | ||||||||||||||||||||||||
| 487 | int w = 0; | - | ||||||||||||||||||||||||
| 488 | int wh = 0; | - | ||||||||||||||||||||||||
| 489 | int max = 0; | - | ||||||||||||||||||||||||
| 490 | - | |||||||||||||||||||||||||
| 491 | for (i = start; i <= end
| 0 | ||||||||||||||||||||||||
| 492 | QLayoutStruct *data = &chain[i]; | - | ||||||||||||||||||||||||
| 493 | w += data->minimumSize; | - | ||||||||||||||||||||||||
| 494 | wh += data->sizeHint; | - | ||||||||||||||||||||||||
| 495 | max += data->maximumSize; | - | ||||||||||||||||||||||||
| 496 | if (stretchArray.at(i) == 0
| 0 | ||||||||||||||||||||||||
| 497 | data->stretch = qMax(data->stretch, stretch); never executed: data->stretch = qMax(data->stretch, stretch); | 0 | ||||||||||||||||||||||||
| 498 | - | |||||||||||||||||||||||||
| 499 | if (i != end
| 0 | ||||||||||||||||||||||||
| 500 | int spacing = data->spacing; | - | ||||||||||||||||||||||||
| 501 | w += spacing; | - | ||||||||||||||||||||||||
| 502 | wh += spacing; | - | ||||||||||||||||||||||||
| 503 | max += spacing; | - | ||||||||||||||||||||||||
| 504 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 505 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 506 | - | |||||||||||||||||||||||||
| 507 | if (max < minSize
| 0 | ||||||||||||||||||||||||
| 508 | - | |||||||||||||||||||||||||
| 509 | - | |||||||||||||||||||||||||
| 510 | - | |||||||||||||||||||||||||
| 511 | - | |||||||||||||||||||||||||
| 512 | - | |||||||||||||||||||||||||
| 513 | - | |||||||||||||||||||||||||
| 514 | - | |||||||||||||||||||||||||
| 515 | qGeomCalc(chain, start, end - start + 1, 0, minSize); | - | ||||||||||||||||||||||||
| 516 | int pos = 0; | - | ||||||||||||||||||||||||
| 517 | for (i = start; i <= end
| 0 | ||||||||||||||||||||||||
| 518 | QLayoutStruct *data = &chain[i]; | - | ||||||||||||||||||||||||
| 519 | int nextPos = (
| 0 | ||||||||||||||||||||||||
| 520 | int realSize = nextPos - pos; | - | ||||||||||||||||||||||||
| 521 | if (i != end
| 0 | ||||||||||||||||||||||||
| 522 | realSize -= data->spacing; never executed: realSize -= data->spacing; | 0 | ||||||||||||||||||||||||
| 523 | if (data->minimumSize < realSize
| 0 | ||||||||||||||||||||||||
| 524 | data->minimumSize = realSize; never executed: data->minimumSize = realSize; | 0 | ||||||||||||||||||||||||
| 525 | if (data->maximumSize < data->minimumSize
| 0 | ||||||||||||||||||||||||
| 526 | data->maximumSize = data->minimumSize; never executed: data->maximumSize = data->minimumSize; | 0 | ||||||||||||||||||||||||
| 527 | pos = nextPos; | - | ||||||||||||||||||||||||
| 528 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 529 | } never executed: else if (w < minSizeend of block
| 0 | ||||||||||||||||||||||||
| 530 | qGeomCalc(chain, start, end - start + 1, 0, minSize); | - | ||||||||||||||||||||||||
| 531 | for (i = start; i <= end
| 0 | ||||||||||||||||||||||||
| 532 | QLayoutStruct *data = &chain[i]; | - | ||||||||||||||||||||||||
| 533 | if (data->minimumSize < data->size
| 0 | ||||||||||||||||||||||||
| 534 | data->minimumSize = data->size; never executed: data->minimumSize = data->size; | 0 | ||||||||||||||||||||||||
| 535 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 536 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 537 | - | |||||||||||||||||||||||||
| 538 | if (wh < sizeHint
| 0 | ||||||||||||||||||||||||
| 539 | qGeomCalc(chain, start, end - start + 1, 0, sizeHint); | - | ||||||||||||||||||||||||
| 540 | for (i = start; i <= end
| 0 | ||||||||||||||||||||||||
| 541 | QLayoutStruct *data = &chain[i]; | - | ||||||||||||||||||||||||
| 542 | if (data->sizeHint < data->size
| 0 | ||||||||||||||||||||||||
| 543 | data->sizeHint = data->size; never executed: data->sizeHint = data->size; | 0 | ||||||||||||||||||||||||
| 544 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 545 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 546 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 547 | - | |||||||||||||||||||||||||
| 548 | static QGridBox *&gridAt(QGridBox *grid[], int r, int c, int cc, | - | ||||||||||||||||||||||||
| 549 | Qt::Orientation orientation = Qt::Vertical) | - | ||||||||||||||||||||||||
| 550 | { | - | ||||||||||||||||||||||||
| 551 | if (orientation == Qt::Horizontal
| 0 | ||||||||||||||||||||||||
| 552 | qSwap(r, c); never executed: qSwap(r, c); | 0 | ||||||||||||||||||||||||
| 553 | return never executed: grid[(r * cc) + c];return grid[(r * cc) + c];never executed: return grid[(r * cc) + c]; | 0 | ||||||||||||||||||||||||
| 554 | } | - | ||||||||||||||||||||||||
| 555 | - | |||||||||||||||||||||||||
| 556 | void QGridLayoutPrivate::setupSpacings(QVector<QLayoutStruct> &chain, | - | ||||||||||||||||||||||||
| 557 | QGridBox *grid[], int fixedSpacing, | - | ||||||||||||||||||||||||
| 558 | Qt::Orientation orientation) | - | ||||||||||||||||||||||||
| 559 | { | - | ||||||||||||||||||||||||
| 560 | QGridLayout * const q = q_func(); | - | ||||||||||||||||||||||||
| 561 | int numRows = rr; | - | ||||||||||||||||||||||||
| 562 | int numColumns = cc; | - | ||||||||||||||||||||||||
| 563 | - | |||||||||||||||||||||||||
| 564 | if (orientation == Qt::Horizontal
| 0 | ||||||||||||||||||||||||
| 565 | qSwap(numRows, numColumns); | - | ||||||||||||||||||||||||
| 566 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 567 | - | |||||||||||||||||||||||||
| 568 | QStyle *style = 0; | - | ||||||||||||||||||||||||
| 569 | if (fixedSpacing < 0
| 0 | ||||||||||||||||||||||||
| 570 | if (QWidget *parentWidget = q->parentWidget()
| 0 | ||||||||||||||||||||||||
| 571 | style = parentWidget->style(); never executed: style = parentWidget->style(); | 0 | ||||||||||||||||||||||||
| 572 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 573 | - | |||||||||||||||||||||||||
| 574 | for (int c = 0; c < numColumns
| 0 | ||||||||||||||||||||||||
| 575 | QGridBox *previousBox = 0; | - | ||||||||||||||||||||||||
| 576 | int previousRow = -1; | - | ||||||||||||||||||||||||
| 577 | - | |||||||||||||||||||||||||
| 578 | for (int r = 0; r < numRows
| 0 | ||||||||||||||||||||||||
| 579 | if (chain.at(r).empty
| 0 | ||||||||||||||||||||||||
| 580 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
| 581 | - | |||||||||||||||||||||||||
| 582 | QGridBox *box = gridAt(grid, r, c, cc, orientation); | - | ||||||||||||||||||||||||
| 583 | if (previousRow != -1
| 0 | ||||||||||||||||||||||||
| 584 | int spacing = fixedSpacing; | - | ||||||||||||||||||||||||
| 585 | if (spacing < 0
| 0 | ||||||||||||||||||||||||
| 586 | QSizePolicy::ControlTypes controlTypes1 = QSizePolicy::DefaultType; | - | ||||||||||||||||||||||||
| 587 | QSizePolicy::ControlTypes controlTypes2 = QSizePolicy::DefaultType; | - | ||||||||||||||||||||||||
| 588 | if (previousBox
| 0 | ||||||||||||||||||||||||
| 589 | controlTypes1 = previousBox->item()->controlTypes(); never executed: controlTypes1 = previousBox->item()->controlTypes(); | 0 | ||||||||||||||||||||||||
| 590 | if (box
| 0 | ||||||||||||||||||||||||
| 591 | controlTypes2 = box->item()->controlTypes(); never executed: controlTypes2 = box->item()->controlTypes(); | 0 | ||||||||||||||||||||||||
| 592 | - | |||||||||||||||||||||||||
| 593 | if ((orientation == Qt::Horizontal
| 0 | ||||||||||||||||||||||||
| 594 | || (orientation == Qt::Vertical
| 0 | ||||||||||||||||||||||||
| 595 | qSwap(controlTypes1, controlTypes2); never executed: qSwap(controlTypes1, controlTypes2); | 0 | ||||||||||||||||||||||||
| 596 | - | |||||||||||||||||||||||||
| 597 | if (style
| 0 | ||||||||||||||||||||||||
| 598 | spacing = style->combinedLayoutSpacing(controlTypes1, controlTypes2, never executed: spacing = style->combinedLayoutSpacing(controlTypes1, controlTypes2, orientation, 0, q->parentWidget()); | 0 | ||||||||||||||||||||||||
| 599 | orientation, 0, q->parentWidget()); never executed: spacing = style->combinedLayoutSpacing(controlTypes1, controlTypes2, orientation, 0, q->parentWidget()); | 0 | ||||||||||||||||||||||||
| 600 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 601 | if (orientation == Qt::Vertical
| 0 | ||||||||||||||||||||||||
| 602 | QGridBox *sibling = vReversed
| 0 | ||||||||||||||||||||||||
| 603 | if (sibling
| 0 | ||||||||||||||||||||||||
| 604 | QWidget *wid = sibling->item()->widget(); | - | ||||||||||||||||||||||||
| 605 | if (wid
| 0 | ||||||||||||||||||||||||
| 606 | spacing = qMax(spacing, sibling->item()->geometry().top() - wid->geometry().top() ); never executed: spacing = qMax(spacing, sibling->item()->geometry().top() - wid->geometry().top() ); | 0 | ||||||||||||||||||||||||
| 607 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 608 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 609 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 610 | - | |||||||||||||||||||||||||
| 611 | if (spacing > chain.at(previousRow).spacing
| 0 | ||||||||||||||||||||||||
| 612 | chain[previousRow].spacing = spacing; never executed: chain[previousRow].spacing = spacing; | 0 | ||||||||||||||||||||||||
| 613 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 614 | - | |||||||||||||||||||||||||
| 615 | previousBox = box; | - | ||||||||||||||||||||||||
| 616 | previousRow = r; | - | ||||||||||||||||||||||||
| 617 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 618 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 619 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 620 | - | |||||||||||||||||||||||||
| 621 | - | |||||||||||||||||||||||||
| 622 | - | |||||||||||||||||||||||||
| 623 | void QGridLayoutPrivate::setupLayoutData(int hSpacing, int vSpacing) | - | ||||||||||||||||||||||||
| 624 | { | - | ||||||||||||||||||||||||
| 625 | QGridLayout * const q = q_func(); | - | ||||||||||||||||||||||||
| 626 | - | |||||||||||||||||||||||||
| 627 | - | |||||||||||||||||||||||||
| 628 | if (!needRecalc
| 0 | ||||||||||||||||||||||||
| 629 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 630 | - | |||||||||||||||||||||||||
| 631 | has_hfw = false; | - | ||||||||||||||||||||||||
| 632 | int i; | - | ||||||||||||||||||||||||
| 633 | - | |||||||||||||||||||||||||
| 634 | for (i = 0; i < rr
| 0 | ||||||||||||||||||||||||
| 635 | rowData[i].init(rStretch.at(i), rMinHeights.at(i)); | - | ||||||||||||||||||||||||
| 636 | rowData[i].maximumSize = rStretch.at(i)
| 0 | ||||||||||||||||||||||||
| 637 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 638 | for (i = 0; i < cc
| 0 | ||||||||||||||||||||||||
| 639 | colData[i].init(cStretch.at(i), cMinWidths.at(i)); | - | ||||||||||||||||||||||||
| 640 | colData[i].maximumSize = cStretch.at(i)
| 0 | ||||||||||||||||||||||||
| 641 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 642 | - | |||||||||||||||||||||||||
| 643 | int n = things.size(); | - | ||||||||||||||||||||||||
| 644 | QVarLengthArray<QGridLayoutSizeTriple> sizes(n); | - | ||||||||||||||||||||||||
| 645 | - | |||||||||||||||||||||||||
| 646 | bool has_multi = false; | - | ||||||||||||||||||||||||
| 647 | - | |||||||||||||||||||||||||
| 648 | - | |||||||||||||||||||||||||
| 649 | - | |||||||||||||||||||||||||
| 650 | - | |||||||||||||||||||||||||
| 651 | - | |||||||||||||||||||||||||
| 652 | QVarLengthArray<QGridBox *> grid(rr * cc); | - | ||||||||||||||||||||||||
| 653 | memset(grid.data(), 0, rr * cc * sizeof(QGridBox *)); | - | ||||||||||||||||||||||||
| 654 | - | |||||||||||||||||||||||||
| 655 | - | |||||||||||||||||||||||||
| 656 | - | |||||||||||||||||||||||||
| 657 | - | |||||||||||||||||||||||||
| 658 | - | |||||||||||||||||||||||||
| 659 | for (i = 0; i < n
| 0 | ||||||||||||||||||||||||
| 660 | QGridBox * const box = things.at(i); | - | ||||||||||||||||||||||||
| 661 | sizes[i].minS = box->minimumSize(); | - | ||||||||||||||||||||||||
| 662 | sizes[i].hint = box->sizeHint(); | - | ||||||||||||||||||||||||
| 663 | sizes[i].maxS = box->maximumSize(); | - | ||||||||||||||||||||||||
| 664 | - | |||||||||||||||||||||||||
| 665 | if (box->hasHeightForWidth()
| 0 | ||||||||||||||||||||||||
| 666 | has_hfw = true; never executed: has_hfw = true; | 0 | ||||||||||||||||||||||||
| 667 | - | |||||||||||||||||||||||||
| 668 | if (box->row == box->toRow(rr)
| 0 | ||||||||||||||||||||||||
| 669 | addData(box, sizes[i], true, false); | - | ||||||||||||||||||||||||
| 670 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 671 | initEmptyMultiBox(rowData, box->row, box->toRow(rr)); | - | ||||||||||||||||||||||||
| 672 | has_multi = true; | - | ||||||||||||||||||||||||
| 673 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 674 | - | |||||||||||||||||||||||||
| 675 | if (box->col == box->toCol(cc)
| 0 | ||||||||||||||||||||||||
| 676 | addData(box, sizes[i], false, true); | - | ||||||||||||||||||||||||
| 677 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 678 | initEmptyMultiBox(colData, box->col, box->toCol(cc)); | - | ||||||||||||||||||||||||
| 679 | has_multi = true; | - | ||||||||||||||||||||||||
| 680 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 681 | - | |||||||||||||||||||||||||
| 682 | for (int r = box->row; r <= box->toRow(rr)
| 0 | ||||||||||||||||||||||||
| 683 | for (int c = box->col; c <= box->toCol(cc)
| 0 | ||||||||||||||||||||||||
| 684 | gridAt(grid.data(), r, c, cc) = box; | - | ||||||||||||||||||||||||
| 685 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 686 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 687 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 688 | - | |||||||||||||||||||||||||
| 689 | setupSpacings(colData, grid.data(), hSpacing, Qt::Horizontal); | - | ||||||||||||||||||||||||
| 690 | setupSpacings(rowData, grid.data(), vSpacing, Qt::Vertical); | - | ||||||||||||||||||||||||
| 691 | - | |||||||||||||||||||||||||
| 692 | - | |||||||||||||||||||||||||
| 693 | - | |||||||||||||||||||||||||
| 694 | - | |||||||||||||||||||||||||
| 695 | - | |||||||||||||||||||||||||
| 696 | - | |||||||||||||||||||||||||
| 697 | if (has_multi
| 0 | ||||||||||||||||||||||||
| 698 | for (i = 0; i < n
| 0 | ||||||||||||||||||||||||
| 699 | QGridBox * const box = things.at(i); | - | ||||||||||||||||||||||||
| 700 | - | |||||||||||||||||||||||||
| 701 | if (box->row != box->toRow(rr)
| 0 | ||||||||||||||||||||||||
| 702 | distributeMultiBox(rowData, box->row, box->toRow(rr), sizes[i].minS.height(), never executed: distributeMultiBox(rowData, box->row, box->toRow(rr), sizes[i].minS.height(), sizes[i].hint.height(), rStretch, box->vStretch()); | 0 | ||||||||||||||||||||||||
| 703 | sizes[i].hint.height(), rStretch, box->vStretch()); never executed: distributeMultiBox(rowData, box->row, box->toRow(rr), sizes[i].minS.height(), sizes[i].hint.height(), rStretch, box->vStretch()); | 0 | ||||||||||||||||||||||||
| 704 | if (box->col != box->toCol(cc)
| 0 | ||||||||||||||||||||||||
| 705 | distributeMultiBox(colData, box->col, box->toCol(cc), sizes[i].minS.width(), never executed: distributeMultiBox(colData, box->col, box->toCol(cc), sizes[i].minS.width(), sizes[i].hint.width(), cStretch, box->hStretch()); | 0 | ||||||||||||||||||||||||
| 706 | sizes[i].hint.width(), cStretch, box->hStretch()); never executed: distributeMultiBox(colData, box->col, box->toCol(cc), sizes[i].minS.width(), sizes[i].hint.width(), cStretch, box->hStretch()); | 0 | ||||||||||||||||||||||||
| 707 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 708 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 709 | - | |||||||||||||||||||||||||
| 710 | for (i = 0; i < rr
| 0 | ||||||||||||||||||||||||
| 711 | rowData[i].expansive = rowData.at(i).expansive
never executed: rowData[i].expansive = rowData.at(i).expansive || rowData.at(i).stretch > 0; | 0 | ||||||||||||||||||||||||
| 712 | for (i = 0; i < cc
| 0 | ||||||||||||||||||||||||
| 713 | colData[i].expansive = colData.at(i).expansive
never executed: colData[i].expansive = colData.at(i).expansive || colData.at(i).stretch > 0; | 0 | ||||||||||||||||||||||||
| 714 | - | |||||||||||||||||||||||||
| 715 | q->getContentsMargins(&leftMargin, &topMargin, &rightMargin, &bottomMargin); | - | ||||||||||||||||||||||||
| 716 | - | |||||||||||||||||||||||||
| 717 | needRecalc = false; | - | ||||||||||||||||||||||||
| 718 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 719 | - | |||||||||||||||||||||||||
| 720 | void QGridLayoutPrivate::addHfwData(QGridBox *box, int width) | - | ||||||||||||||||||||||||
| 721 | { | - | ||||||||||||||||||||||||
| 722 | QVector<QLayoutStruct> &rData = *hfwData; | - | ||||||||||||||||||||||||
| 723 | if (box->hasHeightForWidth()
| 0 | ||||||||||||||||||||||||
| 724 | int hint = box->heightForWidth(width); | - | ||||||||||||||||||||||||
| 725 | rData[box->row].sizeHint = qMax(hint, rData.at(box->row).sizeHint); | - | ||||||||||||||||||||||||
| 726 | rData[box->row].minimumSize = qMax(hint, rData.at(box->row).minimumSize); | - | ||||||||||||||||||||||||
| 727 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 728 | QSize hint = box->sizeHint(); | - | ||||||||||||||||||||||||
| 729 | QSize minS = box->minimumSize(); | - | ||||||||||||||||||||||||
| 730 | rData[box->row].sizeHint = qMax(hint.height(), rData.at(box->row).sizeHint); | - | ||||||||||||||||||||||||
| 731 | rData[box->row].minimumSize = qMax(minS.height(), rData.at(box->row).minimumSize); | - | ||||||||||||||||||||||||
| 732 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 733 | } | - | ||||||||||||||||||||||||
| 734 | - | |||||||||||||||||||||||||
| 735 | - | |||||||||||||||||||||||||
| 736 | - | |||||||||||||||||||||||||
| 737 | - | |||||||||||||||||||||||||
| 738 | - | |||||||||||||||||||||||||
| 739 | - | |||||||||||||||||||||||||
| 740 | void QGridLayoutPrivate::setupHfwLayoutData() | - | ||||||||||||||||||||||||
| 741 | { | - | ||||||||||||||||||||||||
| 742 | QVector<QLayoutStruct> &rData = *hfwData; | - | ||||||||||||||||||||||||
| 743 | for (int i = 0; i < rr
| 0 | ||||||||||||||||||||||||
| 744 | rData[i] = rowData.at(i); | - | ||||||||||||||||||||||||
| 745 | rData[i].minimumSize = rData[i].sizeHint = rMinHeights.at(i); | - | ||||||||||||||||||||||||
| 746 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 747 | - | |||||||||||||||||||||||||
| 748 | for (int pass = 0; pass < 2
| 0 | ||||||||||||||||||||||||
| 749 | for (int i = 0; i < things.size()
| 0 | ||||||||||||||||||||||||
| 750 | QGridBox *box = things.at(i); | - | ||||||||||||||||||||||||
| 751 | int r1 = box->row; | - | ||||||||||||||||||||||||
| 752 | int c1 = box->col; | - | ||||||||||||||||||||||||
| 753 | int r2 = box->toRow(rr); | - | ||||||||||||||||||||||||
| 754 | int c2 = box->toCol(cc); | - | ||||||||||||||||||||||||
| 755 | int w = colData.at(c2).pos + colData.at(c2).size - colData.at(c1).pos; | - | ||||||||||||||||||||||||
| 756 | - | |||||||||||||||||||||||||
| 757 | if (r1 == r2
| 0 | ||||||||||||||||||||||||
| 758 | if (pass == 0
| 0 | ||||||||||||||||||||||||
| 759 | addHfwData(box, w); never executed: addHfwData(box, w); | 0 | ||||||||||||||||||||||||
| 760 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 761 | if (pass == 0
| 0 | ||||||||||||||||||||||||
| 762 | initEmptyMultiBox(rData, r1, r2); | - | ||||||||||||||||||||||||
| 763 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 764 | QSize hint = box->sizeHint(); | - | ||||||||||||||||||||||||
| 765 | QSize min = box->minimumSize(); | - | ||||||||||||||||||||||||
| 766 | if (box->hasHeightForWidth()
| 0 | ||||||||||||||||||||||||
| 767 | int hfwh = box->heightForWidth(w); | - | ||||||||||||||||||||||||
| 768 | if (hfwh > hint.height()
| 0 | ||||||||||||||||||||||||
| 769 | hint.setHeight(hfwh); never executed: hint.setHeight(hfwh); | 0 | ||||||||||||||||||||||||
| 770 | if (hfwh > min.height()
| 0 | ||||||||||||||||||||||||
| 771 | min.setHeight(hfwh); never executed: min.setHeight(hfwh); | 0 | ||||||||||||||||||||||||
| 772 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 773 | distributeMultiBox(rData, r1, r2, min.height(), hint.height(), | - | ||||||||||||||||||||||||
| 774 | rStretch, box->vStretch()); | - | ||||||||||||||||||||||||
| 775 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 776 | } | - | ||||||||||||||||||||||||
| 777 | } | - | ||||||||||||||||||||||||
| 778 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 779 | for (int i = 0; i < rr
| 0 | ||||||||||||||||||||||||
| 780 | rData[i].expansive = rData.at(i).expansive
never executed: rData[i].expansive = rData.at(i).expansive || rData.at(i).stretch > 0; | 0 | ||||||||||||||||||||||||
| 781 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 782 | - | |||||||||||||||||||||||||
| 783 | void QGridLayoutPrivate::distribute(QRect r, int hSpacing, int vSpacing) | - | ||||||||||||||||||||||||
| 784 | { | - | ||||||||||||||||||||||||
| 785 | QGridLayout * const q = q_func(); | - | ||||||||||||||||||||||||
| 786 | bool visualHReversed = hReversed; | - | ||||||||||||||||||||||||
| 787 | QWidget *parent = q->parentWidget(); | - | ||||||||||||||||||||||||
| 788 | if (parent
| 0 | ||||||||||||||||||||||||
| 789 | visualHReversed = !visualHReversed; never executed: visualHReversed = !visualHReversed; | 0 | ||||||||||||||||||||||||
| 790 | - | |||||||||||||||||||||||||
| 791 | setupLayoutData(hSpacing, vSpacing); | - | ||||||||||||||||||||||||
| 792 | - | |||||||||||||||||||||||||
| 793 | int left, top, right, bottom; | - | ||||||||||||||||||||||||
| 794 | effectiveMargins(&left, &top, &right, &bottom); | - | ||||||||||||||||||||||||
| 795 | r.adjust(+left, +top, -right, -bottom); | - | ||||||||||||||||||||||||
| 796 | - | |||||||||||||||||||||||||
| 797 | qGeomCalc(colData, 0, cc, r.x(), r.width()); | - | ||||||||||||||||||||||||
| 798 | QVector<QLayoutStruct> *rDataPtr; | - | ||||||||||||||||||||||||
| 799 | if (has_hfw
| 0 | ||||||||||||||||||||||||
| 800 | recalcHFW(r.width()); | - | ||||||||||||||||||||||||
| 801 | qGeomCalc(*hfwData, 0, rr, r.y(), r.height()); | - | ||||||||||||||||||||||||
| 802 | rDataPtr = hfwData; | - | ||||||||||||||||||||||||
| 803 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 804 | qGeomCalc(rowData, 0, rr, r.y(), r.height()); | - | ||||||||||||||||||||||||
| 805 | rDataPtr = &rowData; | - | ||||||||||||||||||||||||
| 806 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 807 | QVector<QLayoutStruct> &rData = *rDataPtr; | - | ||||||||||||||||||||||||
| 808 | int i; | - | ||||||||||||||||||||||||
| 809 | - | |||||||||||||||||||||||||
| 810 | bool reverse = ((
| 0 | ||||||||||||||||||||||||
| 811 | && ((
| 0 | ||||||||||||||||||||||||
| 812 | int n = things.size(); | - | ||||||||||||||||||||||||
| 813 | for (i = 0; i < n
| 0 | ||||||||||||||||||||||||
| 814 | QGridBox *box = things.at(reverse ? n-i-1 : i); | - | ||||||||||||||||||||||||
| 815 | int r2 = box->toRow(rr); | - | ||||||||||||||||||||||||
| 816 | int c2 = box->toCol(cc); | - | ||||||||||||||||||||||||
| 817 | - | |||||||||||||||||||||||||
| 818 | int x = colData.at(box->col).pos; | - | ||||||||||||||||||||||||
| 819 | int y = rData.at(box->row).pos; | - | ||||||||||||||||||||||||
| 820 | int x2p = colData.at(c2).pos + colData.at(c2).size; | - | ||||||||||||||||||||||||
| 821 | int y2p = rData.at(r2).pos + rData.at(r2).size; | - | ||||||||||||||||||||||||
| 822 | int w = x2p - x; | - | ||||||||||||||||||||||||
| 823 | int h = y2p - y; | - | ||||||||||||||||||||||||
| 824 | - | |||||||||||||||||||||||||
| 825 | if (visualHReversed
| 0 | ||||||||||||||||||||||||
| 826 | x = r.left() + r.right() - x - w + 1; never executed: x = r.left() + r.right() - x - w + 1; | 0 | ||||||||||||||||||||||||
| 827 | if (vReversed
| 0 | ||||||||||||||||||||||||
| 828 | y = r.top() + r.bottom() - y - h + 1; never executed: y = r.top() + r.bottom() - y - h + 1; | 0 | ||||||||||||||||||||||||
| 829 | - | |||||||||||||||||||||||||
| 830 | box->setGeometry(QRect(x, y, w, h)); | - | ||||||||||||||||||||||||
| 831 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 832 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 833 | - | |||||||||||||||||||||||||
| 834 | QRect QGridLayoutPrivate::cellRect(int row, int col) const | - | ||||||||||||||||||||||||
| 835 | { | - | ||||||||||||||||||||||||
| 836 | if (row < 0
| 0 | ||||||||||||||||||||||||
| 837 | return never executed: QRect();return QRect();never executed: return QRect(); | 0 | ||||||||||||||||||||||||
| 838 | - | |||||||||||||||||||||||||
| 839 | const QVector<QLayoutStruct> *rDataPtr; | - | ||||||||||||||||||||||||
| 840 | if (has_hfw
| 0 | ||||||||||||||||||||||||
| 841 | rDataPtr = hfwData; never executed: rDataPtr = hfwData; | 0 | ||||||||||||||||||||||||
| 842 | else | - | ||||||||||||||||||||||||
| 843 | rDataPtr = &rowData; never executed: rDataPtr = &rowData; | 0 | ||||||||||||||||||||||||
| 844 | return never executed: QRect(colData.at(col).pos, rDataPtr->at(row).pos,return QRect(colData.at(col).pos, rDataPtr->at(row).pos, colData.at(col).size, rDataPtr->at(row).size);never executed: return QRect(colData.at(col).pos, rDataPtr->at(row).pos, colData.at(col).size, rDataPtr->at(row).size); | 0 | ||||||||||||||||||||||||
| 845 | colData.at(col).size, rDataPtr->at(row).size); never executed: return QRect(colData.at(col).pos, rDataPtr->at(row).pos, colData.at(col).size, rDataPtr->at(row).size); | 0 | ||||||||||||||||||||||||
| 846 | } | - | ||||||||||||||||||||||||
| 847 | QGridLayout::QGridLayout(QWidget *parent) | - | ||||||||||||||||||||||||
| 848 | : QLayout(*new QGridLayoutPrivate, 0, parent) | - | ||||||||||||||||||||||||
| 849 | { | - | ||||||||||||||||||||||||
| 850 | QGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 851 | d->expand(1, 1); | - | ||||||||||||||||||||||||
| 852 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 853 | QGridLayout::QGridLayout() | - | ||||||||||||||||||||||||
| 854 | : QLayout(*new QGridLayoutPrivate, 0, 0) | - | ||||||||||||||||||||||||
| 855 | { | - | ||||||||||||||||||||||||
| 856 | QGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 857 | d->expand(1, 1); | - | ||||||||||||||||||||||||
| 858 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 859 | void QGridLayout::setDefaultPositioning(int n, Qt::Orientation orient) | - | ||||||||||||||||||||||||
| 860 | { | - | ||||||||||||||||||||||||
| 861 | QGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 862 | if (orient == Qt::Horizontal
| 0 | ||||||||||||||||||||||||
| 863 | d->expand(1, n); | - | ||||||||||||||||||||||||
| 864 | d->addVertical = false; | - | ||||||||||||||||||||||||
| 865 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 866 | d->expand(n,1); | - | ||||||||||||||||||||||||
| 867 | d->addVertical = true; | - | ||||||||||||||||||||||||
| 868 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 869 | } | - | ||||||||||||||||||||||||
| 870 | QGridLayout::~QGridLayout() | - | ||||||||||||||||||||||||
| 871 | { | - | ||||||||||||||||||||||||
| 872 | QGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 873 | d->deleteAll(); | - | ||||||||||||||||||||||||
| 874 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 875 | void QGridLayout::setHorizontalSpacing(int spacing) | - | ||||||||||||||||||||||||
| 876 | { | - | ||||||||||||||||||||||||
| 877 | QGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 878 | d->horizontalSpacing = spacing; | - | ||||||||||||||||||||||||
| 879 | invalidate(); | - | ||||||||||||||||||||||||
| 880 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 881 | - | |||||||||||||||||||||||||
| 882 | int QGridLayout::horizontalSpacing() const | - | ||||||||||||||||||||||||
| 883 | { | - | ||||||||||||||||||||||||
| 884 | const QGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 885 | if (d->horizontalSpacing >= 0
| 0 | ||||||||||||||||||||||||
| 886 | return never executed: d->horizontalSpacing;return d->horizontalSpacing;never executed: return d->horizontalSpacing; | 0 | ||||||||||||||||||||||||
| 887 | } else { | - | ||||||||||||||||||||||||
| 888 | return never executed: qSmartSpacing(this, QStyle::PM_LayoutHorizontalSpacing);return qSmartSpacing(this, QStyle::PM_LayoutHorizontalSpacing);never executed: return qSmartSpacing(this, QStyle::PM_LayoutHorizontalSpacing); | 0 | ||||||||||||||||||||||||
| 889 | } | - | ||||||||||||||||||||||||
| 890 | } | - | ||||||||||||||||||||||||
| 891 | void QGridLayout::setVerticalSpacing(int spacing) | - | ||||||||||||||||||||||||
| 892 | { | - | ||||||||||||||||||||||||
| 893 | QGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 894 | d->verticalSpacing = spacing; | - | ||||||||||||||||||||||||
| 895 | invalidate(); | - | ||||||||||||||||||||||||
| 896 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 897 | - | |||||||||||||||||||||||||
| 898 | int QGridLayout::verticalSpacing() const | - | ||||||||||||||||||||||||
| 899 | { | - | ||||||||||||||||||||||||
| 900 | const QGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 901 | if (d->verticalSpacing >= 0
| 0 | ||||||||||||||||||||||||
| 902 | return never executed: d->verticalSpacing;return d->verticalSpacing;never executed: return d->verticalSpacing; | 0 | ||||||||||||||||||||||||
| 903 | } else { | - | ||||||||||||||||||||||||
| 904 | return never executed: qSmartSpacing(this, QStyle::PM_LayoutVerticalSpacing);return qSmartSpacing(this, QStyle::PM_LayoutVerticalSpacing);never executed: return qSmartSpacing(this, QStyle::PM_LayoutVerticalSpacing); | 0 | ||||||||||||||||||||||||
| 905 | } | - | ||||||||||||||||||||||||
| 906 | } | - | ||||||||||||||||||||||||
| 907 | - | |||||||||||||||||||||||||
| 908 | - | |||||||||||||||||||||||||
| 909 | - | |||||||||||||||||||||||||
| 910 | - | |||||||||||||||||||||||||
| 911 | - | |||||||||||||||||||||||||
| 912 | - | |||||||||||||||||||||||||
| 913 | - | |||||||||||||||||||||||||
| 914 | void QGridLayout::setSpacing(int spacing) | - | ||||||||||||||||||||||||
| 915 | { | - | ||||||||||||||||||||||||
| 916 | QGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 917 | d->horizontalSpacing = d->verticalSpacing = spacing; | - | ||||||||||||||||||||||||
| 918 | invalidate(); | - | ||||||||||||||||||||||||
| 919 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 920 | - | |||||||||||||||||||||||||
| 921 | - | |||||||||||||||||||||||||
| 922 | - | |||||||||||||||||||||||||
| 923 | - | |||||||||||||||||||||||||
| 924 | - | |||||||||||||||||||||||||
| 925 | - | |||||||||||||||||||||||||
| 926 | - | |||||||||||||||||||||||||
| 927 | int QGridLayout::spacing() const | - | ||||||||||||||||||||||||
| 928 | { | - | ||||||||||||||||||||||||
| 929 | int hSpacing = horizontalSpacing(); | - | ||||||||||||||||||||||||
| 930 | if (hSpacing == verticalSpacing()
| 0 | ||||||||||||||||||||||||
| 931 | return never executed: hSpacing;return hSpacing;never executed: return hSpacing; | 0 | ||||||||||||||||||||||||
| 932 | } else { | - | ||||||||||||||||||||||||
| 933 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||||||||
| 934 | } | - | ||||||||||||||||||||||||
| 935 | } | - | ||||||||||||||||||||||||
| 936 | - | |||||||||||||||||||||||||
| 937 | - | |||||||||||||||||||||||||
| 938 | - | |||||||||||||||||||||||||
| 939 | - | |||||||||||||||||||||||||
| 940 | int QGridLayout::rowCount() const | - | ||||||||||||||||||||||||
| 941 | { | - | ||||||||||||||||||||||||
| 942 | const QGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 943 | return never executed: d->numRows();return d->numRows();never executed: return d->numRows(); | 0 | ||||||||||||||||||||||||
| 944 | } | - | ||||||||||||||||||||||||
| 945 | - | |||||||||||||||||||||||||
| 946 | - | |||||||||||||||||||||||||
| 947 | - | |||||||||||||||||||||||||
| 948 | - | |||||||||||||||||||||||||
| 949 | int QGridLayout::columnCount() const | - | ||||||||||||||||||||||||
| 950 | { | - | ||||||||||||||||||||||||
| 951 | const QGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 952 | return never executed: d->numCols();return d->numCols();never executed: return d->numCols(); | 0 | ||||||||||||||||||||||||
| 953 | } | - | ||||||||||||||||||||||||
| 954 | - | |||||||||||||||||||||||||
| 955 | - | |||||||||||||||||||||||||
| 956 | - | |||||||||||||||||||||||||
| 957 | - | |||||||||||||||||||||||||
| 958 | QSize QGridLayout::sizeHint() const | - | ||||||||||||||||||||||||
| 959 | { | - | ||||||||||||||||||||||||
| 960 | const QGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 961 | QSize result(d->sizeHint(horizontalSpacing(), verticalSpacing())); | - | ||||||||||||||||||||||||
| 962 | int left, top, right, bottom; | - | ||||||||||||||||||||||||
| 963 | d->effectiveMargins(&left, &top, &right, &bottom); | - | ||||||||||||||||||||||||
| 964 | result += QSize(left + right, top + bottom); | - | ||||||||||||||||||||||||
| 965 | return never executed: result;return result;never executed: return result; | 0 | ||||||||||||||||||||||||
| 966 | } | - | ||||||||||||||||||||||||
| 967 | - | |||||||||||||||||||||||||
| 968 | - | |||||||||||||||||||||||||
| 969 | - | |||||||||||||||||||||||||
| 970 | - | |||||||||||||||||||||||||
| 971 | QSize QGridLayout::minimumSize() const | - | ||||||||||||||||||||||||
| 972 | { | - | ||||||||||||||||||||||||
| 973 | const QGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 974 | QSize result(d->minimumSize(horizontalSpacing(), verticalSpacing())); | - | ||||||||||||||||||||||||
| 975 | int left, top, right, bottom; | - | ||||||||||||||||||||||||
| 976 | d->effectiveMargins(&left, &top, &right, &bottom); | - | ||||||||||||||||||||||||
| 977 | result += QSize(left + right, top + bottom); | - | ||||||||||||||||||||||||
| 978 | return never executed: result;return result;never executed: return result; | 0 | ||||||||||||||||||||||||
| 979 | } | - | ||||||||||||||||||||||||
| 980 | - | |||||||||||||||||||||||||
| 981 | - | |||||||||||||||||||||||||
| 982 | - | |||||||||||||||||||||||||
| 983 | - | |||||||||||||||||||||||||
| 984 | QSize QGridLayout::maximumSize() const | - | ||||||||||||||||||||||||
| 985 | { | - | ||||||||||||||||||||||||
| 986 | const QGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 987 | - | |||||||||||||||||||||||||
| 988 | QSize s = d->maximumSize(horizontalSpacing(), verticalSpacing()); | - | ||||||||||||||||||||||||
| 989 | int left, top, right, bottom; | - | ||||||||||||||||||||||||
| 990 | d->effectiveMargins(&left, &top, &right, &bottom); | - | ||||||||||||||||||||||||
| 991 | s += QSize(left + right, top + bottom); | - | ||||||||||||||||||||||||
| 992 | s = s.boundedTo(QSize(QLAYOUTSIZE_MAX, QLAYOUTSIZE_MAX)); | - | ||||||||||||||||||||||||
| 993 | if (alignment() & Qt::AlignHorizontal_Mask
| 0 | ||||||||||||||||||||||||
| 994 | s.setWidth(QLAYOUTSIZE_MAX); never executed: s.setWidth(QLAYOUTSIZE_MAX); | 0 | ||||||||||||||||||||||||
| 995 | if (alignment() & Qt::AlignVertical_Mask
| 0 | ||||||||||||||||||||||||
| 996 | s.setHeight(QLAYOUTSIZE_MAX); never executed: s.setHeight(QLAYOUTSIZE_MAX); | 0 | ||||||||||||||||||||||||
| 997 | return never executed: s;return s;never executed: return s; | 0 | ||||||||||||||||||||||||
| 998 | } | - | ||||||||||||||||||||||||
| 999 | - | |||||||||||||||||||||||||
| 1000 | - | |||||||||||||||||||||||||
| 1001 | - | |||||||||||||||||||||||||
| 1002 | - | |||||||||||||||||||||||||
| 1003 | bool QGridLayout::hasHeightForWidth() const | - | ||||||||||||||||||||||||
| 1004 | { | - | ||||||||||||||||||||||||
| 1005 | return never executed: const_cast<QGridLayout*>(this)->d_func()->hasHeightForWidth(horizontalSpacing(), verticalSpacing());return const_cast<QGridLayout*>(this)->d_func()->hasHeightForWidth(horizontalSpacing(), verticalSpacing());never executed: return const_cast<QGridLayout*>(this)->d_func()->hasHeightForWidth(horizontalSpacing(), verticalSpacing()); | 0 | ||||||||||||||||||||||||
| 1006 | } | - | ||||||||||||||||||||||||
| 1007 | - | |||||||||||||||||||||||||
| 1008 | - | |||||||||||||||||||||||||
| 1009 | - | |||||||||||||||||||||||||
| 1010 | - | |||||||||||||||||||||||||
| 1011 | int QGridLayout::heightForWidth(int w) const | - | ||||||||||||||||||||||||
| 1012 | { | - | ||||||||||||||||||||||||
| 1013 | const QGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1014 | QGridLayoutPrivate *dat = const_cast<QGridLayoutPrivate *>(d); | - | ||||||||||||||||||||||||
| 1015 | return never executed: dat->heightForWidth(w, horizontalSpacing(), verticalSpacing());return dat->heightForWidth(w, horizontalSpacing(), verticalSpacing());never executed: return dat->heightForWidth(w, horizontalSpacing(), verticalSpacing()); | 0 | ||||||||||||||||||||||||
| 1016 | } | - | ||||||||||||||||||||||||
| 1017 | - | |||||||||||||||||||||||||
| 1018 | - | |||||||||||||||||||||||||
| 1019 | - | |||||||||||||||||||||||||
| 1020 | - | |||||||||||||||||||||||||
| 1021 | int QGridLayout::minimumHeightForWidth(int w) const | - | ||||||||||||||||||||||||
| 1022 | { | - | ||||||||||||||||||||||||
| 1023 | const QGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1024 | QGridLayoutPrivate *dat = const_cast<QGridLayoutPrivate *>(d); | - | ||||||||||||||||||||||||
| 1025 | return never executed: dat->minimumHeightForWidth(w, horizontalSpacing(), verticalSpacing());return dat->minimumHeightForWidth(w, horizontalSpacing(), verticalSpacing());never executed: return dat->minimumHeightForWidth(w, horizontalSpacing(), verticalSpacing()); | 0 | ||||||||||||||||||||||||
| 1026 | } | - | ||||||||||||||||||||||||
| 1027 | - | |||||||||||||||||||||||||
| 1028 | - | |||||||||||||||||||||||||
| 1029 | - | |||||||||||||||||||||||||
| 1030 | - | |||||||||||||||||||||||||
| 1031 | int QGridLayout::count() const | - | ||||||||||||||||||||||||
| 1032 | { | - | ||||||||||||||||||||||||
| 1033 | const QGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1034 | return never executed: d->count();return d->count();never executed: return d->count(); | 0 | ||||||||||||||||||||||||
| 1035 | } | - | ||||||||||||||||||||||||
| 1036 | - | |||||||||||||||||||||||||
| 1037 | - | |||||||||||||||||||||||||
| 1038 | - | |||||||||||||||||||||||||
| 1039 | - | |||||||||||||||||||||||||
| 1040 | - | |||||||||||||||||||||||||
| 1041 | QLayoutItem *QGridLayout::itemAt(int index) const | - | ||||||||||||||||||||||||
| 1042 | { | - | ||||||||||||||||||||||||
| 1043 | const QGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1044 | return never executed: d->itemAt(index);return d->itemAt(index);never executed: return d->itemAt(index); | 0 | ||||||||||||||||||||||||
| 1045 | } | - | ||||||||||||||||||||||||
| 1046 | QLayoutItem *QGridLayout::itemAtPosition(int row, int column) const | - | ||||||||||||||||||||||||
| 1047 | { | - | ||||||||||||||||||||||||
| 1048 | const QGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1049 | int n = d->things.count(); | - | ||||||||||||||||||||||||
| 1050 | for (int i = 0; i < n
| 0 | ||||||||||||||||||||||||
| 1051 | QGridBox *box = d->things.at(i); | - | ||||||||||||||||||||||||
| 1052 | if (row >= box->row
| 0 | ||||||||||||||||||||||||
| 1053 | && column >= box->col
| 0 | ||||||||||||||||||||||||
| 1054 | return never executed: box->item();return box->item();never executed: return box->item(); | 0 | ||||||||||||||||||||||||
| 1055 | } | - | ||||||||||||||||||||||||
| 1056 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1057 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 1058 | } | - | ||||||||||||||||||||||||
| 1059 | - | |||||||||||||||||||||||||
| 1060 | - | |||||||||||||||||||||||||
| 1061 | - | |||||||||||||||||||||||||
| 1062 | - | |||||||||||||||||||||||||
| 1063 | QLayoutItem *QGridLayout::takeAt(int index) | - | ||||||||||||||||||||||||
| 1064 | { | - | ||||||||||||||||||||||||
| 1065 | QGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1066 | return never executed: d->takeAt(index);return d->takeAt(index);never executed: return d->takeAt(index); | 0 | ||||||||||||||||||||||||
| 1067 | } | - | ||||||||||||||||||||||||
| 1068 | void QGridLayout::getItemPosition(int index, int *row, int *column, int *rowSpan, int *columnSpan) const | - | ||||||||||||||||||||||||
| 1069 | { | - | ||||||||||||||||||||||||
| 1070 | const QGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1071 | d->getItemPosition(index, row, column, rowSpan, columnSpan); | - | ||||||||||||||||||||||||
| 1072 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1073 | - | |||||||||||||||||||||||||
| 1074 | - | |||||||||||||||||||||||||
| 1075 | - | |||||||||||||||||||||||||
| 1076 | - | |||||||||||||||||||||||||
| 1077 | - | |||||||||||||||||||||||||
| 1078 | void QGridLayout::setGeometry(const QRect &rect) | - | ||||||||||||||||||||||||
| 1079 | { | - | ||||||||||||||||||||||||
| 1080 | QGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1081 | if (d->isDirty()
| 0 | ||||||||||||||||||||||||
| 1082 | QRect cr = alignment()
| 0 | ||||||||||||||||||||||||
| 1083 | d->distribute(cr, horizontalSpacing(), verticalSpacing()); | - | ||||||||||||||||||||||||
| 1084 | QLayout::setGeometry(rect); | - | ||||||||||||||||||||||||
| 1085 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1086 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1087 | QRect QGridLayout::cellRect(int row, int column) const | - | ||||||||||||||||||||||||
| 1088 | { | - | ||||||||||||||||||||||||
| 1089 | const QGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1090 | return never executed: d->cellRect(row, column);return d->cellRect(row, column);never executed: return d->cellRect(row, column); | 0 | ||||||||||||||||||||||||
| 1091 | } | - | ||||||||||||||||||||||||
| 1092 | - | |||||||||||||||||||||||||
| 1093 | - | |||||||||||||||||||||||||
| 1094 | - | |||||||||||||||||||||||||
| 1095 | - | |||||||||||||||||||||||||
| 1096 | void QGridLayout::addItem(QLayoutItem *item) | - | ||||||||||||||||||||||||
| 1097 | { | - | ||||||||||||||||||||||||
| 1098 | QGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1099 | int r, c; | - | ||||||||||||||||||||||||
| 1100 | d->getNextPos(r, c); | - | ||||||||||||||||||||||||
| 1101 | addItem(item, r, c); | - | ||||||||||||||||||||||||
| 1102 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1103 | void QGridLayout::addItem(QLayoutItem *item, int row, int column, int rowSpan, int columnSpan, Qt::Alignment alignment) | - | ||||||||||||||||||||||||
| 1104 | { | - | ||||||||||||||||||||||||
| 1105 | QGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1106 | QGridBox *b = new QGridBox(item); | - | ||||||||||||||||||||||||
| 1107 | b->setAlignment(alignment); | - | ||||||||||||||||||||||||
| 1108 | d->add(b, row, (rowSpan < 0) ? -1 : row + rowSpan - 1, column, (columnSpan < 0) ? -1 : column + columnSpan - 1); | - | ||||||||||||||||||||||||
| 1109 | invalidate(); | - | ||||||||||||||||||||||||
| 1110 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1111 | void QGridLayout::addWidget(QWidget *widget, int row, int column, Qt::Alignment alignment) | - | ||||||||||||||||||||||||
| 1112 | { | - | ||||||||||||||||||||||||
| 1113 | QGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1114 | if (!d->checkWidget(widget)
| 0 | ||||||||||||||||||||||||
| 1115 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1116 | if (row < 0
| 0 | ||||||||||||||||||||||||
| 1117 | QMessageLogger(__FILE__, 1439, __PRETTY_FUNCTION__).warning("QGridLayout: Cannot add %s/%s to %s/%s at row %d column %d", | - | ||||||||||||||||||||||||
| 1118 | widget->metaObject()->className(), widget->objectName().toLocal8Bit().data(), | - | ||||||||||||||||||||||||
| 1119 | metaObject()->className(), objectName().toLocal8Bit().data(), row, column); | - | ||||||||||||||||||||||||
| 1120 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1121 | } | - | ||||||||||||||||||||||||
| 1122 | addChildWidget(widget); | - | ||||||||||||||||||||||||
| 1123 | QWidgetItem *b = QLayoutPrivate::createWidgetItem(this, widget); | - | ||||||||||||||||||||||||
| 1124 | addItem(b, row, column, 1, 1, alignment); | - | ||||||||||||||||||||||||
| 1125 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1126 | void QGridLayout::addWidget(QWidget *widget, int fromRow, int fromColumn, | - | ||||||||||||||||||||||||
| 1127 | int rowSpan, int columnSpan, Qt::Alignment alignment) | - | ||||||||||||||||||||||||
| 1128 | { | - | ||||||||||||||||||||||||
| 1129 | QGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1130 | if (!d->checkWidget(widget)
| 0 | ||||||||||||||||||||||||
| 1131 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1132 | int toRow = (
| 0 | ||||||||||||||||||||||||
| 1133 | int toColumn = (
| 0 | ||||||||||||||||||||||||
| 1134 | addChildWidget(widget); | - | ||||||||||||||||||||||||
| 1135 | QGridBox *b = new QGridBox(this, widget); | - | ||||||||||||||||||||||||
| 1136 | b->setAlignment(alignment); | - | ||||||||||||||||||||||||
| 1137 | d->add(b, fromRow, toRow, fromColumn, toColumn); | - | ||||||||||||||||||||||||
| 1138 | invalidate(); | - | ||||||||||||||||||||||||
| 1139 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1140 | void QGridLayout::addLayout(QLayout *layout, int row, int column, Qt::Alignment alignment) | - | ||||||||||||||||||||||||
| 1141 | { | - | ||||||||||||||||||||||||
| 1142 | QGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1143 | if (!d->checkLayout(layout)
| 0 | ||||||||||||||||||||||||
| 1144 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1145 | if (!adoptLayout(layout)
| 0 | ||||||||||||||||||||||||
| 1146 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1147 | QGridBox *b = new QGridBox(layout); | - | ||||||||||||||||||||||||
| 1148 | b->setAlignment(alignment); | - | ||||||||||||||||||||||||
| 1149 | d->add(b, row, column); | - | ||||||||||||||||||||||||
| 1150 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1151 | void QGridLayout::addLayout(QLayout *layout, int row, int column, | - | ||||||||||||||||||||||||
| 1152 | int rowSpan, int columnSpan, Qt::Alignment alignment) | - | ||||||||||||||||||||||||
| 1153 | { | - | ||||||||||||||||||||||||
| 1154 | QGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1155 | if (!d->checkLayout(layout)
| 0 | ||||||||||||||||||||||||
| 1156 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1157 | if (!adoptLayout(layout)
| 0 | ||||||||||||||||||||||||
| 1158 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1159 | QGridBox *b = new QGridBox(layout); | - | ||||||||||||||||||||||||
| 1160 | b->setAlignment(alignment); | - | ||||||||||||||||||||||||
| 1161 | d->add(b, row, (rowSpan < 0) ? -1 : row + rowSpan - 1, column, (columnSpan < 0) ? -1 : column + columnSpan - 1); | - | ||||||||||||||||||||||||
| 1162 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1163 | void QGridLayout::setRowStretch(int row, int stretch) | - | ||||||||||||||||||||||||
| 1164 | { | - | ||||||||||||||||||||||||
| 1165 | QGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1166 | d->setRowStretch(row, stretch); | - | ||||||||||||||||||||||||
| 1167 | invalidate(); | - | ||||||||||||||||||||||||
| 1168 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1169 | - | |||||||||||||||||||||||||
| 1170 | - | |||||||||||||||||||||||||
| 1171 | - | |||||||||||||||||||||||||
| 1172 | - | |||||||||||||||||||||||||
| 1173 | - | |||||||||||||||||||||||||
| 1174 | - | |||||||||||||||||||||||||
| 1175 | int QGridLayout::rowStretch(int row) const | - | ||||||||||||||||||||||||
| 1176 | { | - | ||||||||||||||||||||||||
| 1177 | const QGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1178 | return never executed: d->rowStretch(row);return d->rowStretch(row);never executed: return d->rowStretch(row); | 0 | ||||||||||||||||||||||||
| 1179 | } | - | ||||||||||||||||||||||||
| 1180 | - | |||||||||||||||||||||||||
| 1181 | - | |||||||||||||||||||||||||
| 1182 | - | |||||||||||||||||||||||||
| 1183 | - | |||||||||||||||||||||||||
| 1184 | - | |||||||||||||||||||||||||
| 1185 | - | |||||||||||||||||||||||||
| 1186 | int QGridLayout::columnStretch(int column) const | - | ||||||||||||||||||||||||
| 1187 | { | - | ||||||||||||||||||||||||
| 1188 | const QGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1189 | return never executed: d->colStretch(column);return d->colStretch(column);never executed: return d->colStretch(column); | 0 | ||||||||||||||||||||||||
| 1190 | } | - | ||||||||||||||||||||||||
| 1191 | void QGridLayout::setColumnStretch(int column, int stretch) | - | ||||||||||||||||||||||||
| 1192 | { | - | ||||||||||||||||||||||||
| 1193 | QGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1194 | d->setColStretch(column, stretch); | - | ||||||||||||||||||||||||
| 1195 | invalidate(); | - | ||||||||||||||||||||||||
| 1196 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1197 | void QGridLayout::setRowMinimumHeight(int row, int minSize) | - | ||||||||||||||||||||||||
| 1198 | { | - | ||||||||||||||||||||||||
| 1199 | QGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1200 | d->setRowMinimumHeight(row, minSize); | - | ||||||||||||||||||||||||
| 1201 | invalidate(); | - | ||||||||||||||||||||||||
| 1202 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1203 | - | |||||||||||||||||||||||||
| 1204 | - | |||||||||||||||||||||||||
| 1205 | - | |||||||||||||||||||||||||
| 1206 | - | |||||||||||||||||||||||||
| 1207 | - | |||||||||||||||||||||||||
| 1208 | - | |||||||||||||||||||||||||
| 1209 | int QGridLayout::rowMinimumHeight(int row) const | - | ||||||||||||||||||||||||
| 1210 | { | - | ||||||||||||||||||||||||
| 1211 | const QGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1212 | return never executed: d->rowSpacing(row);return d->rowSpacing(row);never executed: return d->rowSpacing(row); | 0 | ||||||||||||||||||||||||
| 1213 | } | - | ||||||||||||||||||||||||
| 1214 | - | |||||||||||||||||||||||||
| 1215 | - | |||||||||||||||||||||||||
| 1216 | - | |||||||||||||||||||||||||
| 1217 | - | |||||||||||||||||||||||||
| 1218 | - | |||||||||||||||||||||||||
| 1219 | - | |||||||||||||||||||||||||
| 1220 | void QGridLayout::setColumnMinimumWidth(int column, int minSize) | - | ||||||||||||||||||||||||
| 1221 | { | - | ||||||||||||||||||||||||
| 1222 | QGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1223 | d->setColumnMinimumWidth(column, minSize); | - | ||||||||||||||||||||||||
| 1224 | invalidate(); | - | ||||||||||||||||||||||||
| 1225 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1226 | - | |||||||||||||||||||||||||
| 1227 | - | |||||||||||||||||||||||||
| 1228 | - | |||||||||||||||||||||||||
| 1229 | - | |||||||||||||||||||||||||
| 1230 | - | |||||||||||||||||||||||||
| 1231 | - | |||||||||||||||||||||||||
| 1232 | int QGridLayout::columnMinimumWidth(int column) const | - | ||||||||||||||||||||||||
| 1233 | { | - | ||||||||||||||||||||||||
| 1234 | const QGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1235 | return never executed: d->colSpacing(column);return d->colSpacing(column);never executed: return d->colSpacing(column); | 0 | ||||||||||||||||||||||||
| 1236 | } | - | ||||||||||||||||||||||||
| 1237 | - | |||||||||||||||||||||||||
| 1238 | - | |||||||||||||||||||||||||
| 1239 | - | |||||||||||||||||||||||||
| 1240 | - | |||||||||||||||||||||||||
| 1241 | Qt::Orientations QGridLayout::expandingDirections() const | - | ||||||||||||||||||||||||
| 1242 | { | - | ||||||||||||||||||||||||
| 1243 | const QGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1244 | return never executed: d->expandingDirections(horizontalSpacing(), verticalSpacing());return d->expandingDirections(horizontalSpacing(), verticalSpacing());never executed: return d->expandingDirections(horizontalSpacing(), verticalSpacing()); | 0 | ||||||||||||||||||||||||
| 1245 | } | - | ||||||||||||||||||||||||
| 1246 | - | |||||||||||||||||||||||||
| 1247 | - | |||||||||||||||||||||||||
| 1248 | - | |||||||||||||||||||||||||
| 1249 | - | |||||||||||||||||||||||||
| 1250 | void QGridLayout::setOriginCorner(Qt::Corner corner) | - | ||||||||||||||||||||||||
| 1251 | { | - | ||||||||||||||||||||||||
| 1252 | QGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1253 | d->setReversed(corner == Qt::BottomLeftCorner || corner == Qt::BottomRightCorner, | - | ||||||||||||||||||||||||
| 1254 | corner == Qt::TopRightCorner || corner == Qt::BottomRightCorner); | - | ||||||||||||||||||||||||
| 1255 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1256 | - | |||||||||||||||||||||||||
| 1257 | - | |||||||||||||||||||||||||
| 1258 | - | |||||||||||||||||||||||||
| 1259 | - | |||||||||||||||||||||||||
| 1260 | - | |||||||||||||||||||||||||
| 1261 | Qt::Corner QGridLayout::originCorner() const | - | ||||||||||||||||||||||||
| 1262 | { | - | ||||||||||||||||||||||||
| 1263 | const QGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1264 | if (d->horReversed()
| 0 | ||||||||||||||||||||||||
| 1265 | return never executed: d->verReversed()return d->verReversed() ? Qt::BottomRightCorner : Qt::TopRightCorner;
never executed: return d->verReversed() ? Qt::BottomRightCorner : Qt::TopRightCorner; | 0 | ||||||||||||||||||||||||
| 1266 | } else { | - | ||||||||||||||||||||||||
| 1267 | return never executed: d->verReversed()return d->verReversed() ? Qt::BottomLeftCorner : Qt::TopLeftCorner;
never executed: return d->verReversed() ? Qt::BottomLeftCorner : Qt::TopLeftCorner; | 0 | ||||||||||||||||||||||||
| 1268 | } | - | ||||||||||||||||||||||||
| 1269 | } | - | ||||||||||||||||||||||||
| 1270 | - | |||||||||||||||||||||||||
| 1271 | - | |||||||||||||||||||||||||
| 1272 | - | |||||||||||||||||||||||||
| 1273 | - | |||||||||||||||||||||||||
| 1274 | void QGridLayout::invalidate() | - | ||||||||||||||||||||||||
| 1275 | { | - | ||||||||||||||||||||||||
| 1276 | QGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1277 | d->setDirty(); | - | ||||||||||||||||||||||||
| 1278 | QLayout::invalidate(); | - | ||||||||||||||||||||||||
| 1279 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1280 | - | |||||||||||||||||||||||||
| 1281 | - | |||||||||||||||||||||||||
| 1282 | - | |||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |