| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/widgets/graphicsview/qgraphicsgridlayout.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||
| 3 | - | |||||||||||||||||||||||||
| 4 | - | |||||||||||||||||||||||||
| 5 | - | |||||||||||||||||||||||||
| 6 | - | |||||||||||||||||||||||||
| 7 | - | |||||||||||||||||||||||||
| 8 | - | |||||||||||||||||||||||||
| 9 | class QGraphicsGridLayoutPrivate : public QGraphicsLayoutPrivate | - | ||||||||||||||||||||||||
| 10 | { | - | ||||||||||||||||||||||||
| 11 | public: | - | ||||||||||||||||||||||||
| 12 | QGraphicsGridLayoutPrivate() { } | - | ||||||||||||||||||||||||
| 13 | QGraphicsLayoutStyleInfo *styleInfo() const; | - | ||||||||||||||||||||||||
| 14 | - | |||||||||||||||||||||||||
| 15 | mutable QScopedPointer<QGraphicsLayoutStyleInfo> m_styleInfo; | - | ||||||||||||||||||||||||
| 16 | QGraphicsGridLayoutEngine engine; | - | ||||||||||||||||||||||||
| 17 | - | |||||||||||||||||||||||||
| 18 | - | |||||||||||||||||||||||||
| 19 | - | |||||||||||||||||||||||||
| 20 | - | |||||||||||||||||||||||||
| 21 | }; | - | ||||||||||||||||||||||||
| 22 | - | |||||||||||||||||||||||||
| 23 | - | |||||||||||||||||||||||||
| 24 | QGraphicsLayoutStyleInfo *QGraphicsGridLayoutPrivate::styleInfo() const | - | ||||||||||||||||||||||||
| 25 | { | - | ||||||||||||||||||||||||
| 26 | if (!m_styleInfo
| 0 | ||||||||||||||||||||||||
| 27 | m_styleInfo.reset(new QGraphicsLayoutStyleInfo(this)); never executed: m_styleInfo.reset(new QGraphicsLayoutStyleInfo(this)); | 0 | ||||||||||||||||||||||||
| 28 | return never executed: m_styleInfo.data();return m_styleInfo.data();never executed: return m_styleInfo.data(); | 0 | ||||||||||||||||||||||||
| 29 | } | - | ||||||||||||||||||||||||
| 30 | - | |||||||||||||||||||||||||
| 31 | - | |||||||||||||||||||||||||
| 32 | - | |||||||||||||||||||||||||
| 33 | - | |||||||||||||||||||||||||
| 34 | - | |||||||||||||||||||||||||
| 35 | QGraphicsGridLayout::QGraphicsGridLayout(QGraphicsLayoutItem *parent) | - | ||||||||||||||||||||||||
| 36 | : QGraphicsLayout(*new QGraphicsGridLayoutPrivate(), parent) | - | ||||||||||||||||||||||||
| 37 | { | - | ||||||||||||||||||||||||
| 38 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 39 | - | |||||||||||||||||||||||||
| 40 | - | |||||||||||||||||||||||||
| 41 | - | |||||||||||||||||||||||||
| 42 | - | |||||||||||||||||||||||||
| 43 | QGraphicsGridLayout::~QGraphicsGridLayout() | - | ||||||||||||||||||||||||
| 44 | { | - | ||||||||||||||||||||||||
| 45 | for (int i = count() - 1; i >= 0
| 0 | ||||||||||||||||||||||||
| 46 | QGraphicsLayoutItem *item = itemAt(i); | - | ||||||||||||||||||||||||
| 47 | - | |||||||||||||||||||||||||
| 48 | - | |||||||||||||||||||||||||
| 49 | - | |||||||||||||||||||||||||
| 50 | removeAt(i); | - | ||||||||||||||||||||||||
| 51 | if (item
| 0 | ||||||||||||||||||||||||
| 52 | item->setParentLayoutItem(0); | - | ||||||||||||||||||||||||
| 53 | if (item->ownedByLayout()
| 0 | ||||||||||||||||||||||||
| 54 | delete item; never executed: delete item; | 0 | ||||||||||||||||||||||||
| 55 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 56 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 57 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 58 | - | |||||||||||||||||||||||||
| 59 | - | |||||||||||||||||||||||||
| 60 | - | |||||||||||||||||||||||||
| 61 | - | |||||||||||||||||||||||||
| 62 | - | |||||||||||||||||||||||||
| 63 | void QGraphicsGridLayout::addItem(QGraphicsLayoutItem *item, int row, int column, | - | ||||||||||||||||||||||||
| 64 | int rowSpan, int columnSpan, Qt::Alignment alignment) | - | ||||||||||||||||||||||||
| 65 | { | - | ||||||||||||||||||||||||
| 66 | QGraphicsGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 67 | if (row < 0
| 0 | ||||||||||||||||||||||||
| 68 | QMessageLogger(__FILE__, 152, __PRETTY_FUNCTION__).warning("QGraphicsGridLayout::addItem: invalid row/column: %d", | - | ||||||||||||||||||||||||
| 69 | row < 0 ? row : column); | - | ||||||||||||||||||||||||
| 70 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 71 | } | - | ||||||||||||||||||||||||
| 72 | if (columnSpan < 1
| 0 | ||||||||||||||||||||||||
| 73 | QMessageLogger(__FILE__, 157, __PRETTY_FUNCTION__).warning("QGraphicsGridLayout::addItem: invalid row span/column span: %d", | - | ||||||||||||||||||||||||
| 74 | rowSpan < 1 ? rowSpan : columnSpan); | - | ||||||||||||||||||||||||
| 75 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 76 | } | - | ||||||||||||||||||||||||
| 77 | if (!item
| 0 | ||||||||||||||||||||||||
| 78 | QMessageLogger(__FILE__, 162, __PRETTY_FUNCTION__).warning("QGraphicsGridLayout::addItem: cannot add null item"); | - | ||||||||||||||||||||||||
| 79 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 80 | } | - | ||||||||||||||||||||||||
| 81 | if (item == this
| 0 | ||||||||||||||||||||||||
| 82 | QMessageLogger(__FILE__, 166, __PRETTY_FUNCTION__).warning("QGraphicsGridLayout::addItem: cannot insert itself"); | - | ||||||||||||||||||||||||
| 83 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 84 | } | - | ||||||||||||||||||||||||
| 85 | - | |||||||||||||||||||||||||
| 86 | d->addChildLayoutItem(item); | - | ||||||||||||||||||||||||
| 87 | - | |||||||||||||||||||||||||
| 88 | QGraphicsGridLayoutEngineItem *gridEngineItem = new QGraphicsGridLayoutEngineItem(item, row, column, rowSpan, columnSpan, alignment); | - | ||||||||||||||||||||||||
| 89 | d->engine.insertItem(gridEngineItem, -1); | - | ||||||||||||||||||||||||
| 90 | invalidate(); | - | ||||||||||||||||||||||||
| 91 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 92 | void QGraphicsGridLayout::setHorizontalSpacing(qreal spacing) | - | ||||||||||||||||||||||||
| 93 | { | - | ||||||||||||||||||||||||
| 94 | QGraphicsGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 95 | d->engine.setSpacing(spacing, Qt::Horizontal); | - | ||||||||||||||||||||||||
| 96 | invalidate(); | - | ||||||||||||||||||||||||
| 97 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 98 | - | |||||||||||||||||||||||||
| 99 | - | |||||||||||||||||||||||||
| 100 | - | |||||||||||||||||||||||||
| 101 | - | |||||||||||||||||||||||||
| 102 | qreal QGraphicsGridLayout::horizontalSpacing() const | - | ||||||||||||||||||||||||
| 103 | { | - | ||||||||||||||||||||||||
| 104 | const QGraphicsGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 105 | return never executed: d->engine.spacing(Qt::Horizontal, d->styleInfo());return d->engine.spacing(Qt::Horizontal, d->styleInfo());never executed: return d->engine.spacing(Qt::Horizontal, d->styleInfo()); | 0 | ||||||||||||||||||||||||
| 106 | } | - | ||||||||||||||||||||||||
| 107 | - | |||||||||||||||||||||||||
| 108 | - | |||||||||||||||||||||||||
| 109 | - | |||||||||||||||||||||||||
| 110 | - | |||||||||||||||||||||||||
| 111 | void QGraphicsGridLayout::setVerticalSpacing(qreal spacing) | - | ||||||||||||||||||||||||
| 112 | { | - | ||||||||||||||||||||||||
| 113 | QGraphicsGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 114 | d->engine.setSpacing(spacing, Qt::Vertical); | - | ||||||||||||||||||||||||
| 115 | invalidate(); | - | ||||||||||||||||||||||||
| 116 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 117 | - | |||||||||||||||||||||||||
| 118 | - | |||||||||||||||||||||||||
| 119 | - | |||||||||||||||||||||||||
| 120 | - | |||||||||||||||||||||||||
| 121 | qreal QGraphicsGridLayout::verticalSpacing() const | - | ||||||||||||||||||||||||
| 122 | { | - | ||||||||||||||||||||||||
| 123 | const QGraphicsGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 124 | return never executed: d->engine.spacing(Qt::Vertical, d->styleInfo());return d->engine.spacing(Qt::Vertical, d->styleInfo());never executed: return d->engine.spacing(Qt::Vertical, d->styleInfo()); | 0 | ||||||||||||||||||||||||
| 125 | } | - | ||||||||||||||||||||||||
| 126 | - | |||||||||||||||||||||||||
| 127 | - | |||||||||||||||||||||||||
| 128 | - | |||||||||||||||||||||||||
| 129 | - | |||||||||||||||||||||||||
| 130 | - | |||||||||||||||||||||||||
| 131 | - | |||||||||||||||||||||||||
| 132 | - | |||||||||||||||||||||||||
| 133 | void QGraphicsGridLayout::setSpacing(qreal spacing) | - | ||||||||||||||||||||||||
| 134 | { | - | ||||||||||||||||||||||||
| 135 | QGraphicsGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 136 | d->engine.setSpacing(spacing, Qt::Horizontal | Qt::Vertical); | - | ||||||||||||||||||||||||
| 137 | invalidate(); | - | ||||||||||||||||||||||||
| 138 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 139 | - | |||||||||||||||||||||||||
| 140 | - | |||||||||||||||||||||||||
| 141 | - | |||||||||||||||||||||||||
| 142 | - | |||||||||||||||||||||||||
| 143 | void QGraphicsGridLayout::setRowSpacing(int row, qreal spacing) | - | ||||||||||||||||||||||||
| 144 | { | - | ||||||||||||||||||||||||
| 145 | QGraphicsGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 146 | d->engine.setRowSpacing(row, spacing, Qt::Vertical); | - | ||||||||||||||||||||||||
| 147 | invalidate(); | - | ||||||||||||||||||||||||
| 148 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 149 | - | |||||||||||||||||||||||||
| 150 | - | |||||||||||||||||||||||||
| 151 | - | |||||||||||||||||||||||||
| 152 | - | |||||||||||||||||||||||||
| 153 | qreal QGraphicsGridLayout::rowSpacing(int row) const | - | ||||||||||||||||||||||||
| 154 | { | - | ||||||||||||||||||||||||
| 155 | const QGraphicsGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 156 | return never executed: d->engine.rowSpacing(row, Qt::Vertical);return d->engine.rowSpacing(row, Qt::Vertical);never executed: return d->engine.rowSpacing(row, Qt::Vertical); | 0 | ||||||||||||||||||||||||
| 157 | } | - | ||||||||||||||||||||||||
| 158 | - | |||||||||||||||||||||||||
| 159 | - | |||||||||||||||||||||||||
| 160 | - | |||||||||||||||||||||||||
| 161 | - | |||||||||||||||||||||||||
| 162 | void QGraphicsGridLayout::setColumnSpacing(int column, qreal spacing) | - | ||||||||||||||||||||||||
| 163 | { | - | ||||||||||||||||||||||||
| 164 | QGraphicsGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 165 | d->engine.setRowSpacing(column, spacing, Qt::Horizontal); | - | ||||||||||||||||||||||||
| 166 | invalidate(); | - | ||||||||||||||||||||||||
| 167 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 168 | - | |||||||||||||||||||||||||
| 169 | - | |||||||||||||||||||||||||
| 170 | - | |||||||||||||||||||||||||
| 171 | - | |||||||||||||||||||||||||
| 172 | qreal QGraphicsGridLayout::columnSpacing(int column) const | - | ||||||||||||||||||||||||
| 173 | { | - | ||||||||||||||||||||||||
| 174 | const QGraphicsGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 175 | return never executed: d->engine.rowSpacing(column, Qt::Horizontal);return d->engine.rowSpacing(column, Qt::Horizontal);never executed: return d->engine.rowSpacing(column, Qt::Horizontal); | 0 | ||||||||||||||||||||||||
| 176 | } | - | ||||||||||||||||||||||||
| 177 | - | |||||||||||||||||||||||||
| 178 | - | |||||||||||||||||||||||||
| 179 | - | |||||||||||||||||||||||||
| 180 | - | |||||||||||||||||||||||||
| 181 | void QGraphicsGridLayout::setRowStretchFactor(int row, int stretch) | - | ||||||||||||||||||||||||
| 182 | { | - | ||||||||||||||||||||||||
| 183 | QGraphicsGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 184 | d->engine.setRowStretchFactor(row, stretch, Qt::Vertical); | - | ||||||||||||||||||||||||
| 185 | invalidate(); | - | ||||||||||||||||||||||||
| 186 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 187 | - | |||||||||||||||||||||||||
| 188 | - | |||||||||||||||||||||||||
| 189 | - | |||||||||||||||||||||||||
| 190 | - | |||||||||||||||||||||||||
| 191 | int QGraphicsGridLayout::rowStretchFactor(int row) const | - | ||||||||||||||||||||||||
| 192 | { | - | ||||||||||||||||||||||||
| 193 | const QGraphicsGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 194 | return never executed: d->engine.rowStretchFactor(row, Qt::Vertical);return d->engine.rowStretchFactor(row, Qt::Vertical);never executed: return d->engine.rowStretchFactor(row, Qt::Vertical); | 0 | ||||||||||||||||||||||||
| 195 | } | - | ||||||||||||||||||||||||
| 196 | - | |||||||||||||||||||||||||
| 197 | - | |||||||||||||||||||||||||
| 198 | - | |||||||||||||||||||||||||
| 199 | - | |||||||||||||||||||||||||
| 200 | void QGraphicsGridLayout::setColumnStretchFactor(int column, int stretch) | - | ||||||||||||||||||||||||
| 201 | { | - | ||||||||||||||||||||||||
| 202 | QGraphicsGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 203 | d->engine.setRowStretchFactor(column, stretch, Qt::Horizontal); | - | ||||||||||||||||||||||||
| 204 | invalidate(); | - | ||||||||||||||||||||||||
| 205 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 206 | - | |||||||||||||||||||||||||
| 207 | - | |||||||||||||||||||||||||
| 208 | - | |||||||||||||||||||||||||
| 209 | - | |||||||||||||||||||||||||
| 210 | int QGraphicsGridLayout::columnStretchFactor(int column) const | - | ||||||||||||||||||||||||
| 211 | { | - | ||||||||||||||||||||||||
| 212 | const QGraphicsGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 213 | return never executed: d->engine.rowStretchFactor(column, Qt::Horizontal);return d->engine.rowStretchFactor(column, Qt::Horizontal);never executed: return d->engine.rowStretchFactor(column, Qt::Horizontal); | 0 | ||||||||||||||||||||||||
| 214 | } | - | ||||||||||||||||||||||||
| 215 | - | |||||||||||||||||||||||||
| 216 | - | |||||||||||||||||||||||||
| 217 | - | |||||||||||||||||||||||||
| 218 | - | |||||||||||||||||||||||||
| 219 | void QGraphicsGridLayout::setRowMinimumHeight(int row, qreal height) | - | ||||||||||||||||||||||||
| 220 | { | - | ||||||||||||||||||||||||
| 221 | QGraphicsGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 222 | d->engine.setRowSizeHint(Qt::MinimumSize, row, height, Qt::Vertical); | - | ||||||||||||||||||||||||
| 223 | invalidate(); | - | ||||||||||||||||||||||||
| 224 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 225 | - | |||||||||||||||||||||||||
| 226 | - | |||||||||||||||||||||||||
| 227 | - | |||||||||||||||||||||||||
| 228 | - | |||||||||||||||||||||||||
| 229 | qreal QGraphicsGridLayout::rowMinimumHeight(int row) const | - | ||||||||||||||||||||||||
| 230 | { | - | ||||||||||||||||||||||||
| 231 | const QGraphicsGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 232 | return never executed: d->engine.rowSizeHint(Qt::MinimumSize, row, Qt::Vertical);return d->engine.rowSizeHint(Qt::MinimumSize, row, Qt::Vertical);never executed: return d->engine.rowSizeHint(Qt::MinimumSize, row, Qt::Vertical); | 0 | ||||||||||||||||||||||||
| 233 | } | - | ||||||||||||||||||||||||
| 234 | - | |||||||||||||||||||||||||
| 235 | - | |||||||||||||||||||||||||
| 236 | - | |||||||||||||||||||||||||
| 237 | - | |||||||||||||||||||||||||
| 238 | void QGraphicsGridLayout::setRowPreferredHeight(int row, qreal height) | - | ||||||||||||||||||||||||
| 239 | { | - | ||||||||||||||||||||||||
| 240 | QGraphicsGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 241 | d->engine.setRowSizeHint(Qt::PreferredSize, row, height, Qt::Vertical); | - | ||||||||||||||||||||||||
| 242 | invalidate(); | - | ||||||||||||||||||||||||
| 243 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 244 | - | |||||||||||||||||||||||||
| 245 | - | |||||||||||||||||||||||||
| 246 | - | |||||||||||||||||||||||||
| 247 | - | |||||||||||||||||||||||||
| 248 | qreal QGraphicsGridLayout::rowPreferredHeight(int row) const | - | ||||||||||||||||||||||||
| 249 | { | - | ||||||||||||||||||||||||
| 250 | const QGraphicsGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 251 | return never executed: d->engine.rowSizeHint(Qt::PreferredSize, row, Qt::Vertical);return d->engine.rowSizeHint(Qt::PreferredSize, row, Qt::Vertical);never executed: return d->engine.rowSizeHint(Qt::PreferredSize, row, Qt::Vertical); | 0 | ||||||||||||||||||||||||
| 252 | } | - | ||||||||||||||||||||||||
| 253 | - | |||||||||||||||||||||||||
| 254 | - | |||||||||||||||||||||||||
| 255 | - | |||||||||||||||||||||||||
| 256 | - | |||||||||||||||||||||||||
| 257 | void QGraphicsGridLayout::setRowMaximumHeight(int row, qreal height) | - | ||||||||||||||||||||||||
| 258 | { | - | ||||||||||||||||||||||||
| 259 | QGraphicsGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 260 | d->engine.setRowSizeHint(Qt::MaximumSize, row, height, Qt::Vertical); | - | ||||||||||||||||||||||||
| 261 | invalidate(); | - | ||||||||||||||||||||||||
| 262 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 263 | - | |||||||||||||||||||||||||
| 264 | - | |||||||||||||||||||||||||
| 265 | - | |||||||||||||||||||||||||
| 266 | - | |||||||||||||||||||||||||
| 267 | qreal QGraphicsGridLayout::rowMaximumHeight(int row) const | - | ||||||||||||||||||||||||
| 268 | { | - | ||||||||||||||||||||||||
| 269 | const QGraphicsGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 270 | return never executed: d->engine.rowSizeHint(Qt::MaximumSize, row, Qt::Vertical);return d->engine.rowSizeHint(Qt::MaximumSize, row, Qt::Vertical);never executed: return d->engine.rowSizeHint(Qt::MaximumSize, row, Qt::Vertical); | 0 | ||||||||||||||||||||||||
| 271 | } | - | ||||||||||||||||||||||||
| 272 | - | |||||||||||||||||||||||||
| 273 | - | |||||||||||||||||||||||||
| 274 | - | |||||||||||||||||||||||||
| 275 | - | |||||||||||||||||||||||||
| 276 | void QGraphicsGridLayout::setRowFixedHeight(int row, qreal height) | - | ||||||||||||||||||||||||
| 277 | { | - | ||||||||||||||||||||||||
| 278 | QGraphicsGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 279 | d->engine.setRowSizeHint(Qt::MinimumSize, row, height, Qt::Vertical); | - | ||||||||||||||||||||||||
| 280 | d->engine.setRowSizeHint(Qt::MaximumSize, row, height, Qt::Vertical); | - | ||||||||||||||||||||||||
| 281 | invalidate(); | - | ||||||||||||||||||||||||
| 282 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 283 | - | |||||||||||||||||||||||||
| 284 | - | |||||||||||||||||||||||||
| 285 | - | |||||||||||||||||||||||||
| 286 | - | |||||||||||||||||||||||||
| 287 | void QGraphicsGridLayout::setColumnMinimumWidth(int column, qreal width) | - | ||||||||||||||||||||||||
| 288 | { | - | ||||||||||||||||||||||||
| 289 | QGraphicsGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 290 | d->engine.setRowSizeHint(Qt::MinimumSize, column, width, Qt::Horizontal); | - | ||||||||||||||||||||||||
| 291 | invalidate(); | - | ||||||||||||||||||||||||
| 292 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 293 | - | |||||||||||||||||||||||||
| 294 | - | |||||||||||||||||||||||||
| 295 | - | |||||||||||||||||||||||||
| 296 | - | |||||||||||||||||||||||||
| 297 | qreal QGraphicsGridLayout::columnMinimumWidth(int column) const | - | ||||||||||||||||||||||||
| 298 | { | - | ||||||||||||||||||||||||
| 299 | const QGraphicsGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 300 | return never executed: d->engine.rowSizeHint(Qt::MinimumSize, column, Qt::Horizontal);return d->engine.rowSizeHint(Qt::MinimumSize, column, Qt::Horizontal);never executed: return d->engine.rowSizeHint(Qt::MinimumSize, column, Qt::Horizontal); | 0 | ||||||||||||||||||||||||
| 301 | } | - | ||||||||||||||||||||||||
| 302 | - | |||||||||||||||||||||||||
| 303 | - | |||||||||||||||||||||||||
| 304 | - | |||||||||||||||||||||||||
| 305 | - | |||||||||||||||||||||||||
| 306 | void QGraphicsGridLayout::setColumnPreferredWidth(int column, qreal width) | - | ||||||||||||||||||||||||
| 307 | { | - | ||||||||||||||||||||||||
| 308 | QGraphicsGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 309 | d->engine.setRowSizeHint(Qt::PreferredSize, column, width, Qt::Horizontal); | - | ||||||||||||||||||||||||
| 310 | invalidate(); | - | ||||||||||||||||||||||||
| 311 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 312 | - | |||||||||||||||||||||||||
| 313 | - | |||||||||||||||||||||||||
| 314 | - | |||||||||||||||||||||||||
| 315 | - | |||||||||||||||||||||||||
| 316 | qreal QGraphicsGridLayout::columnPreferredWidth(int column) const | - | ||||||||||||||||||||||||
| 317 | { | - | ||||||||||||||||||||||||
| 318 | const QGraphicsGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 319 | return never executed: d->engine.rowSizeHint(Qt::PreferredSize, column, Qt::Horizontal);return d->engine.rowSizeHint(Qt::PreferredSize, column, Qt::Horizontal);never executed: return d->engine.rowSizeHint(Qt::PreferredSize, column, Qt::Horizontal); | 0 | ||||||||||||||||||||||||
| 320 | } | - | ||||||||||||||||||||||||
| 321 | - | |||||||||||||||||||||||||
| 322 | - | |||||||||||||||||||||||||
| 323 | - | |||||||||||||||||||||||||
| 324 | - | |||||||||||||||||||||||||
| 325 | void QGraphicsGridLayout::setColumnMaximumWidth(int column, qreal width) | - | ||||||||||||||||||||||||
| 326 | { | - | ||||||||||||||||||||||||
| 327 | QGraphicsGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 328 | d->engine.setRowSizeHint(Qt::MaximumSize, column, width, Qt::Horizontal); | - | ||||||||||||||||||||||||
| 329 | invalidate(); | - | ||||||||||||||||||||||||
| 330 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 331 | - | |||||||||||||||||||||||||
| 332 | - | |||||||||||||||||||||||||
| 333 | - | |||||||||||||||||||||||||
| 334 | - | |||||||||||||||||||||||||
| 335 | qreal QGraphicsGridLayout::columnMaximumWidth(int column) const | - | ||||||||||||||||||||||||
| 336 | { | - | ||||||||||||||||||||||||
| 337 | const QGraphicsGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 338 | return never executed: d->engine.rowSizeHint(Qt::MaximumSize, column, Qt::Horizontal);return d->engine.rowSizeHint(Qt::MaximumSize, column, Qt::Horizontal);never executed: return d->engine.rowSizeHint(Qt::MaximumSize, column, Qt::Horizontal); | 0 | ||||||||||||||||||||||||
| 339 | } | - | ||||||||||||||||||||||||
| 340 | - | |||||||||||||||||||||||||
| 341 | - | |||||||||||||||||||||||||
| 342 | - | |||||||||||||||||||||||||
| 343 | - | |||||||||||||||||||||||||
| 344 | void QGraphicsGridLayout::setColumnFixedWidth(int column, qreal width) | - | ||||||||||||||||||||||||
| 345 | { | - | ||||||||||||||||||||||||
| 346 | QGraphicsGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 347 | d->engine.setRowSizeHint(Qt::MinimumSize, column, width, Qt::Horizontal); | - | ||||||||||||||||||||||||
| 348 | d->engine.setRowSizeHint(Qt::MaximumSize, column, width, Qt::Horizontal); | - | ||||||||||||||||||||||||
| 349 | invalidate(); | - | ||||||||||||||||||||||||
| 350 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 351 | - | |||||||||||||||||||||||||
| 352 | - | |||||||||||||||||||||||||
| 353 | - | |||||||||||||||||||||||||
| 354 | - | |||||||||||||||||||||||||
| 355 | void QGraphicsGridLayout::setRowAlignment(int row, Qt::Alignment alignment) | - | ||||||||||||||||||||||||
| 356 | { | - | ||||||||||||||||||||||||
| 357 | QGraphicsGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 358 | d->engine.setRowAlignment(row, alignment, Qt::Vertical); | - | ||||||||||||||||||||||||
| 359 | invalidate(); | - | ||||||||||||||||||||||||
| 360 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 361 | - | |||||||||||||||||||||||||
| 362 | - | |||||||||||||||||||||||||
| 363 | - | |||||||||||||||||||||||||
| 364 | - | |||||||||||||||||||||||||
| 365 | Qt::Alignment QGraphicsGridLayout::rowAlignment(int row) const | - | ||||||||||||||||||||||||
| 366 | { | - | ||||||||||||||||||||||||
| 367 | const QGraphicsGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 368 | return never executed: d->engine.rowAlignment(row, Qt::Vertical);return d->engine.rowAlignment(row, Qt::Vertical);never executed: return d->engine.rowAlignment(row, Qt::Vertical); | 0 | ||||||||||||||||||||||||
| 369 | } | - | ||||||||||||||||||||||||
| 370 | - | |||||||||||||||||||||||||
| 371 | - | |||||||||||||||||||||||||
| 372 | - | |||||||||||||||||||||||||
| 373 | - | |||||||||||||||||||||||||
| 374 | void QGraphicsGridLayout::setColumnAlignment(int column, Qt::Alignment alignment) | - | ||||||||||||||||||||||||
| 375 | { | - | ||||||||||||||||||||||||
| 376 | QGraphicsGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 377 | d->engine.setRowAlignment(column, alignment, Qt::Horizontal); | - | ||||||||||||||||||||||||
| 378 | invalidate(); | - | ||||||||||||||||||||||||
| 379 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 380 | - | |||||||||||||||||||||||||
| 381 | - | |||||||||||||||||||||||||
| 382 | - | |||||||||||||||||||||||||
| 383 | - | |||||||||||||||||||||||||
| 384 | Qt::Alignment QGraphicsGridLayout::columnAlignment(int column) const | - | ||||||||||||||||||||||||
| 385 | { | - | ||||||||||||||||||||||||
| 386 | const QGraphicsGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 387 | return never executed: d->engine.rowAlignment(column, Qt::Horizontal);return d->engine.rowAlignment(column, Qt::Horizontal);never executed: return d->engine.rowAlignment(column, Qt::Horizontal); | 0 | ||||||||||||||||||||||||
| 388 | } | - | ||||||||||||||||||||||||
| 389 | - | |||||||||||||||||||||||||
| 390 | - | |||||||||||||||||||||||||
| 391 | - | |||||||||||||||||||||||||
| 392 | - | |||||||||||||||||||||||||
| 393 | void QGraphicsGridLayout::setAlignment(QGraphicsLayoutItem *item, Qt::Alignment alignment) | - | ||||||||||||||||||||||||
| 394 | { | - | ||||||||||||||||||||||||
| 395 | QGraphicsGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 396 | d->engine.setAlignment(item, alignment); | - | ||||||||||||||||||||||||
| 397 | invalidate(); | - | ||||||||||||||||||||||||
| 398 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 399 | - | |||||||||||||||||||||||||
| 400 | - | |||||||||||||||||||||||||
| 401 | - | |||||||||||||||||||||||||
| 402 | - | |||||||||||||||||||||||||
| 403 | Qt::Alignment QGraphicsGridLayout::alignment(QGraphicsLayoutItem *item) const | - | ||||||||||||||||||||||||
| 404 | { | - | ||||||||||||||||||||||||
| 405 | const QGraphicsGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 406 | return never executed: d->engine.alignment(item);return d->engine.alignment(item);never executed: return d->engine.alignment(item); | 0 | ||||||||||||||||||||||||
| 407 | } | - | ||||||||||||||||||||||||
| 408 | - | |||||||||||||||||||||||||
| 409 | - | |||||||||||||||||||||||||
| 410 | - | |||||||||||||||||||||||||
| 411 | - | |||||||||||||||||||||||||
| 412 | - | |||||||||||||||||||||||||
| 413 | - | |||||||||||||||||||||||||
| 414 | int QGraphicsGridLayout::rowCount() const | - | ||||||||||||||||||||||||
| 415 | { | - | ||||||||||||||||||||||||
| 416 | const QGraphicsGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 417 | return never executed: d->engine.effectiveLastRow(Qt::Vertical) + 1;return d->engine.effectiveLastRow(Qt::Vertical) + 1;never executed: return d->engine.effectiveLastRow(Qt::Vertical) + 1; | 0 | ||||||||||||||||||||||||
| 418 | } | - | ||||||||||||||||||||||||
| 419 | - | |||||||||||||||||||||||||
| 420 | - | |||||||||||||||||||||||||
| 421 | - | |||||||||||||||||||||||||
| 422 | - | |||||||||||||||||||||||||
| 423 | - | |||||||||||||||||||||||||
| 424 | - | |||||||||||||||||||||||||
| 425 | int QGraphicsGridLayout::columnCount() const | - | ||||||||||||||||||||||||
| 426 | { | - | ||||||||||||||||||||||||
| 427 | const QGraphicsGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 428 | return never executed: d->engine.effectiveLastRow(Qt::Horizontal) + 1;return d->engine.effectiveLastRow(Qt::Horizontal) + 1;never executed: return d->engine.effectiveLastRow(Qt::Horizontal) + 1; | 0 | ||||||||||||||||||||||||
| 429 | } | - | ||||||||||||||||||||||||
| 430 | - | |||||||||||||||||||||||||
| 431 | - | |||||||||||||||||||||||||
| 432 | - | |||||||||||||||||||||||||
| 433 | - | |||||||||||||||||||||||||
| 434 | QGraphicsLayoutItem *QGraphicsGridLayout::itemAt(int row, int column) const | - | ||||||||||||||||||||||||
| 435 | { | - | ||||||||||||||||||||||||
| 436 | const QGraphicsGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 437 | if (row < 0
| 0 | ||||||||||||||||||||||||
| 438 | QMessageLogger(__FILE__, 533, __PRETTY_FUNCTION__).warning("QGraphicsGridLayout::itemAt: invalid row, column %d, %d", row, column); | - | ||||||||||||||||||||||||
| 439 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 440 | } | - | ||||||||||||||||||||||||
| 441 | if (QGraphicsGridLayoutEngineItem *engineItem = static_cast<QGraphicsGridLayoutEngineItem*>(d->engine.itemAt(row, column))
| 0 | ||||||||||||||||||||||||
| 442 | return never executed: engineItem->layoutItem();return engineItem->layoutItem();never executed: return engineItem->layoutItem(); | 0 | ||||||||||||||||||||||||
| 443 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 444 | } | - | ||||||||||||||||||||||||
| 445 | - | |||||||||||||||||||||||||
| 446 | - | |||||||||||||||||||||||||
| 447 | - | |||||||||||||||||||||||||
| 448 | - | |||||||||||||||||||||||||
| 449 | int QGraphicsGridLayout::count() const | - | ||||||||||||||||||||||||
| 450 | { | - | ||||||||||||||||||||||||
| 451 | const QGraphicsGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 452 | return never executed: d->engine.itemCount();return d->engine.itemCount();never executed: return d->engine.itemCount(); | 0 | ||||||||||||||||||||||||
| 453 | } | - | ||||||||||||||||||||||||
| 454 | - | |||||||||||||||||||||||||
| 455 | - | |||||||||||||||||||||||||
| 456 | - | |||||||||||||||||||||||||
| 457 | - | |||||||||||||||||||||||||
| 458 | - | |||||||||||||||||||||||||
| 459 | QGraphicsLayoutItem *QGraphicsGridLayout::itemAt(int index) const | - | ||||||||||||||||||||||||
| 460 | { | - | ||||||||||||||||||||||||
| 461 | const QGraphicsGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 462 | if (index < 0
| 0 | ||||||||||||||||||||||||
| 463 | QMessageLogger(__FILE__, 558, __PRETTY_FUNCTION__).warning("QGraphicsGridLayout::itemAt: invalid index %d", index); | - | ||||||||||||||||||||||||
| 464 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 465 | } | - | ||||||||||||||||||||||||
| 466 | QGraphicsLayoutItem *item = 0; | - | ||||||||||||||||||||||||
| 467 | if (QGraphicsGridLayoutEngineItem *engineItem = static_cast<QGraphicsGridLayoutEngineItem*>(d->engine.itemAt(index))
| 0 | ||||||||||||||||||||||||
| 468 | item = engineItem->layoutItem(); never executed: item = engineItem->layoutItem(); | 0 | ||||||||||||||||||||||||
| 469 | return never executed: item;return item;never executed: return item; | 0 | ||||||||||||||||||||||||
| 470 | } | - | ||||||||||||||||||||||||
| 471 | - | |||||||||||||||||||||||||
| 472 | - | |||||||||||||||||||||||||
| 473 | - | |||||||||||||||||||||||||
| 474 | - | |||||||||||||||||||||||||
| 475 | - | |||||||||||||||||||||||||
| 476 | - | |||||||||||||||||||||||||
| 477 | - | |||||||||||||||||||||||||
| 478 | void QGraphicsGridLayout::removeAt(int index) | - | ||||||||||||||||||||||||
| 479 | { | - | ||||||||||||||||||||||||
| 480 | QGraphicsGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 481 | if (index < 0
| 0 | ||||||||||||||||||||||||
| 482 | QMessageLogger(__FILE__, 577, __PRETTY_FUNCTION__).warning("QGraphicsGridLayout::removeAt: invalid index %d", index); | - | ||||||||||||||||||||||||
| 483 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 484 | } | - | ||||||||||||||||||||||||
| 485 | - | |||||||||||||||||||||||||
| 486 | if (QGraphicsGridLayoutEngineItem *gridItem = static_cast<QGraphicsGridLayoutEngineItem*>(d->engine.itemAt(index))
| 0 | ||||||||||||||||||||||||
| 487 | if (QGraphicsLayoutItem *layoutItem = gridItem->layoutItem()
| 0 | ||||||||||||||||||||||||
| 488 | layoutItem->setParentLayoutItem(0); never executed: layoutItem->setParentLayoutItem(0); | 0 | ||||||||||||||||||||||||
| 489 | d->engine.removeItem(gridItem); | - | ||||||||||||||||||||||||
| 490 | - | |||||||||||||||||||||||||
| 491 | - | |||||||||||||||||||||||||
| 492 | for (int j = 0; j < NOrientations
| 0 | ||||||||||||||||||||||||
| 493 | - | |||||||||||||||||||||||||
| 494 | const Qt::Orientation orient = (j == 0
| 0 | ||||||||||||||||||||||||
| 495 | const int oldCount = d->engine.rowCount(orient); | - | ||||||||||||||||||||||||
| 496 | if (gridItem->lastRow(orient) == oldCount - 1
| 0 | ||||||||||||||||||||||||
| 497 | const int newCount = d->engine.effectiveLastRow(orient) + 1; | - | ||||||||||||||||||||||||
| 498 | d->engine.removeRows(newCount, oldCount - newCount, orient); | - | ||||||||||||||||||||||||
| 499 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 500 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 501 | - | |||||||||||||||||||||||||
| 502 | delete gridItem; | - | ||||||||||||||||||||||||
| 503 | invalidate(); | - | ||||||||||||||||||||||||
| 504 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 505 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 506 | - | |||||||||||||||||||||||||
| 507 | - | |||||||||||||||||||||||||
| 508 | - | |||||||||||||||||||||||||
| 509 | - | |||||||||||||||||||||||||
| 510 | - | |||||||||||||||||||||||||
| 511 | - | |||||||||||||||||||||||||
| 512 | - | |||||||||||||||||||||||||
| 513 | void QGraphicsGridLayout::removeItem(QGraphicsLayoutItem *item) | - | ||||||||||||||||||||||||
| 514 | { | - | ||||||||||||||||||||||||
| 515 | QGraphicsGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 516 | int index = d->engine.indexOf(item); | - | ||||||||||||||||||||||||
| 517 | removeAt(index); | - | ||||||||||||||||||||||||
| 518 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 519 | - | |||||||||||||||||||||||||
| 520 | - | |||||||||||||||||||||||||
| 521 | - | |||||||||||||||||||||||||
| 522 | void QGraphicsGridLayout::invalidate() | - | ||||||||||||||||||||||||
| 523 | { | - | ||||||||||||||||||||||||
| 524 | QGraphicsGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 525 | d->engine.invalidate(); | - | ||||||||||||||||||||||||
| 526 | if (d->m_styleInfo
| 0 | ||||||||||||||||||||||||
| 527 | d->m_styleInfo->invalidate(); never executed: d->m_styleInfo->invalidate(); | 0 | ||||||||||||||||||||||||
| 528 | QGraphicsLayout::invalidate(); | - | ||||||||||||||||||||||||
| 529 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 530 | void QGraphicsGridLayout::setGeometry(const QRectF &rect) | - | ||||||||||||||||||||||||
| 531 | { | - | ||||||||||||||||||||||||
| 532 | QGraphicsGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 533 | QGraphicsLayout::setGeometry(rect); | - | ||||||||||||||||||||||||
| 534 | QRectF effectiveRect = geometry(); | - | ||||||||||||||||||||||||
| 535 | qreal left, top, right, bottom; | - | ||||||||||||||||||||||||
| 536 | getContentsMargins(&left, &top, &right, &bottom); | - | ||||||||||||||||||||||||
| 537 | Qt::LayoutDirection visualDir = d->visualDirection(); | - | ||||||||||||||||||||||||
| 538 | d->engine.setVisualDirection(visualDir); | - | ||||||||||||||||||||||||
| 539 | if (visualDir == Qt::RightToLeft
| 0 | ||||||||||||||||||||||||
| 540 | qSwap(left, right); never executed: qSwap(left, right); | 0 | ||||||||||||||||||||||||
| 541 | effectiveRect.adjust(+left, +top, -right, -bottom); | - | ||||||||||||||||||||||||
| 542 | d->engine.setGeometries(effectiveRect, d->styleInfo()); | - | ||||||||||||||||||||||||
| 543 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 544 | - | |||||||||||||||||||||||||
| 545 | - | |||||||||||||||||||||||||
| 546 | - | |||||||||||||||||||||||||
| 547 | - | |||||||||||||||||||||||||
| 548 | QSizeF QGraphicsGridLayout::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const | - | ||||||||||||||||||||||||
| 549 | { | - | ||||||||||||||||||||||||
| 550 | const QGraphicsGridLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 551 | qreal left, top, right, bottom; | - | ||||||||||||||||||||||||
| 552 | getContentsMargins(&left, &top, &right, &bottom); | - | ||||||||||||||||||||||||
| 553 | const QSizeF extraMargins(left + right, top + bottom); | - | ||||||||||||||||||||||||
| 554 | return never executed: d->engine.sizeHint(which , constraint - extraMargins, d->styleInfo()) + extraMargins;return d->engine.sizeHint(which , constraint - extraMargins, d->styleInfo()) + extraMargins;never executed: return d->engine.sizeHint(which , constraint - extraMargins, d->styleInfo()) + extraMargins; | 0 | ||||||||||||||||||||||||
| 555 | } | - | ||||||||||||||||||||||||
| 556 | - | |||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |