| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/widgets/kernel/qstackedlayout.cpp | 
| Switch to Source code | Preprocessed file | 
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||
| 2 | - | |||||||||||||||||||
| 3 | - | |||||||||||||||||||
| 4 | - | |||||||||||||||||||
| 5 | class QStackedLayoutPrivate : public QLayoutPrivate | - | ||||||||||||||||||
| 6 | { | - | ||||||||||||||||||
| 7 | inline QStackedLayout* q_func() { return static_cast<QStackedLayout *>(q_ptr); } inline const QStackedLayout* q_func() const { return static_cast<const QStackedLayout *>(q_ptr); } friend class QStackedLayout; | - | ||||||||||||||||||
| 8 | public: | - | ||||||||||||||||||
| 9 |     QStackedLayoutPrivate() : index(-1), stackingMode(QStackedLayout::StackOne) {} never executed:  end of block | 0 | ||||||||||||||||||
| 10 | QLayoutItem* replaceAt(int index, QLayoutItem *newitem) override; | - | ||||||||||||||||||
| 11 | QList<QLayoutItem *> list; | - | ||||||||||||||||||
| 12 | int index; | - | ||||||||||||||||||
| 13 | QStackedLayout::StackingMode stackingMode; | - | ||||||||||||||||||
| 14 | }; | - | ||||||||||||||||||
| 15 | - | |||||||||||||||||||
| 16 | QLayoutItem* QStackedLayoutPrivate::replaceAt(int idx, QLayoutItem *newitem) | - | ||||||||||||||||||
| 17 | { | - | ||||||||||||||||||
| 18 | QStackedLayout * const q = q_func(); | - | ||||||||||||||||||
| 19 |     if (idx < 0
 
 
  | 0 | ||||||||||||||||||
| 20 |         return never executed:   0;return 0;never executed:  return 0; | 0 | ||||||||||||||||||
| 21 | QWidget *wdg = newitem->widget(); | - | ||||||||||||||||||
| 22 |     if (!wdg
  | 0 | ||||||||||||||||||
| 23 | QMessageLogger(__FILE__, 61, __PRETTY_FUNCTION__).warning("QStackedLayout::replaceAt: Only widgets can be added"); | - | ||||||||||||||||||
| 24 |         return never executed:   0;return 0;never executed:  return 0; | 0 | ||||||||||||||||||
| 25 | } | - | ||||||||||||||||||
| 26 | QLayoutItem *orgitem = list.at(idx); | - | ||||||||||||||||||
| 27 | list.replace(idx, newitem); | - | ||||||||||||||||||
| 28 |     if (idx == index
  | 0 | ||||||||||||||||||
| 29 |         q->setCurrentIndex(index); never executed:  q->setCurrentIndex(index); | 0 | ||||||||||||||||||
| 30 |     return never executed:   orgitem;return orgitem;never executed:  return orgitem; | 0 | ||||||||||||||||||
| 31 | } | - | ||||||||||||||||||
| 32 | QStackedLayout::QStackedLayout() | - | ||||||||||||||||||
| 33 | : QLayout(*new QStackedLayoutPrivate, 0, 0) | - | ||||||||||||||||||
| 34 | { | - | ||||||||||||||||||
| 35 | } never executed:  end of block | 0 | ||||||||||||||||||
| 36 | - | |||||||||||||||||||
| 37 | - | |||||||||||||||||||
| 38 | - | |||||||||||||||||||
| 39 | - | |||||||||||||||||||
| 40 | - | |||||||||||||||||||
| 41 | - | |||||||||||||||||||
| 42 | - | |||||||||||||||||||
| 43 | QStackedLayout::QStackedLayout(QWidget *parent) | - | ||||||||||||||||||
| 44 | : QLayout(*new QStackedLayoutPrivate, 0, parent) | - | ||||||||||||||||||
| 45 | { | - | ||||||||||||||||||
| 46 | } never executed:  end of block | 0 | ||||||||||||||||||
| 47 | - | |||||||||||||||||||
| 48 | - | |||||||||||||||||||
| 49 | - | |||||||||||||||||||
| 50 | - | |||||||||||||||||||
| 51 | - | |||||||||||||||||||
| 52 | QStackedLayout::QStackedLayout(QLayout *parentLayout) | - | ||||||||||||||||||
| 53 | : QLayout(*new QStackedLayoutPrivate, parentLayout, 0) | - | ||||||||||||||||||
| 54 | { | - | ||||||||||||||||||
| 55 | } never executed:  end of block | 0 | ||||||||||||||||||
| 56 | - | |||||||||||||||||||
| 57 | - | |||||||||||||||||||
| 58 | - | |||||||||||||||||||
| 59 | - | |||||||||||||||||||
| 60 | - | |||||||||||||||||||
| 61 | QStackedLayout::~QStackedLayout() | - | ||||||||||||||||||
| 62 | { | - | ||||||||||||||||||
| 63 | QStackedLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||
| 64 | qDeleteAll(d->list); | - | ||||||||||||||||||
| 65 | } never executed:  end of block | 0 | ||||||||||||||||||
| 66 | int QStackedLayout::addWidget(QWidget *widget) | - | ||||||||||||||||||
| 67 | { | - | ||||||||||||||||||
| 68 | QStackedLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||
| 69 |     return never executed:   insertWidget(d->list.count(), widget);return insertWidget(d->list.count(), widget);never executed:  return insertWidget(d->list.count(), widget); | 0 | ||||||||||||||||||
| 70 | } | - | ||||||||||||||||||
| 71 | int QStackedLayout::insertWidget(int index, QWidget *widget) | - | ||||||||||||||||||
| 72 | { | - | ||||||||||||||||||
| 73 | QStackedLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||
| 74 | addChildWidget(widget); | - | ||||||||||||||||||
| 75 | index = qMin(index, d->list.count()); | - | ||||||||||||||||||
| 76 |     if (index < 0
  | 0 | ||||||||||||||||||
| 77 |         index = d->list.count(); never executed:  index = d->list.count(); | 0 | ||||||||||||||||||
| 78 | QWidgetItem *wi = QLayoutPrivate::createWidgetItem(this, widget); | - | ||||||||||||||||||
| 79 | d->list.insert(index, wi); | - | ||||||||||||||||||
| 80 | invalidate(); | - | ||||||||||||||||||
| 81 |     if (d->index < 0
  | 0 | ||||||||||||||||||
| 82 | setCurrentIndex(index); | - | ||||||||||||||||||
| 83 |     } never executed:   else {end of block | 0 | ||||||||||||||||||
| 84 |         if (index <= d->index
  | 0 | ||||||||||||||||||
| 85 |             ++ never executed:  d->index;++d->index;never executed:  ++d->index; | 0 | ||||||||||||||||||
| 86 |         if (d->stackingMode == StackOne
  | 0 | ||||||||||||||||||
| 87 |             widget->hide(); never executed:  widget->hide(); | 0 | ||||||||||||||||||
| 88 | widget->lower(); | - | ||||||||||||||||||
| 89 |     } never executed:  end of block | 0 | ||||||||||||||||||
| 90 |     return never executed:   index;return index;never executed:  return index; | 0 | ||||||||||||||||||
| 91 | } | - | ||||||||||||||||||
| 92 | - | |||||||||||||||||||
| 93 | - | |||||||||||||||||||
| 94 | - | |||||||||||||||||||
| 95 | - | |||||||||||||||||||
| 96 | QLayoutItem *QStackedLayout::itemAt(int index) const | - | ||||||||||||||||||
| 97 | { | - | ||||||||||||||||||
| 98 | const QStackedLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||
| 99 |     return never executed:   d->list.value(index);return d->list.value(index);never executed:  return d->list.value(index); | 0 | ||||||||||||||||||
| 100 | } | - | ||||||||||||||||||
| 101 | - | |||||||||||||||||||
| 102 | - | |||||||||||||||||||
| 103 | - | |||||||||||||||||||
| 104 | - | |||||||||||||||||||
| 105 | static bool qt_wasDeleted(const QWidget *w) | - | ||||||||||||||||||
| 106 | { | - | ||||||||||||||||||
| 107 |     return never executed:   QWidgetPrivate::get(w)->wasDeleted;return QWidgetPrivate::get(w)->wasDeleted;never executed:  return QWidgetPrivate::get(w)->wasDeleted; | 0 | ||||||||||||||||||
| 108 | } | - | ||||||||||||||||||
| 109 | - | |||||||||||||||||||
| 110 | - | |||||||||||||||||||
| 111 | - | |||||||||||||||||||
| 112 | - | |||||||||||||||||||
| 113 | - | |||||||||||||||||||
| 114 | QLayoutItem *QStackedLayout::takeAt(int index) | - | ||||||||||||||||||
| 115 | { | - | ||||||||||||||||||
| 116 | QStackedLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||
| 117 |     if (index <0
 
  | 0 | ||||||||||||||||||
| 118 |         return never executed:   0;return 0;never executed:  return 0; | 0 | ||||||||||||||||||
| 119 | QLayoutItem *item = d->list.takeAt(index); | - | ||||||||||||||||||
| 120 |     if (index == d->index
  | 0 | ||||||||||||||||||
| 121 | d->index = -1; | - | ||||||||||||||||||
| 122 |         if ( d->list.count() > 0
  | 0 | ||||||||||||||||||
| 123 |             int newIndex = (
 
  | 0 | ||||||||||||||||||
| 124 | setCurrentIndex(newIndex); | - | ||||||||||||||||||
| 125 |         } never executed:   else {end of block | 0 | ||||||||||||||||||
| 126 | currentChanged(-1); | - | ||||||||||||||||||
| 127 |         } never executed:  end of block | 0 | ||||||||||||||||||
| 128 |     } else if (index < d->index
  | 0 | ||||||||||||||||||
| 129 | --d->index; | - | ||||||||||||||||||
| 130 |     } never executed:  end of block | 0 | ||||||||||||||||||
| 131 | widgetRemoved(index); | - | ||||||||||||||||||
| 132 |     if (item->widget()
 
  | 0 | ||||||||||||||||||
| 133 |         item->widget()->hide(); never executed:  item->widget()->hide(); | 0 | ||||||||||||||||||
| 134 |     return never executed:   item;return item;never executed:  return item; | 0 | ||||||||||||||||||
| 135 | } | - | ||||||||||||||||||
| 136 | void QStackedLayout::setCurrentIndex(int index) | - | ||||||||||||||||||
| 137 | { | - | ||||||||||||||||||
| 138 | QStackedLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||
| 139 | QWidget *prev = currentWidget(); | - | ||||||||||||||||||
| 140 | QWidget *next = widget(index); | - | ||||||||||||||||||
| 141 |     if (!next
 
  | 0 | ||||||||||||||||||
| 142 |         return; never executed:  return; | 0 | ||||||||||||||||||
| 143 | - | |||||||||||||||||||
| 144 | bool reenableUpdates = false; | - | ||||||||||||||||||
| 145 | QWidget *parent = parentWidget(); | - | ||||||||||||||||||
| 146 | - | |||||||||||||||||||
| 147 |     if (parent
 
  | 0 | ||||||||||||||||||
| 148 | reenableUpdates = true; | - | ||||||||||||||||||
| 149 | parent->setUpdatesEnabled(false); | - | ||||||||||||||||||
| 150 |     } never executed:  end of block | 0 | ||||||||||||||||||
| 151 | - | |||||||||||||||||||
| 152 |     QPointer<QWidget> fw = parent
  | 0 | ||||||||||||||||||
| 153 |     const bool focusWasOnOldPage = fw
 
 
  | 0 | ||||||||||||||||||
| 154 | - | |||||||||||||||||||
| 155 |     if (prev
  | 0 | ||||||||||||||||||
| 156 | prev->clearFocus(); | - | ||||||||||||||||||
| 157 |         if (d->stackingMode == StackOne
  | 0 | ||||||||||||||||||
| 158 |             prev->hide(); never executed:  prev->hide(); | 0 | ||||||||||||||||||
| 159 |     } never executed:  end of block | 0 | ||||||||||||||||||
| 160 | - | |||||||||||||||||||
| 161 | d->index = index; | - | ||||||||||||||||||
| 162 | next->raise(); | - | ||||||||||||||||||
| 163 | next->show(); | - | ||||||||||||||||||
| 164 | - | |||||||||||||||||||
| 165 | - | |||||||||||||||||||
| 166 | - | |||||||||||||||||||
| 167 | - | |||||||||||||||||||
| 168 |     if (parent
  | 0 | ||||||||||||||||||
| 169 |         if (focusWasOnOldPage
  | 0 | ||||||||||||||||||
| 170 | - | |||||||||||||||||||
| 171 |             if (QWidget *nfw = next->focusWidget()
  | 0 | ||||||||||||||||||
| 172 |                 nfw->setFocus(); never executed:  nfw->setFocus(); | 0 | ||||||||||||||||||
| 173 | else { | - | ||||||||||||||||||
| 174 | - | |||||||||||||||||||
| 175 |                 if (QWidget *i = fw
  | 0 | ||||||||||||||||||
| 176 |                     while ((
 
  | 0 | ||||||||||||||||||
| 177 |                         if (((
 
  | 0 | ||||||||||||||||||
| 178 |                             && !i->focusProxy()
 
 
  | 0 | ||||||||||||||||||
| 179 |                             && next->isAncestorOf(i)
  | 0 | ||||||||||||||||||
| 180 | i->setFocus(); | - | ||||||||||||||||||
| 181 |                             break; never executed:  break; | 0 | ||||||||||||||||||
| 182 | } | - | ||||||||||||||||||
| 183 |                     } never executed:  end of block | 0 | ||||||||||||||||||
| 184 | - | |||||||||||||||||||
| 185 |                     if (i == fw
  | 0 | ||||||||||||||||||
| 186 |                         next->setFocus(); never executed:  next->setFocus(); | 0 | ||||||||||||||||||
| 187 |                 } never executed:  end of block | 0 | ||||||||||||||||||
| 188 |             } never executed:  end of block | 0 | ||||||||||||||||||
| 189 | } | - | ||||||||||||||||||
| 190 |     } never executed:  end of block | 0 | ||||||||||||||||||
| 191 |     if (reenableUpdates
  | 0 | ||||||||||||||||||
| 192 |         parent->setUpdatesEnabled(true); never executed:  parent->setUpdatesEnabled(true); | 0 | ||||||||||||||||||
| 193 | currentChanged(index); | - | ||||||||||||||||||
| 194 | } never executed:  end of block | 0 | ||||||||||||||||||
| 195 | - | |||||||||||||||||||
| 196 | int QStackedLayout::currentIndex() const | - | ||||||||||||||||||
| 197 | { | - | ||||||||||||||||||
| 198 | const QStackedLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||
| 199 |     return never executed:   d->index;return d->index;never executed:  return d->index; | 0 | ||||||||||||||||||
| 200 | } | - | ||||||||||||||||||
| 201 | void QStackedLayout::setCurrentWidget(QWidget *widget) | - | ||||||||||||||||||
| 202 | { | - | ||||||||||||||||||
| 203 | int index = indexOf(widget); | - | ||||||||||||||||||
| 204 |     if (index == -1
  | 0 | ||||||||||||||||||
| 205 | QMessageLogger(__FILE__, 367, __PRETTY_FUNCTION__).warning("QStackedLayout::setCurrentWidget: Widget %p not contained in stack", widget); | - | ||||||||||||||||||
| 206 |         return; never executed:  return; | 0 | ||||||||||||||||||
| 207 | } | - | ||||||||||||||||||
| 208 | setCurrentIndex(index); | - | ||||||||||||||||||
| 209 | } never executed:  end of block | 0 | ||||||||||||||||||
| 210 | QWidget *QStackedLayout::currentWidget() const | - | ||||||||||||||||||
| 211 | { | - | ||||||||||||||||||
| 212 | const QStackedLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||
| 213 |     return never executed:   d->index >= 0return d->index >= 0 ? d->list.at(d->index)->widget() : 0;
 never executed:  return d->index >= 0 ? d->list.at(d->index)->widget() : 0; | 0 | ||||||||||||||||||
| 214 | } | - | ||||||||||||||||||
| 215 | - | |||||||||||||||||||
| 216 | - | |||||||||||||||||||
| 217 | - | |||||||||||||||||||
| 218 | - | |||||||||||||||||||
| 219 | - | |||||||||||||||||||
| 220 | - | |||||||||||||||||||
| 221 | - | |||||||||||||||||||
| 222 | QWidget *QStackedLayout::widget(int index) const | - | ||||||||||||||||||
| 223 | { | - | ||||||||||||||||||
| 224 | const QStackedLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||
| 225 |      if (index < 0
 
  | 0 | ||||||||||||||||||
| 226 |         return never executed:   0;return 0;never executed:  return 0; | 0 | ||||||||||||||||||
| 227 |     return never executed:   d->list.at(index)->widget();return d->list.at(index)->widget();never executed:  return d->list.at(index)->widget(); | 0 | ||||||||||||||||||
| 228 | } | - | ||||||||||||||||||
| 229 | - | |||||||||||||||||||
| 230 | - | |||||||||||||||||||
| 231 | - | |||||||||||||||||||
| 232 | - | |||||||||||||||||||
| 233 | - | |||||||||||||||||||
| 234 | - | |||||||||||||||||||
| 235 | - | |||||||||||||||||||
| 236 | int QStackedLayout::count() const | - | ||||||||||||||||||
| 237 | { | - | ||||||||||||||||||
| 238 | const QStackedLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||
| 239 |     return never executed:   d->list.size();return d->list.size();never executed:  return d->list.size(); | 0 | ||||||||||||||||||
| 240 | } | - | ||||||||||||||||||
| 241 | - | |||||||||||||||||||
| 242 | - | |||||||||||||||||||
| 243 | - | |||||||||||||||||||
| 244 | - | |||||||||||||||||||
| 245 | - | |||||||||||||||||||
| 246 | void QStackedLayout::addItem(QLayoutItem *item) | - | ||||||||||||||||||
| 247 | { | - | ||||||||||||||||||
| 248 | QWidget *widget = item->widget(); | - | ||||||||||||||||||
| 249 |     if (widget
  | 0 | ||||||||||||||||||
| 250 | addWidget(widget); | - | ||||||||||||||||||
| 251 | delete item; | - | ||||||||||||||||||
| 252 |     } never executed:   else {end of block | 0 | ||||||||||||||||||
| 253 | QMessageLogger(__FILE__, 423, __PRETTY_FUNCTION__).warning("QStackedLayout::addItem: Only widgets can be added"); | - | ||||||||||||||||||
| 254 |     } never executed:  end of block | 0 | ||||||||||||||||||
| 255 | } | - | ||||||||||||||||||
| 256 | - | |||||||||||||||||||
| 257 | - | |||||||||||||||||||
| 258 | - | |||||||||||||||||||
| 259 | - | |||||||||||||||||||
| 260 | QSize QStackedLayout::sizeHint() const | - | ||||||||||||||||||
| 261 | { | - | ||||||||||||||||||
| 262 | const QStackedLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||
| 263 | QSize s(0, 0); | - | ||||||||||||||||||
| 264 | int n = d->list.count(); | - | ||||||||||||||||||
| 265 | - | |||||||||||||||||||
| 266 |     for (int i = 0; i < n
  | 0 | ||||||||||||||||||
| 267 |         if (QWidget *widget = d->list.at(i)->widget()
  | 0 | ||||||||||||||||||
| 268 | QSize ws(widget->sizeHint()); | - | ||||||||||||||||||
| 269 |             if (widget->sizePolicy().horizontalPolicy() == QSizePolicy::Ignored
  | 0 | ||||||||||||||||||
| 270 |                 ws.setWidth(0); never executed:  ws.setWidth(0); | 0 | ||||||||||||||||||
| 271 |             if (widget->sizePolicy().verticalPolicy() == QSizePolicy::Ignored
  | 0 | ||||||||||||||||||
| 272 |                 ws.setHeight(0); never executed:  ws.setHeight(0); | 0 | ||||||||||||||||||
| 273 | s = s.expandedTo(ws); | - | ||||||||||||||||||
| 274 |         } never executed:  end of block | 0 | ||||||||||||||||||
| 275 |     return never executed:   s;return s;never executed:  return s; | 0 | ||||||||||||||||||
| 276 | } | - | ||||||||||||||||||
| 277 | - | |||||||||||||||||||
| 278 | - | |||||||||||||||||||
| 279 | - | |||||||||||||||||||
| 280 | - | |||||||||||||||||||
| 281 | QSize QStackedLayout::minimumSize() const | - | ||||||||||||||||||
| 282 | { | - | ||||||||||||||||||
| 283 | const QStackedLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||
| 284 | QSize s(0, 0); | - | ||||||||||||||||||
| 285 | int n = d->list.count(); | - | ||||||||||||||||||
| 286 | - | |||||||||||||||||||
| 287 |     for (int i = 0; i < n
  | 0 | ||||||||||||||||||
| 288 |         if (QWidget *widget = d->list.at(i)->widget()
  | 0 | ||||||||||||||||||
| 289 |             s = s.expandedTo(qSmartMinSize(widget)); never executed:  s = s.expandedTo(qSmartMinSize(widget)); | 0 | ||||||||||||||||||
| 290 |     return never executed:   s;return s;never executed:  return s; | 0 | ||||||||||||||||||
| 291 | } | - | ||||||||||||||||||
| 292 | - | |||||||||||||||||||
| 293 | - | |||||||||||||||||||
| 294 | - | |||||||||||||||||||
| 295 | - | |||||||||||||||||||
| 296 | void QStackedLayout::setGeometry(const QRect &rect) | - | ||||||||||||||||||
| 297 | { | - | ||||||||||||||||||
| 298 | QStackedLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||
| 299 | switch (d->stackingMode) { | - | ||||||||||||||||||
| 300 |     case never executed:   StackOne:case StackOne:never executed:  case StackOne: | 0 | ||||||||||||||||||
| 301 |         if (QWidget *widget = currentWidget()
  | 0 | ||||||||||||||||||
| 302 |             widget->setGeometry(rect); never executed:  widget->setGeometry(rect); | 0 | ||||||||||||||||||
| 303 |         break; never executed:  break; | 0 | ||||||||||||||||||
| 304 |     case never executed:   StackAll:case StackAll:never executed:  case StackAll: | 0 | ||||||||||||||||||
| 305 |         if (const
 
  | 0 | ||||||||||||||||||
| 306 |             for (int i = 0; i < n
  | 0 | ||||||||||||||||||
| 307 |                 if (QWidget *widget = d->list.at(i)->widget()
  | 0 | ||||||||||||||||||
| 308 |                     widget->setGeometry(rect); never executed:  widget->setGeometry(rect); | 0 | ||||||||||||||||||
| 309 |         break; never executed:  break; | 0 | ||||||||||||||||||
| 310 | } | - | ||||||||||||||||||
| 311 | } never executed:  end of block | 0 | ||||||||||||||||||
| 312 | - | |||||||||||||||||||
| 313 | - | |||||||||||||||||||
| 314 | - | |||||||||||||||||||
| 315 | - | |||||||||||||||||||
| 316 | bool QStackedLayout::hasHeightForWidth() const | - | ||||||||||||||||||
| 317 | { | - | ||||||||||||||||||
| 318 | const int n = count(); | - | ||||||||||||||||||
| 319 | - | |||||||||||||||||||
| 320 |     for (int i = 0; i < n
  | 0 | ||||||||||||||||||
| 321 |         if (QLayoutItem *item = itemAt(i)
  | 0 | ||||||||||||||||||
| 322 |             if (item->hasHeightForWidth()
  | 0 | ||||||||||||||||||
| 323 |                 return never executed:   true;return true;never executed:  return true; | 0 | ||||||||||||||||||
| 324 |         } never executed:  end of block | 0 | ||||||||||||||||||
| 325 |     } never executed:  end of block | 0 | ||||||||||||||||||
| 326 |     return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||
| 327 | } | - | ||||||||||||||||||
| 328 | - | |||||||||||||||||||
| 329 | - | |||||||||||||||||||
| 330 | - | |||||||||||||||||||
| 331 | - | |||||||||||||||||||
| 332 | int QStackedLayout::heightForWidth(int width) const | - | ||||||||||||||||||
| 333 | { | - | ||||||||||||||||||
| 334 | const int n = count(); | - | ||||||||||||||||||
| 335 | - | |||||||||||||||||||
| 336 | int hfw = 0; | - | ||||||||||||||||||
| 337 |     for (int i = 0; i < n
  | 0 | ||||||||||||||||||
| 338 |         if (QLayoutItem *item = itemAt(i)
  | 0 | ||||||||||||||||||
| 339 |             if (QWidget *w = item->widget()
  | 0 | ||||||||||||||||||
| 340 | - | |||||||||||||||||||
| 341 | - | |||||||||||||||||||
| 342 | - | |||||||||||||||||||
| 343 | - | |||||||||||||||||||
| 344 | - | |||||||||||||||||||
| 345 | - | |||||||||||||||||||
| 346 |                 hfw = qMax(hfw, w->heightForWidth(width)); never executed:  hfw = qMax(hfw, w->heightForWidth(width)); | 0 | ||||||||||||||||||
| 347 |         } never executed:  end of block | 0 | ||||||||||||||||||
| 348 |     } never executed:  end of block | 0 | ||||||||||||||||||
| 349 | hfw = qMax(hfw, minimumSize().height()); | - | ||||||||||||||||||
| 350 |     return never executed:   hfw;return hfw;never executed:  return hfw; | 0 | ||||||||||||||||||
| 351 | } | - | ||||||||||||||||||
| 352 | QStackedLayout::StackingMode QStackedLayout::stackingMode() const | - | ||||||||||||||||||
| 353 | { | - | ||||||||||||||||||
| 354 | const QStackedLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||
| 355 |     return never executed:   d->stackingMode;return d->stackingMode;never executed:  return d->stackingMode; | 0 | ||||||||||||||||||
| 356 | } | - | ||||||||||||||||||
| 357 | - | |||||||||||||||||||
| 358 | void QStackedLayout::setStackingMode(StackingMode stackingMode) | - | ||||||||||||||||||
| 359 | { | - | ||||||||||||||||||
| 360 | QStackedLayoutPrivate * const d = d_func(); | - | ||||||||||||||||||
| 361 |     if (d->stackingMode == stackingMode
  | 0 | ||||||||||||||||||
| 362 |         return; never executed:  return; | 0 | ||||||||||||||||||
| 363 | d->stackingMode = stackingMode; | - | ||||||||||||||||||
| 364 | - | |||||||||||||||||||
| 365 | const int n = d->list.count(); | - | ||||||||||||||||||
| 366 |     if (n == 0
  | 0 | ||||||||||||||||||
| 367 |         return; never executed:  return; | 0 | ||||||||||||||||||
| 368 | - | |||||||||||||||||||
| 369 | switch (d->stackingMode) { | - | ||||||||||||||||||
| 370 |     case never executed:   StackOne:case StackOne:never executed:  case StackOne: | 0 | ||||||||||||||||||
| 371 |         if (const
 
  | 0 | ||||||||||||||||||
| 372 |             for (int i = 0; i < n
  | 0 | ||||||||||||||||||
| 373 |                 if (QWidget *widget = d->list.at(i)->widget()
  | 0 | ||||||||||||||||||
| 374 |                     widget->setVisible(i == idx); never executed:  widget->setVisible(i == idx); | 0 | ||||||||||||||||||
| 375 |         break; never executed:  break; | 0 | ||||||||||||||||||
| 376 |     case never executed:   StackAll:case StackAll:never executed:   {case StackAll: | 0 | ||||||||||||||||||
| 377 | QRect geometry; | - | ||||||||||||||||||
| 378 |         if (const
 
  | 0 | ||||||||||||||||||
| 379 |             geometry = widget->geometry(); never executed:  geometry = widget->geometry(); | 0 | ||||||||||||||||||
| 380 |         for (int i = 0; i < n
  | 0 | ||||||||||||||||||
| 381 |             if (QWidget *widget = d->list.at(i)->widget()
  | 0 | ||||||||||||||||||
| 382 |                 if (!geometry.isNull()
  | 0 | ||||||||||||||||||
| 383 |                     widget->setGeometry(geometry); never executed:  widget->setGeometry(geometry); | 0 | ||||||||||||||||||
| 384 | widget->setVisible(true); | - | ||||||||||||||||||
| 385 |             } never executed:  end of block | 0 | ||||||||||||||||||
| 386 | } | - | ||||||||||||||||||
| 387 |         break; never executed:  break; | 0 | ||||||||||||||||||
| 388 | } | - | ||||||||||||||||||
| 389 | } never executed:  end of block | 0 | ||||||||||||||||||
| 390 | - | |||||||||||||||||||
| 391 | - | |||||||||||||||||||
| 392 | - | |||||||||||||||||||
| Switch to Source code | Preprocessed file |