| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/widgets/widgets/qsplitter.cpp | 
| Switch to Source code | Preprocessed file | 
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||
| 3 | - | |||||||||||||||||||||||||
| 4 | - | |||||||||||||||||||||||||
| 5 | - | |||||||||||||||||||||||||
| 6 | - | |||||||||||||||||||||||||
| 7 | - | |||||||||||||||||||||||||
| 8 | - | |||||||||||||||||||||||||
| 9 | - | |||||||||||||||||||||||||
| 10 | QSplitterPrivate::~QSplitterPrivate() | - | ||||||||||||||||||||||||
| 11 | { | - | ||||||||||||||||||||||||
| 12 | } | - | ||||||||||||||||||||||||
| 13 | QSplitterHandle::QSplitterHandle(Qt::Orientation orientation, QSplitter *parent) | - | ||||||||||||||||||||||||
| 14 | : QWidget(*new QSplitterHandlePrivate, parent, 0) | - | ||||||||||||||||||||||||
| 15 | { | - | ||||||||||||||||||||||||
| 16 | QSplitterHandlePrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 17 | d->s = parent; | - | ||||||||||||||||||||||||
| 18 | setOrientation(orientation); | - | ||||||||||||||||||||||||
| 19 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 20 | - | |||||||||||||||||||||||||
| 21 | - | |||||||||||||||||||||||||
| 22 | - | |||||||||||||||||||||||||
| 23 | - | |||||||||||||||||||||||||
| 24 | QSplitterHandle::~QSplitterHandle() | - | ||||||||||||||||||||||||
| 25 | { | - | ||||||||||||||||||||||||
| 26 | } | - | ||||||||||||||||||||||||
| 27 | - | |||||||||||||||||||||||||
| 28 | - | |||||||||||||||||||||||||
| 29 | - | |||||||||||||||||||||||||
| 30 | - | |||||||||||||||||||||||||
| 31 | - | |||||||||||||||||||||||||
| 32 | - | |||||||||||||||||||||||||
| 33 | - | |||||||||||||||||||||||||
| 34 | void QSplitterHandle::setOrientation(Qt::Orientation orientation) | - | ||||||||||||||||||||||||
| 35 | { | - | ||||||||||||||||||||||||
| 36 | QSplitterHandlePrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 37 | d->orient = orientation; | - | ||||||||||||||||||||||||
| 38 | - | |||||||||||||||||||||||||
| 39 | setCursor(orientation == Qt::Horizontal ? Qt::SplitHCursor : Qt::SplitVCursor); | - | ||||||||||||||||||||||||
| 40 | - | |||||||||||||||||||||||||
| 41 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 42 | - | |||||||||||||||||||||||||
| 43 | - | |||||||||||||||||||||||||
| 44 | - | |||||||||||||||||||||||||
| 45 | - | |||||||||||||||||||||||||
| 46 | - | |||||||||||||||||||||||||
| 47 | - | |||||||||||||||||||||||||
| 48 | Qt::Orientation QSplitterHandle::orientation() const | - | ||||||||||||||||||||||||
| 49 | { | - | ||||||||||||||||||||||||
| 50 | const QSplitterHandlePrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 51 |     return never executed:   d->orient;return d->orient;never executed:  return d->orient; | 0 | ||||||||||||||||||||||||
| 52 | } | - | ||||||||||||||||||||||||
| 53 | bool QSplitterHandle::opaqueResize() const | - | ||||||||||||||||||||||||
| 54 | { | - | ||||||||||||||||||||||||
| 55 | const QSplitterHandlePrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 56 |     return never executed:   d->s->opaqueResize();return d->s->opaqueResize();never executed:  return d->s->opaqueResize(); | 0 | ||||||||||||||||||||||||
| 57 | } | - | ||||||||||||||||||||||||
| 58 | - | |||||||||||||||||||||||||
| 59 | - | |||||||||||||||||||||||||
| 60 | - | |||||||||||||||||||||||||
| 61 | - | |||||||||||||||||||||||||
| 62 | - | |||||||||||||||||||||||||
| 63 | - | |||||||||||||||||||||||||
| 64 | - | |||||||||||||||||||||||||
| 65 | QSplitter *QSplitterHandle::splitter() const | - | ||||||||||||||||||||||||
| 66 | { | - | ||||||||||||||||||||||||
| 67 |     return never executed:   d_func()->s;return d_func()->s;never executed:  return d_func()->s; | 0 | ||||||||||||||||||||||||
| 68 | } | - | ||||||||||||||||||||||||
| 69 | void QSplitterHandle::moveSplitter(int pos) | - | ||||||||||||||||||||||||
| 70 | { | - | ||||||||||||||||||||||||
| 71 | QSplitterHandlePrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 72 |     if (d->s->isRightToLeft()
 
  | 0 | ||||||||||||||||||||||||
| 73 |         pos = d->s->contentsRect().width() - pos; never executed:  pos = d->s->contentsRect().width() - pos; | 0 | ||||||||||||||||||||||||
| 74 | d->s->moveSplitter(pos, d->s->indexOf(this)); | - | ||||||||||||||||||||||||
| 75 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 76 | int QSplitterHandle::closestLegalPosition(int pos) | - | ||||||||||||||||||||||||
| 77 | { | - | ||||||||||||||||||||||||
| 78 | QSplitterHandlePrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 79 | QSplitter *s = d->s; | - | ||||||||||||||||||||||||
| 80 |     if (s->isRightToLeft()
 
  | 0 | ||||||||||||||||||||||||
| 81 | int w = s->contentsRect().width(); | - | ||||||||||||||||||||||||
| 82 |         return never executed:   w - s->closestLegalPosition(w - pos, s->indexOf(this));return w - s->closestLegalPosition(w - pos, s->indexOf(this));never executed:  return w - s->closestLegalPosition(w - pos, s->indexOf(this)); | 0 | ||||||||||||||||||||||||
| 83 | } | - | ||||||||||||||||||||||||
| 84 |     return never executed:   s->closestLegalPosition(pos, s->indexOf(this));return s->closestLegalPosition(pos, s->indexOf(this));never executed:  return s->closestLegalPosition(pos, s->indexOf(this)); | 0 | ||||||||||||||||||||||||
| 85 | } | - | ||||||||||||||||||||||||
| 86 | - | |||||||||||||||||||||||||
| 87 | - | |||||||||||||||||||||||||
| 88 | - | |||||||||||||||||||||||||
| 89 | - | |||||||||||||||||||||||||
| 90 | QSize QSplitterHandle::sizeHint() const | - | ||||||||||||||||||||||||
| 91 | { | - | ||||||||||||||||||||||||
| 92 | const QSplitterHandlePrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 93 | int hw = d->s->handleWidth(); | - | ||||||||||||||||||||||||
| 94 | QStyleOption opt(0); | - | ||||||||||||||||||||||||
| 95 | opt.init(d->s); | - | ||||||||||||||||||||||||
| 96 | opt.state = QStyle::State_None; | - | ||||||||||||||||||||||||
| 97 |     return never executed:   parentWidget()->style()->sizeFromContents(QStyle::CT_Splitter, &opt, QSize(hw, hw), d->s)return parentWidget()->style()->sizeFromContents(QStyle::CT_Splitter, &opt, QSize(hw, hw), d->s) .expandedTo(QApplication::globalStrut());never executed:  return parentWidget()->style()->sizeFromContents(QStyle::CT_Splitter, &opt, QSize(hw, hw), d->s) .expandedTo(QApplication::globalStrut()); | 0 | ||||||||||||||||||||||||
| 98 |         .expandedTo(QApplication::globalStrut()); never executed:  return parentWidget()->style()->sizeFromContents(QStyle::CT_Splitter, &opt, QSize(hw, hw), d->s) .expandedTo(QApplication::globalStrut()); | 0 | ||||||||||||||||||||||||
| 99 | } | - | ||||||||||||||||||||||||
| 100 | - | |||||||||||||||||||||||||
| 101 | - | |||||||||||||||||||||||||
| 102 | - | |||||||||||||||||||||||||
| 103 | - | |||||||||||||||||||||||||
| 104 | void QSplitterHandle::resizeEvent(QResizeEvent *event) | - | ||||||||||||||||||||||||
| 105 | { | - | ||||||||||||||||||||||||
| 106 | const QSplitterHandlePrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 107 | bool useTinyMode = (d->s->handleWidth() <= 1); | - | ||||||||||||||||||||||||
| 108 | setAttribute(Qt::WA_MouseNoMask, useTinyMode); | - | ||||||||||||||||||||||||
| 109 |     if (useTinyMode
  | 0 | ||||||||||||||||||||||||
| 110 |         if (orientation() == Qt::Horizontal
  | 0 | ||||||||||||||||||||||||
| 111 |             setContentsMargins(2, 0, 2, 0); never executed:  setContentsMargins(2, 0, 2, 0); | 0 | ||||||||||||||||||||||||
| 112 | else | - | ||||||||||||||||||||||||
| 113 |             setContentsMargins(0, 2, 0, 2); never executed:  setContentsMargins(0, 2, 0, 2); | 0 | ||||||||||||||||||||||||
| 114 | setMask(QRegion(contentsRect())); | - | ||||||||||||||||||||||||
| 115 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 116 | - | |||||||||||||||||||||||||
| 117 | QWidget::resizeEvent(event); | - | ||||||||||||||||||||||||
| 118 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 119 | - | |||||||||||||||||||||||||
| 120 | - | |||||||||||||||||||||||||
| 121 | - | |||||||||||||||||||||||||
| 122 | - | |||||||||||||||||||||||||
| 123 | bool QSplitterHandle::event(QEvent *event) | - | ||||||||||||||||||||||||
| 124 | { | - | ||||||||||||||||||||||||
| 125 | QSplitterHandlePrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 126 | switch(event->type()) { | - | ||||||||||||||||||||||||
| 127 |     case never executed:   QEvent::HoverEnter:case QEvent::HoverEnter:never executed:  case QEvent::HoverEnter: | 0 | ||||||||||||||||||||||||
| 128 | d->hover = true; | - | ||||||||||||||||||||||||
| 129 | update(); | - | ||||||||||||||||||||||||
| 130 |         break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 131 |     case never executed:   QEvent::HoverLeave:case QEvent::HoverLeave:never executed:  case QEvent::HoverLeave: | 0 | ||||||||||||||||||||||||
| 132 | d->hover = false; | - | ||||||||||||||||||||||||
| 133 | update(); | - | ||||||||||||||||||||||||
| 134 |         break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 135 |     default never executed:  :default:never executed:  default: | 0 | ||||||||||||||||||||||||
| 136 |         break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 137 | } | - | ||||||||||||||||||||||||
| 138 |     return never executed:   QWidget::event(event);return QWidget::event(event);never executed:  return QWidget::event(event); | 0 | ||||||||||||||||||||||||
| 139 | } | - | ||||||||||||||||||||||||
| 140 | - | |||||||||||||||||||||||||
| 141 | - | |||||||||||||||||||||||||
| 142 | - | |||||||||||||||||||||||||
| 143 | - | |||||||||||||||||||||||||
| 144 | void QSplitterHandle::mouseMoveEvent(QMouseEvent *e) | - | ||||||||||||||||||||||||
| 145 | { | - | ||||||||||||||||||||||||
| 146 | QSplitterHandlePrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 147 |     if (!(e->buttons() & Qt::LeftButton)
  | 0 | ||||||||||||||||||||||||
| 148 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 149 | int pos = d->pick(parentWidget()->mapFromGlobal(e->globalPos())) | - | ||||||||||||||||||||||||
| 150 | - d->mouseOffset; | - | ||||||||||||||||||||||||
| 151 |     if (opaqueResize()
  | 0 | ||||||||||||||||||||||||
| 152 | moveSplitter(pos); | - | ||||||||||||||||||||||||
| 153 |     } never executed:   else {end of block | 0 | ||||||||||||||||||||||||
| 154 | d->s->setRubberBand(closestLegalPosition(pos)); | - | ||||||||||||||||||||||||
| 155 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 156 | } | - | ||||||||||||||||||||||||
| 157 | - | |||||||||||||||||||||||||
| 158 | - | |||||||||||||||||||||||||
| 159 | - | |||||||||||||||||||||||||
| 160 | - | |||||||||||||||||||||||||
| 161 | void QSplitterHandle::mousePressEvent(QMouseEvent *e) | - | ||||||||||||||||||||||||
| 162 | { | - | ||||||||||||||||||||||||
| 163 | QSplitterHandlePrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 164 |     if (e->button() == Qt::LeftButton
  | 0 | ||||||||||||||||||||||||
| 165 | d->mouseOffset = d->pick(e->pos()); | - | ||||||||||||||||||||||||
| 166 | d->pressed = true; | - | ||||||||||||||||||||||||
| 167 | update(); | - | ||||||||||||||||||||||||
| 168 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 169 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 170 | - | |||||||||||||||||||||||||
| 171 | - | |||||||||||||||||||||||||
| 172 | - | |||||||||||||||||||||||||
| 173 | - | |||||||||||||||||||||||||
| 174 | void QSplitterHandle::mouseReleaseEvent(QMouseEvent *e) | - | ||||||||||||||||||||||||
| 175 | { | - | ||||||||||||||||||||||||
| 176 | QSplitterHandlePrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 177 |     if (!opaqueResize()
 
  | 0 | ||||||||||||||||||||||||
| 178 | int pos = d->pick(parentWidget()->mapFromGlobal(e->globalPos())) | - | ||||||||||||||||||||||||
| 179 | - d->mouseOffset; | - | ||||||||||||||||||||||||
| 180 | d->s->setRubberBand(-1); | - | ||||||||||||||||||||||||
| 181 | moveSplitter(pos); | - | ||||||||||||||||||||||||
| 182 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 183 |     if (e->button() == Qt::LeftButton
  | 0 | ||||||||||||||||||||||||
| 184 | d->pressed = false; | - | ||||||||||||||||||||||||
| 185 | update(); | - | ||||||||||||||||||||||||
| 186 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 187 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 188 | - | |||||||||||||||||||||||||
| 189 | - | |||||||||||||||||||||||||
| 190 | - | |||||||||||||||||||||||||
| 191 | - | |||||||||||||||||||||||||
| 192 | void QSplitterHandle::paintEvent(QPaintEvent *) | - | ||||||||||||||||||||||||
| 193 | { | - | ||||||||||||||||||||||||
| 194 | QSplitterHandlePrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 195 | QPainter p(this); | - | ||||||||||||||||||||||||
| 196 | QStyleOption opt(0); | - | ||||||||||||||||||||||||
| 197 | opt.rect = contentsRect(); | - | ||||||||||||||||||||||||
| 198 | opt.palette = palette(); | - | ||||||||||||||||||||||||
| 199 |     if (orientation() == Qt::Horizontal
  | 0 | ||||||||||||||||||||||||
| 200 |         opt.state = QStyle::State_Horizontal; never executed:  opt.state = QStyle::State_Horizontal; | 0 | ||||||||||||||||||||||||
| 201 | else | - | ||||||||||||||||||||||||
| 202 |         opt.state = QStyle::State_None; never executed:  opt.state = QStyle::State_None; | 0 | ||||||||||||||||||||||||
| 203 |     if (d->hover
  | 0 | ||||||||||||||||||||||||
| 204 |         opt.state |= QStyle::State_MouseOver; never executed:  opt.state |= QStyle::State_MouseOver; | 0 | ||||||||||||||||||||||||
| 205 |     if (d->pressed
  | 0 | ||||||||||||||||||||||||
| 206 |         opt.state |= QStyle::State_Sunken; never executed:  opt.state |= QStyle::State_Sunken; | 0 | ||||||||||||||||||||||||
| 207 |     if (isEnabled()
  | 0 | ||||||||||||||||||||||||
| 208 |         opt.state |= QStyle::State_Enabled; never executed:  opt.state |= QStyle::State_Enabled; | 0 | ||||||||||||||||||||||||
| 209 | parentWidget()->style()->drawControl(QStyle::CE_Splitter, &opt, &p, d->s); | - | ||||||||||||||||||||||||
| 210 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 211 | - | |||||||||||||||||||||||||
| 212 | - | |||||||||||||||||||||||||
| 213 | int QSplitterLayoutStruct::getWidgetSize(Qt::Orientation orient) | - | ||||||||||||||||||||||||
| 214 | { | - | ||||||||||||||||||||||||
| 215 |     if (sizer == -1
  | 0 | ||||||||||||||||||||||||
| 216 | QSize s = widget->sizeHint(); | - | ||||||||||||||||||||||||
| 217 | const int presizer = pick(s, orient); | - | ||||||||||||||||||||||||
| 218 | const int realsize = pick(widget->size(), orient); | - | ||||||||||||||||||||||||
| 219 |         if (!s.isValid()
 
 
 
  | 0 | ||||||||||||||||||||||||
| 220 | sizer = pick(widget->size(), orient); | - | ||||||||||||||||||||||||
| 221 |         } never executed:   else {end of block | 0 | ||||||||||||||||||||||||
| 222 | sizer = presizer; | - | ||||||||||||||||||||||||
| 223 |         } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 224 | QSizePolicy p = widget->sizePolicy(); | - | ||||||||||||||||||||||||
| 225 |         int sf = (
 
  | 0 | ||||||||||||||||||||||||
| 226 |         if (sf > 1
  | 0 | ||||||||||||||||||||||||
| 227 |             sizer *= sf; never executed:  sizer *= sf; | 0 | ||||||||||||||||||||||||
| 228 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 229 |     return never executed:   sizer;return sizer;never executed:  return sizer; | 0 | ||||||||||||||||||||||||
| 230 | } | - | ||||||||||||||||||||||||
| 231 | - | |||||||||||||||||||||||||
| 232 | int QSplitterLayoutStruct::getHandleSize(Qt::Orientation orient) | - | ||||||||||||||||||||||||
| 233 | { | - | ||||||||||||||||||||||||
| 234 |     return never executed:   pick(handle->sizeHint(), orient);return pick(handle->sizeHint(), orient);never executed:  return pick(handle->sizeHint(), orient); | 0 | ||||||||||||||||||||||||
| 235 | } | - | ||||||||||||||||||||||||
| 236 | - | |||||||||||||||||||||||||
| 237 | void QSplitterPrivate::init() | - | ||||||||||||||||||||||||
| 238 | { | - | ||||||||||||||||||||||||
| 239 | QSplitter * const q = q_func(); | - | ||||||||||||||||||||||||
| 240 | QSizePolicy sp(QSizePolicy::Expanding, QSizePolicy::Preferred); | - | ||||||||||||||||||||||||
| 241 |     if (orient == Qt::Vertical
  | 0 | ||||||||||||||||||||||||
| 242 |         sp.transpose(); never executed:  sp.transpose(); | 0 | ||||||||||||||||||||||||
| 243 | q->setSizePolicy(sp); | - | ||||||||||||||||||||||||
| 244 | q->setAttribute(Qt::WA_WState_OwnSizePolicy, false); | - | ||||||||||||||||||||||||
| 245 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 246 | - | |||||||||||||||||||||||||
| 247 | void QSplitterPrivate::recalc(bool update) | - | ||||||||||||||||||||||||
| 248 | { | - | ||||||||||||||||||||||||
| 249 | QSplitter * const q = q_func(); | - | ||||||||||||||||||||||||
| 250 | int n = list.count(); | - | ||||||||||||||||||||||||
| 251 | - | |||||||||||||||||||||||||
| 252 | - | |||||||||||||||||||||||||
| 253 | - | |||||||||||||||||||||||||
| 254 | - | |||||||||||||||||||||||||
| 255 | bool first = true; | - | ||||||||||||||||||||||||
| 256 | bool allInvisible = n != 0; | - | ||||||||||||||||||||||||
| 257 |     for (int i = 0; i < n
  | 0 | ||||||||||||||||||||||||
| 258 | QSplitterLayoutStruct *s = list.at(i); | - | ||||||||||||||||||||||||
| 259 | bool widgetHidden = s->widget->isHidden(); | - | ||||||||||||||||||||||||
| 260 |         if (allInvisible
 
 
  | 0 | ||||||||||||||||||||||||
| 261 |             allInvisible = false; never executed:  allInvisible = false; | 0 | ||||||||||||||||||||||||
| 262 | s->handle->setHidden(first || widgetHidden); | - | ||||||||||||||||||||||||
| 263 |         if (!widgetHidden
  | 0 | ||||||||||||||||||||||||
| 264 |             first = false; never executed:  first = false; | 0 | ||||||||||||||||||||||||
| 265 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 266 | - | |||||||||||||||||||||||||
| 267 |     if (allInvisible
  | 0 | ||||||||||||||||||||||||
| 268 |         for (int i = 0; i < n
  | 0 | ||||||||||||||||||||||||
| 269 | QSplitterLayoutStruct *s = list.at(i); | - | ||||||||||||||||||||||||
| 270 |             if (!s->widget->isHidden()
  | 0 | ||||||||||||||||||||||||
| 271 | s->collapsed = false; | - | ||||||||||||||||||||||||
| 272 |                 break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 273 | } | - | ||||||||||||||||||||||||
| 274 |         } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 275 | - | |||||||||||||||||||||||||
| 276 | int fi = 2 * q->frameWidth(); | - | ||||||||||||||||||||||||
| 277 | int maxl = fi; | - | ||||||||||||||||||||||||
| 278 | int minl = fi; | - | ||||||||||||||||||||||||
| 279 | int maxt = ((1<<24)-1); | - | ||||||||||||||||||||||||
| 280 | int mint = fi; | - | ||||||||||||||||||||||||
| 281 | - | |||||||||||||||||||||||||
| 282 | - | |||||||||||||||||||||||||
| 283 | - | |||||||||||||||||||||||||
| 284 | bool empty = true; | - | ||||||||||||||||||||||||
| 285 |     for (int j = 0; j < n
  | 0 | ||||||||||||||||||||||||
| 286 | QSplitterLayoutStruct *s = list.at(j); | - | ||||||||||||||||||||||||
| 287 | - | |||||||||||||||||||||||||
| 288 |         if (!s->widget->isHidden()
  | 0 | ||||||||||||||||||||||||
| 289 | empty = false; | - | ||||||||||||||||||||||||
| 290 |             if (!s->handle->isHidden()
  | 0 | ||||||||||||||||||||||||
| 291 | minl += s->getHandleSize(orient); | - | ||||||||||||||||||||||||
| 292 | maxl += s->getHandleSize(orient); | - | ||||||||||||||||||||||||
| 293 |             } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 294 | - | |||||||||||||||||||||||||
| 295 | QSize minS = qSmartMinSize(s->widget); | - | ||||||||||||||||||||||||
| 296 | minl += pick(minS); | - | ||||||||||||||||||||||||
| 297 | maxl += pick(s->widget->maximumSize()); | - | ||||||||||||||||||||||||
| 298 | mint = qMax(mint, trans(minS)); | - | ||||||||||||||||||||||||
| 299 | int tm = trans(s->widget->maximumSize()); | - | ||||||||||||||||||||||||
| 300 |             if (tm > 0
  | 0 | ||||||||||||||||||||||||
| 301 |                 maxt = qMin(maxt, tm); never executed:  maxt = qMin(maxt, tm); | 0 | ||||||||||||||||||||||||
| 302 |         } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 303 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 304 | - | |||||||||||||||||||||||||
| 305 |     if (empty
  | 0 | ||||||||||||||||||||||||
| 306 |         if (qobject_cast<QSplitter *>(parent)
  | 0 | ||||||||||||||||||||||||
| 307 | - | |||||||||||||||||||||||||
| 308 | maxl = maxt = 0; | - | ||||||||||||||||||||||||
| 309 |         } never executed:   else {end of block | 0 | ||||||||||||||||||||||||
| 310 | - | |||||||||||||||||||||||||
| 311 | maxl = ((1<<24)-1); | - | ||||||||||||||||||||||||
| 312 |         } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 313 | } else { | - | ||||||||||||||||||||||||
| 314 | maxl = qMin<int>(maxl, ((1<<24)-1)); | - | ||||||||||||||||||||||||
| 315 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 316 |     if (maxt < mint
  | 0 | ||||||||||||||||||||||||
| 317 |         maxt = mint; never executed:  maxt = mint; | 0 | ||||||||||||||||||||||||
| 318 | - | |||||||||||||||||||||||||
| 319 |     if (update
  | 0 | ||||||||||||||||||||||||
| 320 |         if (orient == Qt::Horizontal
  | 0 | ||||||||||||||||||||||||
| 321 | q->setMaximumSize(maxl, maxt); | - | ||||||||||||||||||||||||
| 322 |             if (q->isWindow()
  | 0 | ||||||||||||||||||||||||
| 323 |                 q->setMinimumSize(minl,mint); never executed:  q->setMinimumSize(minl,mint); | 0 | ||||||||||||||||||||||||
| 324 |         } never executed:   else {end of block | 0 | ||||||||||||||||||||||||
| 325 | q->setMaximumSize(maxt, maxl); | - | ||||||||||||||||||||||||
| 326 |             if (q->isWindow()
  | 0 | ||||||||||||||||||||||||
| 327 |                 q->setMinimumSize(mint,minl); never executed:  q->setMinimumSize(mint,minl); | 0 | ||||||||||||||||||||||||
| 328 |         } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 329 | doResize(); | - | ||||||||||||||||||||||||
| 330 | q->updateGeometry(); | - | ||||||||||||||||||||||||
| 331 |     } never executed:   else {end of block | 0 | ||||||||||||||||||||||||
| 332 | firstShow = true; | - | ||||||||||||||||||||||||
| 333 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 334 | } | - | ||||||||||||||||||||||||
| 335 | - | |||||||||||||||||||||||||
| 336 | void QSplitterPrivate::doResize() | - | ||||||||||||||||||||||||
| 337 | { | - | ||||||||||||||||||||||||
| 338 | QSplitter * const q = q_func(); | - | ||||||||||||||||||||||||
| 339 | QRect r = q->contentsRect(); | - | ||||||||||||||||||||||||
| 340 | int n = list.count(); | - | ||||||||||||||||||||||||
| 341 | QVector<QLayoutStruct> a(n*2); | - | ||||||||||||||||||||||||
| 342 | int i; | - | ||||||||||||||||||||||||
| 343 | - | |||||||||||||||||||||||||
| 344 | bool noStretchFactorsSet = true; | - | ||||||||||||||||||||||||
| 345 |     for (i = 0; i < n
  | 0 | ||||||||||||||||||||||||
| 346 | QSizePolicy p = list.at(i)->widget->sizePolicy(); | - | ||||||||||||||||||||||||
| 347 |         int sf = orient == Qt::Horizontal
  | 0 | ||||||||||||||||||||||||
| 348 |         if (sf != 0
  | 0 | ||||||||||||||||||||||||
| 349 | noStretchFactorsSet = false; | - | ||||||||||||||||||||||||
| 350 |             break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 351 | } | - | ||||||||||||||||||||||||
| 352 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 353 | - | |||||||||||||||||||||||||
| 354 | int j=0; | - | ||||||||||||||||||||||||
| 355 |     for (i = 0; i < n
  | 0 | ||||||||||||||||||||||||
| 356 | QSplitterLayoutStruct *s = list.at(i); | - | ||||||||||||||||||||||||
| 357 | - | |||||||||||||||||||||||||
| 358 | - | |||||||||||||||||||||||||
| 359 | - | |||||||||||||||||||||||||
| 360 | - | |||||||||||||||||||||||||
| 361 | - | |||||||||||||||||||||||||
| 362 | a[j].init(); | - | ||||||||||||||||||||||||
| 363 |         if (s->handle->isHidden()
  | 0 | ||||||||||||||||||||||||
| 364 | a[j].maximumSize = 0; | - | ||||||||||||||||||||||||
| 365 |         } never executed:   else {end of block | 0 | ||||||||||||||||||||||||
| 366 | a[j].sizeHint = a[j].minimumSize = a[j].maximumSize = s->getHandleSize(orient); | - | ||||||||||||||||||||||||
| 367 | a[j].empty = false; | - | ||||||||||||||||||||||||
| 368 |         } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 369 | ++j; | - | ||||||||||||||||||||||||
| 370 | - | |||||||||||||||||||||||||
| 371 | a[j].init(); | - | ||||||||||||||||||||||||
| 372 |         if (s->widget->isHidden()
 
  | 0 | ||||||||||||||||||||||||
| 373 | a[j].maximumSize = 0; | - | ||||||||||||||||||||||||
| 374 |         } never executed:   else {end of block | 0 | ||||||||||||||||||||||||
| 375 | a[j].minimumSize = pick(qSmartMinSize(s->widget)); | - | ||||||||||||||||||||||||
| 376 | a[j].maximumSize = pick(s->widget->maximumSize()); | - | ||||||||||||||||||||||||
| 377 | a[j].empty = false; | - | ||||||||||||||||||||||||
| 378 | - | |||||||||||||||||||||||||
| 379 | bool stretch = noStretchFactorsSet; | - | ||||||||||||||||||||||||
| 380 |             if (!stretch
  | 0 | ||||||||||||||||||||||||
| 381 | QSizePolicy p = s->widget->sizePolicy(); | - | ||||||||||||||||||||||||
| 382 |                 int sf = orient == Qt::Horizontal
  | 0 | ||||||||||||||||||||||||
| 383 | stretch = (sf != 0); | - | ||||||||||||||||||||||||
| 384 |             } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 385 |             if (stretch
  | 0 | ||||||||||||||||||||||||
| 386 | a[j].stretch = s->getWidgetSize(orient); | - | ||||||||||||||||||||||||
| 387 | a[j].sizeHint = a[j].minimumSize; | - | ||||||||||||||||||||||||
| 388 | a[j].expansive = true; | - | ||||||||||||||||||||||||
| 389 |             } never executed:   else {end of block | 0 | ||||||||||||||||||||||||
| 390 | a[j].sizeHint = qMax(s->getWidgetSize(orient), a[j].minimumSize); | - | ||||||||||||||||||||||||
| 391 |             } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 392 | } | - | ||||||||||||||||||||||||
| 393 | ++j; | - | ||||||||||||||||||||||||
| 394 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 395 | - | |||||||||||||||||||||||||
| 396 | qGeomCalc(a, 0, n*2, pick(r.topLeft()), pick(r.size()), 0); | - | ||||||||||||||||||||||||
| 397 |     for (i = 0; i < n
  | 0 | ||||||||||||||||||||||||
| 398 | QSplitterLayoutStruct *s = list.at(i); | - | ||||||||||||||||||||||||
| 399 | setGeo(s, a[i*2+1].pos, a[i*2+1].size, false); | - | ||||||||||||||||||||||||
| 400 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 401 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 402 | - | |||||||||||||||||||||||||
| 403 | void QSplitterPrivate::storeSizes() | - | ||||||||||||||||||||||||
| 404 | { | - | ||||||||||||||||||||||||
| 405 |     for (int i = 0; i < list.size()
  | 0 | ||||||||||||||||||||||||
| 406 | QSplitterLayoutStruct *sls = list.at(i); | - | ||||||||||||||||||||||||
| 407 | sls->sizer = pick(sls->rect.size()); | - | ||||||||||||||||||||||||
| 408 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 409 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 410 | - | |||||||||||||||||||||||||
| 411 | void QSplitterPrivate::addContribution(int index, int *min, int *max, bool mayCollapse) const | - | ||||||||||||||||||||||||
| 412 | { | - | ||||||||||||||||||||||||
| 413 | QSplitterLayoutStruct *s = list.at(index); | - | ||||||||||||||||||||||||
| 414 |     if (!s->widget->isHidden()
  | 0 | ||||||||||||||||||||||||
| 415 |         if (!s->handle->isHidden()
  | 0 | ||||||||||||||||||||||||
| 416 | *min += s->getHandleSize(orient); | - | ||||||||||||||||||||||||
| 417 | *max += s->getHandleSize(orient); | - | ||||||||||||||||||||||||
| 418 |         } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 419 |         if (mayCollapse
 
  | 0 | ||||||||||||||||||||||||
| 420 |             * never executed:  min += pick(qSmartMinSize(s->widget));*min += pick(qSmartMinSize(s->widget));never executed:  *min += pick(qSmartMinSize(s->widget)); | 0 | ||||||||||||||||||||||||
| 421 | - | |||||||||||||||||||||||||
| 422 | *max += pick(s->widget->maximumSize()); | - | ||||||||||||||||||||||||
| 423 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 424 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 425 | - | |||||||||||||||||||||||||
| 426 | int QSplitterPrivate::findWidgetJustBeforeOrJustAfter(int index, int delta, int &collapsibleSize) const | - | ||||||||||||||||||||||||
| 427 | { | - | ||||||||||||||||||||||||
| 428 |     if (delta < 0
  | 0 | ||||||||||||||||||||||||
| 429 |         index += delta; never executed:  index += delta; | 0 | ||||||||||||||||||||||||
| 430 | do { | - | ||||||||||||||||||||||||
| 431 | QWidget *w = list.at(index)->widget; | - | ||||||||||||||||||||||||
| 432 |         if (!w->isHidden()
  | 0 | ||||||||||||||||||||||||
| 433 |             if (collapsible(list.at(index))
  | 0 | ||||||||||||||||||||||||
| 434 |                 collapsibleSize = pick(qSmartMinSize(w)); never executed:  collapsibleSize = pick(qSmartMinSize(w)); | 0 | ||||||||||||||||||||||||
| 435 |             return never executed:   index;return index;never executed:  return index; | 0 | ||||||||||||||||||||||||
| 436 | } | - | ||||||||||||||||||||||||
| 437 | index += delta; | - | ||||||||||||||||||||||||
| 438 |     } never executed:   while (index >= 0end of block
 
  | 0 | ||||||||||||||||||||||||
| 439 | - | |||||||||||||||||||||||||
| 440 |     return never executed:   -1;return -1;never executed:  return -1; | 0 | ||||||||||||||||||||||||
| 441 | } | - | ||||||||||||||||||||||||
| 442 | - | |||||||||||||||||||||||||
| 443 | - | |||||||||||||||||||||||||
| 444 | - | |||||||||||||||||||||||||
| 445 | - | |||||||||||||||||||||||||
| 446 | - | |||||||||||||||||||||||||
| 447 | void QSplitterPrivate::getRange(int index, int *farMin, int *min, int *max, int *farMax) const | - | ||||||||||||||||||||||||
| 448 | { | - | ||||||||||||||||||||||||
| 449 | const QSplitter * const q = q_func(); | - | ||||||||||||||||||||||||
| 450 | int n = list.count(); | - | ||||||||||||||||||||||||
| 451 |     if (index <= 0
 
  | 0 | ||||||||||||||||||||||||
| 452 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 453 | - | |||||||||||||||||||||||||
| 454 | int collapsibleSizeBefore = 0; | - | ||||||||||||||||||||||||
| 455 | int idJustBefore = findWidgetJustBeforeOrJustAfter(index, -1, collapsibleSizeBefore); | - | ||||||||||||||||||||||||
| 456 | - | |||||||||||||||||||||||||
| 457 | int collapsibleSizeAfter = 0; | - | ||||||||||||||||||||||||
| 458 | int idJustAfter = findWidgetJustBeforeOrJustAfter(index, +1, collapsibleSizeAfter); | - | ||||||||||||||||||||||||
| 459 | - | |||||||||||||||||||||||||
| 460 | int minBefore = 0; | - | ||||||||||||||||||||||||
| 461 | int minAfter = 0; | - | ||||||||||||||||||||||||
| 462 | int maxBefore = 0; | - | ||||||||||||||||||||||||
| 463 | int maxAfter = 0; | - | ||||||||||||||||||||||||
| 464 | int i; | - | ||||||||||||||||||||||||
| 465 | - | |||||||||||||||||||||||||
| 466 |     for (i = 0; i < index
  | 0 | ||||||||||||||||||||||||
| 467 |         addContribution(i, &minBefore, &maxBefore, i == idJustBefore); never executed:  addContribution(i, &minBefore, &maxBefore, i == idJustBefore); | 0 | ||||||||||||||||||||||||
| 468 |     for (i = index; i < n
  | 0 | ||||||||||||||||||||||||
| 469 |         addContribution(i, &minAfter, &maxAfter, i == idJustAfter); never executed:  addContribution(i, &minAfter, &maxAfter, i == idJustAfter); | 0 | ||||||||||||||||||||||||
| 470 | - | |||||||||||||||||||||||||
| 471 | QRect r = q->contentsRect(); | - | ||||||||||||||||||||||||
| 472 | int farMinVal; | - | ||||||||||||||||||||||||
| 473 | int minVal; | - | ||||||||||||||||||||||||
| 474 | int maxVal; | - | ||||||||||||||||||||||||
| 475 | int farMaxVal; | - | ||||||||||||||||||||||||
| 476 | - | |||||||||||||||||||||||||
| 477 | int smartMinBefore = qMax(minBefore, pick(r.size()) - maxAfter); | - | ||||||||||||||||||||||||
| 478 | int smartMaxBefore = qMin(maxBefore, pick(r.size()) - minAfter); | - | ||||||||||||||||||||||||
| 479 | - | |||||||||||||||||||||||||
| 480 | minVal = pick(r.topLeft()) + smartMinBefore; | - | ||||||||||||||||||||||||
| 481 | maxVal = pick(r.topLeft()) + smartMaxBefore; | - | ||||||||||||||||||||||||
| 482 | - | |||||||||||||||||||||||||
| 483 | farMinVal = minVal; | - | ||||||||||||||||||||||||
| 484 |     if (minBefore - collapsibleSizeBefore >= pick(r.size()) - maxAfter
  | 0 | ||||||||||||||||||||||||
| 485 |         farMinVal -= collapsibleSizeBefore; never executed:  farMinVal -= collapsibleSizeBefore; | 0 | ||||||||||||||||||||||||
| 486 | farMaxVal = maxVal; | - | ||||||||||||||||||||||||
| 487 |     if (pick(r.size()) - (minAfter - collapsibleSizeAfter) <= maxBefore
  | 0 | ||||||||||||||||||||||||
| 488 |         farMaxVal += collapsibleSizeAfter; never executed:  farMaxVal += collapsibleSizeAfter; | 0 | ||||||||||||||||||||||||
| 489 | - | |||||||||||||||||||||||||
| 490 |     if (farMin
  | 0 | ||||||||||||||||||||||||
| 491 |         * never executed:  farMin = farMinVal;*farMin = farMinVal;never executed:  *farMin = farMinVal; | 0 | ||||||||||||||||||||||||
| 492 |     if (min
  | 0 | ||||||||||||||||||||||||
| 493 |         * never executed:  min = minVal;*min = minVal;never executed:  *min = minVal; | 0 | ||||||||||||||||||||||||
| 494 |     if (max
  | 0 | ||||||||||||||||||||||||
| 495 |         * never executed:  max = maxVal;*max = maxVal;never executed:  *max = maxVal; | 0 | ||||||||||||||||||||||||
| 496 |     if (farMax
  | 0 | ||||||||||||||||||||||||
| 497 |         * never executed:  farMax = farMaxVal;*farMax = farMaxVal;never executed:  *farMax = farMaxVal; | 0 | ||||||||||||||||||||||||
| 498 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 499 | - | |||||||||||||||||||||||||
| 500 | int QSplitterPrivate::adjustPos(int pos, int index, int *farMin, int *min, int *max, int *farMax) const | - | ||||||||||||||||||||||||
| 501 | { | - | ||||||||||||||||||||||||
| 502 | const int Threshold = 40; | - | ||||||||||||||||||||||||
| 503 | - | |||||||||||||||||||||||||
| 504 | getRange(index, farMin, min, max, farMax); | - | ||||||||||||||||||||||||
| 505 | - | |||||||||||||||||||||||||
| 506 |     if (pos >= *min
  | 0 | ||||||||||||||||||||||||
| 507 |         if (pos <= *max
  | 0 | ||||||||||||||||||||||||
| 508 |             return never executed:   pos;return pos;never executed:  return pos; | 0 | ||||||||||||||||||||||||
| 509 | } else { | - | ||||||||||||||||||||||||
| 510 | int delta = pos - *max; | - | ||||||||||||||||||||||||
| 511 | int width = *farMax - *max; | - | ||||||||||||||||||||||||
| 512 | - | |||||||||||||||||||||||||
| 513 |             if (delta > width / 2
 
  | 0 | ||||||||||||||||||||||||
| 514 |                 return never executed:   *farMax;return *farMax;never executed:  return *farMax; | 0 | ||||||||||||||||||||||||
| 515 | } else { | - | ||||||||||||||||||||||||
| 516 |                 return never executed:   *max;return *max;never executed:  return *max; | 0 | ||||||||||||||||||||||||
| 517 | } | - | ||||||||||||||||||||||||
| 518 | } | - | ||||||||||||||||||||||||
| 519 | } else { | - | ||||||||||||||||||||||||
| 520 | int delta = *min - pos; | - | ||||||||||||||||||||||||
| 521 | int width = *min - *farMin; | - | ||||||||||||||||||||||||
| 522 | - | |||||||||||||||||||||||||
| 523 |         if (delta > width / 2
 
  | 0 | ||||||||||||||||||||||||
| 524 |             return never executed:   *farMin;return *farMin;never executed:  return *farMin; | 0 | ||||||||||||||||||||||||
| 525 | } else { | - | ||||||||||||||||||||||||
| 526 |             return never executed:   *min;return *min;never executed:  return *min; | 0 | ||||||||||||||||||||||||
| 527 | } | - | ||||||||||||||||||||||||
| 528 | } | - | ||||||||||||||||||||||||
| 529 | } | - | ||||||||||||||||||||||||
| 530 | - | |||||||||||||||||||||||||
| 531 | bool QSplitterPrivate::collapsible(QSplitterLayoutStruct *s) const | - | ||||||||||||||||||||||||
| 532 | { | - | ||||||||||||||||||||||||
| 533 |     if (s->collapsible != Default
  | 0 | ||||||||||||||||||||||||
| 534 |         return never executed:   (bool)s->collapsible;return (bool)s->collapsible;never executed:  return (bool)s->collapsible; | 0 | ||||||||||||||||||||||||
| 535 | } else { | - | ||||||||||||||||||||||||
| 536 |         return never executed:   childrenCollapsible;return childrenCollapsible;never executed:  return childrenCollapsible; | 0 | ||||||||||||||||||||||||
| 537 | } | - | ||||||||||||||||||||||||
| 538 | } | - | ||||||||||||||||||||||||
| 539 | - | |||||||||||||||||||||||||
| 540 | void QSplitterPrivate::updateHandles() | - | ||||||||||||||||||||||||
| 541 | { | - | ||||||||||||||||||||||||
| 542 | QSplitter * const q = q_func(); | - | ||||||||||||||||||||||||
| 543 | recalc(q->isVisible()); | - | ||||||||||||||||||||||||
| 544 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 545 | - | |||||||||||||||||||||||||
| 546 | void QSplitterPrivate::setSizes_helper(const QList<int> &sizes, bool clampNegativeSize) | - | ||||||||||||||||||||||||
| 547 | { | - | ||||||||||||||||||||||||
| 548 | int j = 0; | - | ||||||||||||||||||||||||
| 549 | - | |||||||||||||||||||||||||
| 550 |     for (int i = 0; i < list.size()
  | 0 | ||||||||||||||||||||||||
| 551 | QSplitterLayoutStruct *s = list.at(i); | - | ||||||||||||||||||||||||
| 552 | - | |||||||||||||||||||||||||
| 553 | s->collapsed = false; | - | ||||||||||||||||||||||||
| 554 | s->sizer = sizes.value(j++); | - | ||||||||||||||||||||||||
| 555 |         if (clampNegativeSize
 
  | 0 | ||||||||||||||||||||||||
| 556 |             s->sizer = 0; never executed:  s->sizer = 0; | 0 | ||||||||||||||||||||||||
| 557 | int smartMinSize = pick(qSmartMinSize(s->widget)); | - | ||||||||||||||||||||||||
| 558 | - | |||||||||||||||||||||||||
| 559 | - | |||||||||||||||||||||||||
| 560 |         if (s->sizer == 0
  | 0 | ||||||||||||||||||||||||
| 561 |             if (collapsible(s)
 
  | 0 | ||||||||||||||||||||||||
| 562 | s->collapsed = true; | - | ||||||||||||||||||||||||
| 563 |             } never executed:   else {end of block | 0 | ||||||||||||||||||||||||
| 564 | s->sizer = smartMinSize; | - | ||||||||||||||||||||||||
| 565 |             } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 566 | } else { | - | ||||||||||||||||||||||||
| 567 |             if (s->sizer < smartMinSize
  | 0 | ||||||||||||||||||||||||
| 568 |                 s->sizer = smartMinSize; never executed:  s->sizer = smartMinSize; | 0 | ||||||||||||||||||||||||
| 569 |         } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 570 | } | - | ||||||||||||||||||||||||
| 571 | doResize(); | - | ||||||||||||||||||||||||
| 572 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 573 | - | |||||||||||||||||||||||||
| 574 | void QSplitterPrivate::setGeo(QSplitterLayoutStruct *sls, int p, int s, bool allowCollapse) | - | ||||||||||||||||||||||||
| 575 | { | - | ||||||||||||||||||||||||
| 576 | QSplitter * const q = q_func(); | - | ||||||||||||||||||||||||
| 577 | QWidget *w = sls->widget; | - | ||||||||||||||||||||||||
| 578 | QRect r; | - | ||||||||||||||||||||||||
| 579 | QRect contents = q->contentsRect(); | - | ||||||||||||||||||||||||
| 580 |     if (orient == Qt::Horizontal
  | 0 | ||||||||||||||||||||||||
| 581 | r.setRect(p, contents.y(), s, contents.height()); | - | ||||||||||||||||||||||||
| 582 |     } never executed:   else {end of block | 0 | ||||||||||||||||||||||||
| 583 | r.setRect(contents.x(), p, contents.width(), s); | - | ||||||||||||||||||||||||
| 584 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 585 | sls->rect = r; | - | ||||||||||||||||||||||||
| 586 | - | |||||||||||||||||||||||||
| 587 | int minSize = pick(qSmartMinSize(w)); | - | ||||||||||||||||||||||||
| 588 | - | |||||||||||||||||||||||||
| 589 |     if (orient == Qt::Horizontal
 
  | 0 | ||||||||||||||||||||||||
| 590 |         r.moveRight(contents.width() - r.left()); never executed:  r.moveRight(contents.width() - r.left()); | 0 | ||||||||||||||||||||||||
| 591 | - | |||||||||||||||||||||||||
| 592 |     if (allowCollapse
  | 0 | ||||||||||||||||||||||||
| 593 |         sls->collapsed = s <= 0
 
 
 never executed:  sls->collapsed = s <= 0 && minSize > 0 && !w->isHidden(); | 0 | ||||||||||||||||||||||||
| 594 | - | |||||||||||||||||||||||||
| 595 | - | |||||||||||||||||||||||||
| 596 | - | |||||||||||||||||||||||||
| 597 |     if (sls->collapsed
  | 0 | ||||||||||||||||||||||||
| 598 |         r.moveTopLeft(QPoint(-r.width()-1, -r.height()-1)); never executed:  r.moveTopLeft(QPoint(-r.width()-1, -r.height()-1)); | 0 | ||||||||||||||||||||||||
| 599 | - | |||||||||||||||||||||||||
| 600 | w->setGeometry(r); | - | ||||||||||||||||||||||||
| 601 | - | |||||||||||||||||||||||||
| 602 |     if (!sls->handle->isHidden()
  | 0 | ||||||||||||||||||||||||
| 603 | QSplitterHandle *h = sls->handle; | - | ||||||||||||||||||||||||
| 604 | QSize hs = h->sizeHint(); | - | ||||||||||||||||||||||||
| 605 | int left, top, right, bottom; | - | ||||||||||||||||||||||||
| 606 | h->getContentsMargins(&left, &top, &right, &bottom); | - | ||||||||||||||||||||||||
| 607 |         if (orient==Qt::Horizontal
  | 0 | ||||||||||||||||||||||||
| 608 |             if (q->isRightToLeft()
  | 0 | ||||||||||||||||||||||||
| 609 |                 p = contents.width() - p + hs.width(); never executed:  p = contents.width() - p + hs.width(); | 0 | ||||||||||||||||||||||||
| 610 | h->setGeometry(p-hs.width() - left, contents.y(), hs.width() + left + right, contents.height()); | - | ||||||||||||||||||||||||
| 611 |         } never executed:   else {end of block | 0 | ||||||||||||||||||||||||
| 612 | h->setGeometry(contents.x(), p-hs.height() - top, contents.width(), hs.height() + top + bottom); | - | ||||||||||||||||||||||||
| 613 |         } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 614 | } | - | ||||||||||||||||||||||||
| 615 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 616 | - | |||||||||||||||||||||||||
| 617 | void QSplitterPrivate::doMove(bool backwards, int hPos, int index, int delta, bool mayCollapse, | - | ||||||||||||||||||||||||
| 618 | int *positions, int *widths) | - | ||||||||||||||||||||||||
| 619 | { | - | ||||||||||||||||||||||||
| 620 |     if (index < 0
 
  | 0 | ||||||||||||||||||||||||
| 621 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 622 | - | |||||||||||||||||||||||||
| 623 | - | |||||||||||||||||||||||||
| 624 | - | |||||||||||||||||||||||||
| 625 | - | |||||||||||||||||||||||||
| 626 | - | |||||||||||||||||||||||||
| 627 | QSplitterLayoutStruct *s = list.at(index); | - | ||||||||||||||||||||||||
| 628 | QWidget *w = s->widget; | - | ||||||||||||||||||||||||
| 629 | - | |||||||||||||||||||||||||
| 630 |     int nextId = backwards
  | 0 | ||||||||||||||||||||||||
| 631 | - | |||||||||||||||||||||||||
| 632 |     if (w->isHidden()
  | 0 | ||||||||||||||||||||||||
| 633 | doMove(backwards, hPos, nextId, delta, collapsible(nextId), positions, widths); | - | ||||||||||||||||||||||||
| 634 |     } never executed:   else {end of block | 0 | ||||||||||||||||||||||||
| 635 |         int hs =s->handle->isHidden()
  | 0 | ||||||||||||||||||||||||
| 636 | - | |||||||||||||||||||||||||
| 637 |         int ws = backwards
  | 0 | ||||||||||||||||||||||||
| 638 | : pick(s->rect.bottomRight()) - hPos -hs + 1; | - | ||||||||||||||||||||||||
| 639 |         if (ws > 0
 
 
  | 0 | ||||||||||||||||||||||||
| 640 | ws = qMin(ws, pick(w->maximumSize())); | - | ||||||||||||||||||||||||
| 641 | ws = qMax(ws, pick(qSmartMinSize(w))); | - | ||||||||||||||||||||||||
| 642 |         } never executed:   else {end of block | 0 | ||||||||||||||||||||||||
| 643 | ws = 0; | - | ||||||||||||||||||||||||
| 644 |         } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 645 |         positions[index] = backwards
  | 0 | ||||||||||||||||||||||||
| 646 | widths[index] = ws; | - | ||||||||||||||||||||||||
| 647 | doMove(backwards, backwards ? hPos - ws - hs : hPos + hs + ws, nextId, delta, | - | ||||||||||||||||||||||||
| 648 | collapsible(nextId), positions, widths); | - | ||||||||||||||||||||||||
| 649 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 650 | - | |||||||||||||||||||||||||
| 651 | } | - | ||||||||||||||||||||||||
| 652 | - | |||||||||||||||||||||||||
| 653 | QSplitterLayoutStruct *QSplitterPrivate::findWidget(QWidget *w) const | - | ||||||||||||||||||||||||
| 654 | { | - | ||||||||||||||||||||||||
| 655 |     for (int i = 0; i < list.size()
  | 0 | ||||||||||||||||||||||||
| 656 |         if (list.at(i)->widget == w
  | 0 | ||||||||||||||||||||||||
| 657 |             return never executed:   list.at(i);return list.at(i);never executed:  return list.at(i); | 0 | ||||||||||||||||||||||||
| 658 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 659 |     return never executed:   0;return 0;never executed:  return 0; | 0 | ||||||||||||||||||||||||
| 660 | } | - | ||||||||||||||||||||||||
| 661 | - | |||||||||||||||||||||||||
| 662 | - | |||||||||||||||||||||||||
| 663 | - | |||||||||||||||||||||||||
| 664 | - | |||||||||||||||||||||||||
| 665 | - | |||||||||||||||||||||||||
| 666 | void QSplitterPrivate::insertWidget_helper(int index, QWidget *widget, bool show) | - | ||||||||||||||||||||||||
| 667 | { | - | ||||||||||||||||||||||||
| 668 | QSplitter * const q = q_func(); | - | ||||||||||||||||||||||||
| 669 | QBoolBlocker b(blockChildAdd); | - | ||||||||||||||||||||||||
| 670 |     bool needShow = show
 
  | 0 | ||||||||||||||||||||||||
| 671 |                     !(widget->isHidden()
 
  | 0 | ||||||||||||||||||||||||
| 672 |     if (widget->parentWidget() != q
  | 0 | ||||||||||||||||||||||||
| 673 |         widget->setParent(q); never executed:  widget->setParent(q); | 0 | ||||||||||||||||||||||||
| 674 |     if (needShow
  | 0 | ||||||||||||||||||||||||
| 675 |         widget->show(); never executed:  widget->show(); | 0 | ||||||||||||||||||||||||
| 676 | insertWidget(index, widget); | - | ||||||||||||||||||||||||
| 677 | recalc(q->isVisible()); | - | ||||||||||||||||||||||||
| 678 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 679 | - | |||||||||||||||||||||||||
| 680 | - | |||||||||||||||||||||||||
| 681 | - | |||||||||||||||||||||||||
| 682 | - | |||||||||||||||||||||||||
| 683 | - | |||||||||||||||||||||||||
| 684 | - | |||||||||||||||||||||||||
| 685 | - | |||||||||||||||||||||||||
| 686 | QSplitterLayoutStruct *QSplitterPrivate::insertWidget(int index, QWidget *w) | - | ||||||||||||||||||||||||
| 687 | { | - | ||||||||||||||||||||||||
| 688 | QSplitter * const q = q_func(); | - | ||||||||||||||||||||||||
| 689 | QSplitterLayoutStruct *sls = 0; | - | ||||||||||||||||||||||||
| 690 | int i; | - | ||||||||||||||||||||||||
| 691 | int last = list.count(); | - | ||||||||||||||||||||||||
| 692 |     for (i = 0; i < list.size()
  | 0 | ||||||||||||||||||||||||
| 693 | QSplitterLayoutStruct *s = list.at(i); | - | ||||||||||||||||||||||||
| 694 |         if (s->widget == w
  | 0 | ||||||||||||||||||||||||
| 695 | sls = s; | - | ||||||||||||||||||||||||
| 696 | --last; | - | ||||||||||||||||||||||||
| 697 |             break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 698 | } | - | ||||||||||||||||||||||||
| 699 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 700 |     if (index < 0
 
  | 0 | ||||||||||||||||||||||||
| 701 |         index = last; never executed:  index = last; | 0 | ||||||||||||||||||||||||
| 702 | - | |||||||||||||||||||||||||
| 703 |     if (sls
  | 0 | ||||||||||||||||||||||||
| 704 | list.move(i,index); | - | ||||||||||||||||||||||||
| 705 |     } never executed:   else {end of block | 0 | ||||||||||||||||||||||||
| 706 | QSplitterHandle *newHandle = 0; | - | ||||||||||||||||||||||||
| 707 | sls = new QSplitterLayoutStruct; | - | ||||||||||||||||||||||||
| 708 | QString tmp = QLatin1String("qt_splithandle_"); | - | ||||||||||||||||||||||||
| 709 | tmp += w->objectName(); | - | ||||||||||||||||||||||||
| 710 | newHandle = q->createHandle(); | - | ||||||||||||||||||||||||
| 711 | newHandle->setObjectName(tmp); | - | ||||||||||||||||||||||||
| 712 | sls->handle = newHandle; | - | ||||||||||||||||||||||||
| 713 | sls->widget = w; | - | ||||||||||||||||||||||||
| 714 | w->lower(); | - | ||||||||||||||||||||||||
| 715 | list.insert(index,sls); | - | ||||||||||||||||||||||||
| 716 | - | |||||||||||||||||||||||||
| 717 |         if (newHandle
 
  | 0 | ||||||||||||||||||||||||
| 718 |             newHandle->show(); never executed:  newHandle->show(); | 0 | ||||||||||||||||||||||||
| 719 | - | |||||||||||||||||||||||||
| 720 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 721 |     return never executed:   sls;return sls;never executed:  return sls; | 0 | ||||||||||||||||||||||||
| 722 | } | - | ||||||||||||||||||||||||
| 723 | QSplitter::QSplitter(QWidget *parent) | - | ||||||||||||||||||||||||
| 724 | : QFrame(*new QSplitterPrivate, parent) | - | ||||||||||||||||||||||||
| 725 | { | - | ||||||||||||||||||||||||
| 726 | QSplitterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 727 | d->orient = Qt::Horizontal; | - | ||||||||||||||||||||||||
| 728 | d->init(); | - | ||||||||||||||||||||||||
| 729 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 730 | - | |||||||||||||||||||||||||
| 731 | - | |||||||||||||||||||||||||
| 732 | - | |||||||||||||||||||||||||
| 733 | - | |||||||||||||||||||||||||
| 734 | - | |||||||||||||||||||||||||
| 735 | - | |||||||||||||||||||||||||
| 736 | - | |||||||||||||||||||||||||
| 737 | QSplitter::QSplitter(Qt::Orientation orientation, QWidget *parent) | - | ||||||||||||||||||||||||
| 738 | : QFrame(*new QSplitterPrivate, parent) | - | ||||||||||||||||||||||||
| 739 | { | - | ||||||||||||||||||||||||
| 740 | QSplitterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 741 | d->orient = orientation; | - | ||||||||||||||||||||||||
| 742 | d->init(); | - | ||||||||||||||||||||||||
| 743 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 744 | - | |||||||||||||||||||||||||
| 745 | - | |||||||||||||||||||||||||
| 746 | - | |||||||||||||||||||||||||
| 747 | - | |||||||||||||||||||||||||
| 748 | - | |||||||||||||||||||||||||
| 749 | - | |||||||||||||||||||||||||
| 750 | QSplitter::~QSplitter() | - | ||||||||||||||||||||||||
| 751 | { | - | ||||||||||||||||||||||||
| 752 | QSplitterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 753 | delete d->rubberBand; | - | ||||||||||||||||||||||||
| 754 |     while (!d->list.isEmpty()
  | 0 | ||||||||||||||||||||||||
| 755 |         delete d->list.takeFirst(); never executed:  delete d->list.takeFirst(); | 0 | ||||||||||||||||||||||||
| 756 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 757 | - | |||||||||||||||||||||||||
| 758 | - | |||||||||||||||||||||||||
| 759 | - | |||||||||||||||||||||||||
| 760 | - | |||||||||||||||||||||||||
| 761 | - | |||||||||||||||||||||||||
| 762 | void QSplitter::refresh() | - | ||||||||||||||||||||||||
| 763 | { | - | ||||||||||||||||||||||||
| 764 | QSplitterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 765 | d->recalc(true); | - | ||||||||||||||||||||||||
| 766 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 767 | void QSplitter::setOrientation(Qt::Orientation orientation) | - | ||||||||||||||||||||||||
| 768 | { | - | ||||||||||||||||||||||||
| 769 | QSplitterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 770 |     if (d->orient == orientation
  | 0 | ||||||||||||||||||||||||
| 771 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 772 | - | |||||||||||||||||||||||||
| 773 |     if (!testAttribute(Qt::WA_WState_OwnSizePolicy)
  | 0 | ||||||||||||||||||||||||
| 774 | QSizePolicy sp = sizePolicy(); | - | ||||||||||||||||||||||||
| 775 | sp.transpose(); | - | ||||||||||||||||||||||||
| 776 | setSizePolicy(sp); | - | ||||||||||||||||||||||||
| 777 | setAttribute(Qt::WA_WState_OwnSizePolicy, false); | - | ||||||||||||||||||||||||
| 778 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 779 | - | |||||||||||||||||||||||||
| 780 | d->orient = orientation; | - | ||||||||||||||||||||||||
| 781 | - | |||||||||||||||||||||||||
| 782 |     for (int i = 0; i < d->list.size()
  | 0 | ||||||||||||||||||||||||
| 783 | QSplitterLayoutStruct *s = d->list.at(i); | - | ||||||||||||||||||||||||
| 784 | s->handle->setOrientation(orientation); | - | ||||||||||||||||||||||||
| 785 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 786 | d->recalc(isVisible()); | - | ||||||||||||||||||||||||
| 787 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 788 | - | |||||||||||||||||||||||||
| 789 | Qt::Orientation QSplitter::orientation() const | - | ||||||||||||||||||||||||
| 790 | { | - | ||||||||||||||||||||||||
| 791 | const QSplitterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 792 |     return never executed:   d->orient;return d->orient;never executed:  return d->orient; | 0 | ||||||||||||||||||||||||
| 793 | } | - | ||||||||||||||||||||||||
| 794 | void QSplitter::setChildrenCollapsible(bool collapse) | - | ||||||||||||||||||||||||
| 795 | { | - | ||||||||||||||||||||||||
| 796 | QSplitterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 797 | d->childrenCollapsible = collapse; | - | ||||||||||||||||||||||||
| 798 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 799 | - | |||||||||||||||||||||||||
| 800 | bool QSplitter::childrenCollapsible() const | - | ||||||||||||||||||||||||
| 801 | { | - | ||||||||||||||||||||||||
| 802 | const QSplitterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 803 |     return never executed:   d->childrenCollapsible;return d->childrenCollapsible;never executed:  return d->childrenCollapsible; | 0 | ||||||||||||||||||||||||
| 804 | } | - | ||||||||||||||||||||||||
| 805 | void QSplitter::setCollapsible(int index, bool collapse) | - | ||||||||||||||||||||||||
| 806 | { | - | ||||||||||||||||||||||||
| 807 | QSplitterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 808 | - | |||||||||||||||||||||||||
| 809 |     if (index < 0
 
  | 0 | ||||||||||||||||||||||||
| 810 | QMessageLogger(__FILE__, 1062, __PRETTY_FUNCTION__).warning("QSplitter::setCollapsible: Index %d out of range", index); | - | ||||||||||||||||||||||||
| 811 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 812 | } | - | ||||||||||||||||||||||||
| 813 |     d->list.at(index)->collapsible = collapse
  | 0 | ||||||||||||||||||||||||
| 814 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 815 | - | |||||||||||||||||||||||||
| 816 | - | |||||||||||||||||||||||||
| 817 | - | |||||||||||||||||||||||||
| 818 | - | |||||||||||||||||||||||||
| 819 | bool QSplitter::isCollapsible(int index) const | - | ||||||||||||||||||||||||
| 820 | { | - | ||||||||||||||||||||||||
| 821 | const QSplitterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 822 |     if (index < 0
 
  | 0 | ||||||||||||||||||||||||
| 823 | QMessageLogger(__FILE__, 1075, __PRETTY_FUNCTION__).warning("QSplitter::isCollapsible: Index %d out of range", index); | - | ||||||||||||||||||||||||
| 824 |         return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||
| 825 | } | - | ||||||||||||||||||||||||
| 826 |     return never executed:   d->list.at(index)->collapsible;return d->list.at(index)->collapsible;never executed:  return d->list.at(index)->collapsible; | 0 | ||||||||||||||||||||||||
| 827 | } | - | ||||||||||||||||||||||||
| 828 | - | |||||||||||||||||||||||||
| 829 | - | |||||||||||||||||||||||||
| 830 | - | |||||||||||||||||||||||||
| 831 | - | |||||||||||||||||||||||||
| 832 | void QSplitter::resizeEvent(QResizeEvent *) | - | ||||||||||||||||||||||||
| 833 | { | - | ||||||||||||||||||||||||
| 834 | QSplitterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 835 | d->doResize(); | - | ||||||||||||||||||||||||
| 836 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 837 | void QSplitter::addWidget(QWidget *widget) | - | ||||||||||||||||||||||||
| 838 | { | - | ||||||||||||||||||||||||
| 839 | QSplitterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 840 | insertWidget(d->list.count(), widget); | - | ||||||||||||||||||||||||
| 841 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 842 | void QSplitter::insertWidget(int index, QWidget *widget) | - | ||||||||||||||||||||||||
| 843 | { | - | ||||||||||||||||||||||||
| 844 | QSplitterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 845 | d->insertWidget_helper(index, widget, true); | - | ||||||||||||||||||||||||
| 846 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 847 | int QSplitter::indexOf(QWidget *w) const | - | ||||||||||||||||||||||||
| 848 | { | - | ||||||||||||||||||||||||
| 849 | const QSplitterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 850 |     for (int i = 0; i < d->list.size()
  | 0 | ||||||||||||||||||||||||
| 851 | QSplitterLayoutStruct *s = d->list.at(i); | - | ||||||||||||||||||||||||
| 852 |         if (s->widget == w
 
  | 0 | ||||||||||||||||||||||||
| 853 |             return never executed:   i;return i;never executed:  return i; | 0 | ||||||||||||||||||||||||
| 854 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 855 |     return never executed:   -1;return -1;never executed:  return -1; | 0 | ||||||||||||||||||||||||
| 856 | } | - | ||||||||||||||||||||||||
| 857 | QSplitterHandle *QSplitter::createHandle() | - | ||||||||||||||||||||||||
| 858 | { | - | ||||||||||||||||||||||||
| 859 | QSplitterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 860 |     return never executed:   new QSplitterHandle(d->orient, this);return new QSplitterHandle(d->orient, this);never executed:  return new QSplitterHandle(d->orient, this); | 0 | ||||||||||||||||||||||||
| 861 | } | - | ||||||||||||||||||||||||
| 862 | QSplitterHandle *QSplitter::handle(int index) const | - | ||||||||||||||||||||||||
| 863 | { | - | ||||||||||||||||||||||||
| 864 | const QSplitterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 865 |     if (index < 0
 
  | 0 | ||||||||||||||||||||||||
| 866 |         return never executed:   0;return 0;never executed:  return 0; | 0 | ||||||||||||||||||||||||
| 867 |     return never executed:   d->list.at(index)->handle;return d->list.at(index)->handle;never executed:  return d->list.at(index)->handle; | 0 | ||||||||||||||||||||||||
| 868 | } | - | ||||||||||||||||||||||||
| 869 | - | |||||||||||||||||||||||||
| 870 | - | |||||||||||||||||||||||||
| 871 | - | |||||||||||||||||||||||||
| 872 | - | |||||||||||||||||||||||||
| 873 | - | |||||||||||||||||||||||||
| 874 | - | |||||||||||||||||||||||||
| 875 | QWidget *QSplitter::widget(int index) const | - | ||||||||||||||||||||||||
| 876 | { | - | ||||||||||||||||||||||||
| 877 | const QSplitterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 878 |     if (index < 0
 
  | 0 | ||||||||||||||||||||||||
| 879 |         return never executed:   0;return 0;never executed:  return 0; | 0 | ||||||||||||||||||||||||
| 880 |     return never executed:   d->list.at(index)->widget;return d->list.at(index)->widget;never executed:  return d->list.at(index)->widget; | 0 | ||||||||||||||||||||||||
| 881 | } | - | ||||||||||||||||||||||||
| 882 | - | |||||||||||||||||||||||||
| 883 | - | |||||||||||||||||||||||||
| 884 | - | |||||||||||||||||||||||||
| 885 | - | |||||||||||||||||||||||||
| 886 | - | |||||||||||||||||||||||||
| 887 | - | |||||||||||||||||||||||||
| 888 | int QSplitter::count() const | - | ||||||||||||||||||||||||
| 889 | { | - | ||||||||||||||||||||||||
| 890 | const QSplitterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 891 |     return never executed:   d->list.count();return d->list.count();never executed:  return d->list.count(); | 0 | ||||||||||||||||||||||||
| 892 | } | - | ||||||||||||||||||||||||
| 893 | void QSplitter::childEvent(QChildEvent *c) | - | ||||||||||||||||||||||||
| 894 | { | - | ||||||||||||||||||||||||
| 895 | QSplitterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 896 |     if (!c->child()->isWidgetType()
  | 0 | ||||||||||||||||||||||||
| 897 |         if (c->type() == QEvent::ChildAdded
 
  | 0 | ||||||||||||||||||||||||
| 898 |             QMessageLogger(__FILE__, 1223, __PRETTY_FUNCTION__).warning("Adding a QLayout to a QSplitter is not supported."); never executed:  QMessageLogger(__FILE__, 1223, __PRETTY_FUNCTION__).warning("Adding a QLayout to a QSplitter is not supported."); | 0 | ||||||||||||||||||||||||
| 899 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 900 | } | - | ||||||||||||||||||||||||
| 901 | QWidget *w = static_cast<QWidget*>(c->child()); | - | ||||||||||||||||||||||||
| 902 |     if (w->isWindow()
  | 0 | ||||||||||||||||||||||||
| 903 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 904 |     if (c->added()
 
 
  | 0 | ||||||||||||||||||||||||
| 905 | d->insertWidget_helper(d->list.count(), w, false); | - | ||||||||||||||||||||||||
| 906 |     } never executed:   else if (c->polished()end of block
 
  | 0 | ||||||||||||||||||||||||
| 907 |         if (isVisible()
 
 
  | 0 | ||||||||||||||||||||||||
| 908 |             w->show(); never executed:  w->show(); | 0 | ||||||||||||||||||||||||
| 909 |     } never executed:   else if (c->type() == QEvent::ChildRemovedend of block
  | 0 | ||||||||||||||||||||||||
| 910 |         for (int i = 0; i < d->list.size()
  | 0 | ||||||||||||||||||||||||
| 911 | QSplitterLayoutStruct *s = d->list.at(i); | - | ||||||||||||||||||||||||
| 912 |             if (s->widget == w
  | 0 | ||||||||||||||||||||||||
| 913 | d->list.removeAt(i); | - | ||||||||||||||||||||||||
| 914 | delete s; | - | ||||||||||||||||||||||||
| 915 | d->recalc(isVisible()); | - | ||||||||||||||||||||||||
| 916 |                 return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 917 | } | - | ||||||||||||||||||||||||
| 918 |         } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 919 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 920 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 921 | - | |||||||||||||||||||||||||
| 922 | - | |||||||||||||||||||||||||
| 923 | - | |||||||||||||||||||||||||
| 924 | - | |||||||||||||||||||||||||
| 925 | - | |||||||||||||||||||||||||
| 926 | - | |||||||||||||||||||||||||
| 927 | - | |||||||||||||||||||||||||
| 928 | void QSplitter::setRubberBand(int pos) | - | ||||||||||||||||||||||||
| 929 | { | - | ||||||||||||||||||||||||
| 930 | QSplitterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 931 |     if (pos < 0
  | 0 | ||||||||||||||||||||||||
| 932 |         if (d->rubberBand
  | 0 | ||||||||||||||||||||||||
| 933 |             d->rubberBand->deleteLater(); never executed:  d->rubberBand->deleteLater(); | 0 | ||||||||||||||||||||||||
| 934 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 935 | } | - | ||||||||||||||||||||||||
| 936 | QRect r = contentsRect(); | - | ||||||||||||||||||||||||
| 937 | const int rBord = 3; | - | ||||||||||||||||||||||||
| 938 | int hw = handleWidth(); | - | ||||||||||||||||||||||||
| 939 |     if (!d->rubberBand
  | 0 | ||||||||||||||||||||||||
| 940 | QBoolBlocker b(d->blockChildAdd); | - | ||||||||||||||||||||||||
| 941 | d->rubberBand = new QRubberBand(QRubberBand::Line, this); | - | ||||||||||||||||||||||||
| 942 | - | |||||||||||||||||||||||||
| 943 | d->rubberBand->setObjectName(QLatin1String("qt_rubberband")); | - | ||||||||||||||||||||||||
| 944 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 945 | - | |||||||||||||||||||||||||
| 946 |     const QRect newGeom = d->orient == Qt::Horizontal
  | 0 | ||||||||||||||||||||||||
| 947 | : QRect(QPoint(r.x(), pos + hw / 2 - rBord), QSize(r.width(), 2 * rBord)); | - | ||||||||||||||||||||||||
| 948 | d->rubberBand->setGeometry(newGeom); | - | ||||||||||||||||||||||||
| 949 | d->rubberBand->show(); | - | ||||||||||||||||||||||||
| 950 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 951 | - | |||||||||||||||||||||||||
| 952 | - | |||||||||||||||||||||||||
| 953 | - | |||||||||||||||||||||||||
| 954 | - | |||||||||||||||||||||||||
| 955 | - | |||||||||||||||||||||||||
| 956 | bool QSplitter::event(QEvent *e) | - | ||||||||||||||||||||||||
| 957 | { | - | ||||||||||||||||||||||||
| 958 | QSplitterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 959 | switch (e->type()) { | - | ||||||||||||||||||||||||
| 960 |     case never executed:   QEvent::Hide:case QEvent::Hide:never executed:  case QEvent::Hide: | 0 | ||||||||||||||||||||||||
| 961 | - | |||||||||||||||||||||||||
| 962 |         if (!d->firstShow
  | 0 | ||||||||||||||||||||||||
| 963 |             d->firstShow = true; never executed:  d->firstShow = true; | 0 | ||||||||||||||||||||||||
| 964 |         break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 965 |     case never executed:   QEvent::Show:case QEvent::Show:never executed:  case QEvent::Show: | 0 | ||||||||||||||||||||||||
| 966 |         if (!d->firstShow
  | 0 | ||||||||||||||||||||||||
| 967 |             break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 968 | d->firstShow = false; | - | ||||||||||||||||||||||||
| 969 | - | |||||||||||||||||||||||||
| 970 |     case never executed:   QEvent::HideToParent:case QEvent::HideToParent:never executed:  case QEvent::HideToParent:code before this statement never executed:  case QEvent::HideToParent: | 0 | ||||||||||||||||||||||||
| 971 |     case never executed:   QEvent::ShowToParent:case QEvent::ShowToParent:never executed:  case QEvent::ShowToParent: | 0 | ||||||||||||||||||||||||
| 972 |     case never executed:   QEvent::LayoutRequest:case QEvent::LayoutRequest:never executed:  case QEvent::LayoutRequest: | 0 | ||||||||||||||||||||||||
| 973 | d->recalc(isVisible()); | - | ||||||||||||||||||||||||
| 974 |         break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 975 |     default never executed:  :default:never executed:  default: | 0 | ||||||||||||||||||||||||
| 976 | ; | - | ||||||||||||||||||||||||
| 977 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 978 |     return never executed:   QWidget::event(e);return QWidget::event(e);never executed:  return QWidget::event(e); | 0 | ||||||||||||||||||||||||
| 979 | } | - | ||||||||||||||||||||||||
| 980 | void QSplitter::moveSplitter(int pos, int index) | - | ||||||||||||||||||||||||
| 981 | { | - | ||||||||||||||||||||||||
| 982 | QSplitterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 983 | QSplitterLayoutStruct *s = d->list.at(index); | - | ||||||||||||||||||||||||
| 984 | int farMin; | - | ||||||||||||||||||||||||
| 985 | int min; | - | ||||||||||||||||||||||||
| 986 | int max; | - | ||||||||||||||||||||||||
| 987 | int farMax; | - | ||||||||||||||||||||||||
| 988 | - | |||||||||||||||||||||||||
| 989 | - | |||||||||||||||||||||||||
| 990 | - | |||||||||||||||||||||||||
| 991 | - | |||||||||||||||||||||||||
| 992 | - | |||||||||||||||||||||||||
| 993 | pos = d->adjustPos(pos, index, &farMin, &min, &max, &farMax); | - | ||||||||||||||||||||||||
| 994 | int oldP = d->pick(s->rect.topLeft()); | - | ||||||||||||||||||||||||
| 995 | - | |||||||||||||||||||||||||
| 996 | - | |||||||||||||||||||||||||
| 997 | - | |||||||||||||||||||||||||
| 998 | - | |||||||||||||||||||||||||
| 999 | QVarLengthArray<int, 32> poss(d->list.count()); | - | ||||||||||||||||||||||||
| 1000 | QVarLengthArray<int, 32> ws(d->list.count()); | - | ||||||||||||||||||||||||
| 1001 | bool upLeft; | - | ||||||||||||||||||||||||
| 1002 | - | |||||||||||||||||||||||||
| 1003 | d->doMove(false, pos, index, +1, (d->collapsible(s) && (pos > max)), poss.data(), ws.data()); | - | ||||||||||||||||||||||||
| 1004 | d->doMove(true, pos, index - 1, +1, (d->collapsible(index - 1) && (pos < min)), poss.data(), ws.data()); | - | ||||||||||||||||||||||||
| 1005 | upLeft = (pos < oldP); | - | ||||||||||||||||||||||||
| 1006 | - | |||||||||||||||||||||||||
| 1007 | int wid, delta, count = d->list.count(); | - | ||||||||||||||||||||||||
| 1008 |     if (upLeft
  | 0 | ||||||||||||||||||||||||
| 1009 | wid = 0; | - | ||||||||||||||||||||||||
| 1010 | delta = 1; | - | ||||||||||||||||||||||||
| 1011 |     } never executed:   else {end of block | 0 | ||||||||||||||||||||||||
| 1012 | wid = count - 1; | - | ||||||||||||||||||||||||
| 1013 | delta = -1; | - | ||||||||||||||||||||||||
| 1014 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1015 |     for (; wid >= 0
 
  | 0 | ||||||||||||||||||||||||
| 1016 | QSplitterLayoutStruct *sls = d->list.at( wid ); | - | ||||||||||||||||||||||||
| 1017 |         if (!sls->widget->isHidden()
  | 0 | ||||||||||||||||||||||||
| 1018 |             d->setGeo(sls, poss[wid], ws[wid], true); never executed:  d->setGeo(sls, poss[wid], ws[wid], true); | 0 | ||||||||||||||||||||||||
| 1019 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1020 | d->storeSizes(); | - | ||||||||||||||||||||||||
| 1021 | - | |||||||||||||||||||||||||
| 1022 | splitterMoved(pos, index); | - | ||||||||||||||||||||||||
| 1023 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1024 | - | |||||||||||||||||||||||||
| 1025 | - | |||||||||||||||||||||||||
| 1026 | - | |||||||||||||||||||||||||
| 1027 | - | |||||||||||||||||||||||||
| 1028 | - | |||||||||||||||||||||||||
| 1029 | - | |||||||||||||||||||||||||
| 1030 | - | |||||||||||||||||||||||||
| 1031 | void QSplitter::getRange(int index, int *min, int *max) const | - | ||||||||||||||||||||||||
| 1032 | { | - | ||||||||||||||||||||||||
| 1033 | const QSplitterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1034 | d->getRange(index, min, 0, 0, max); | - | ||||||||||||||||||||||||
| 1035 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1036 | int QSplitter::closestLegalPosition(int pos, int index) | - | ||||||||||||||||||||||||
| 1037 | { | - | ||||||||||||||||||||||||
| 1038 | QSplitterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1039 | int x, i, n, u; | - | ||||||||||||||||||||||||
| 1040 |     return never executed:   d->adjustPos(pos, index, &u, &n, &i, &x);return d->adjustPos(pos, index, &u, &n, &i, &x);never executed:  return d->adjustPos(pos, index, &u, &n, &i, &x); | 0 | ||||||||||||||||||||||||
| 1041 | } | - | ||||||||||||||||||||||||
| 1042 | bool QSplitter::opaqueResize() const | - | ||||||||||||||||||||||||
| 1043 | { | - | ||||||||||||||||||||||||
| 1044 | const QSplitterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1045 |     return never executed:   d->opaqueResizeSetreturn d->opaqueResizeSet ? d->opaque : style()->styleHint(QStyle::SH_Splitter_OpaqueResize, 0, this);
 never executed:  return d->opaqueResizeSet ? d->opaque : style()->styleHint(QStyle::SH_Splitter_OpaqueResize, 0, this); | 0 | ||||||||||||||||||||||||
| 1046 | } | - | ||||||||||||||||||||||||
| 1047 | - | |||||||||||||||||||||||||
| 1048 | - | |||||||||||||||||||||||||
| 1049 | void QSplitter::setOpaqueResize(bool on) | - | ||||||||||||||||||||||||
| 1050 | { | - | ||||||||||||||||||||||||
| 1051 | QSplitterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1052 | d->opaqueResizeSet = true; | - | ||||||||||||||||||||||||
| 1053 | d->opaque = on; | - | ||||||||||||||||||||||||
| 1054 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1055 | - | |||||||||||||||||||||||||
| 1056 | - | |||||||||||||||||||||||||
| 1057 | - | |||||||||||||||||||||||||
| 1058 | - | |||||||||||||||||||||||||
| 1059 | - | |||||||||||||||||||||||||
| 1060 | QSize QSplitter::sizeHint() const | - | ||||||||||||||||||||||||
| 1061 | { | - | ||||||||||||||||||||||||
| 1062 | const QSplitterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1063 | ensurePolished(); | - | ||||||||||||||||||||||||
| 1064 | int l = 0; | - | ||||||||||||||||||||||||
| 1065 | int t = 0; | - | ||||||||||||||||||||||||
| 1066 |     for (int i = 0; i < d->list.size()
  | 0 | ||||||||||||||||||||||||
| 1067 | QWidget *w = d->list.at(i)->widget; | - | ||||||||||||||||||||||||
| 1068 |         if (w->isHidden()
  | 0 | ||||||||||||||||||||||||
| 1069 |             continue; never executed:  continue; | 0 | ||||||||||||||||||||||||
| 1070 | QSize s = w->sizeHint(); | - | ||||||||||||||||||||||||
| 1071 |         if (s.isValid()
  | 0 | ||||||||||||||||||||||||
| 1072 | l += d->pick(s); | - | ||||||||||||||||||||||||
| 1073 | t = qMax(t, d->trans(s)); | - | ||||||||||||||||||||||||
| 1074 |         } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1075 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1076 |     return never executed:   orientation() == Qt::Horizontalreturn orientation() == Qt::Horizontal ? QSize(l, t) : QSize(t, l);
 never executed:  return orientation() == Qt::Horizontal ? QSize(l, t) : QSize(t, l); | 0 | ||||||||||||||||||||||||
| 1077 | } | - | ||||||||||||||||||||||||
| 1078 | - | |||||||||||||||||||||||||
| 1079 | - | |||||||||||||||||||||||||
| 1080 | - | |||||||||||||||||||||||||
| 1081 | - | |||||||||||||||||||||||||
| 1082 | - | |||||||||||||||||||||||||
| 1083 | - | |||||||||||||||||||||||||
| 1084 | QSize QSplitter::minimumSizeHint() const | - | ||||||||||||||||||||||||
| 1085 | { | - | ||||||||||||||||||||||||
| 1086 | const QSplitterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1087 | ensurePolished(); | - | ||||||||||||||||||||||||
| 1088 | int l = 0; | - | ||||||||||||||||||||||||
| 1089 | int t = 0; | - | ||||||||||||||||||||||||
| 1090 | - | |||||||||||||||||||||||||
| 1091 |     for (int i = 0; i < d->list.size()
  | 0 | ||||||||||||||||||||||||
| 1092 | QSplitterLayoutStruct *s = d->list.at(i); | - | ||||||||||||||||||||||||
| 1093 |         if (!s
 
  | 0 | ||||||||||||||||||||||||
| 1094 |             continue; never executed:  continue; | 0 | ||||||||||||||||||||||||
| 1095 |         if (s->widget->isHidden()
  | 0 | ||||||||||||||||||||||||
| 1096 |             continue; never executed:  continue; | 0 | ||||||||||||||||||||||||
| 1097 | QSize widgetSize = qSmartMinSize(s->widget); | - | ||||||||||||||||||||||||
| 1098 |         if (widgetSize.isValid()
  | 0 | ||||||||||||||||||||||||
| 1099 | l += d->pick(widgetSize); | - | ||||||||||||||||||||||||
| 1100 | t = qMax(t, d->trans(widgetSize)); | - | ||||||||||||||||||||||||
| 1101 |         } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1102 |         if (!s->handle
 
  | 0 | ||||||||||||||||||||||||
| 1103 |             continue; never executed:  continue; | 0 | ||||||||||||||||||||||||
| 1104 | QSize splitterSize = s->handle->sizeHint(); | - | ||||||||||||||||||||||||
| 1105 |         if (splitterSize.isValid()
  | 0 | ||||||||||||||||||||||||
| 1106 | l += d->pick(splitterSize); | - | ||||||||||||||||||||||||
| 1107 | t = qMax(t, d->trans(splitterSize)); | - | ||||||||||||||||||||||||
| 1108 |         } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1109 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1110 |     return never executed:   orientation() == Qt::Horizontalreturn orientation() == Qt::Horizontal ? QSize(l, t) : QSize(t, l);
 never executed:  return orientation() == Qt::Horizontal ? QSize(l, t) : QSize(t, l); | 0 | ||||||||||||||||||||||||
| 1111 | } | - | ||||||||||||||||||||||||
| 1112 | QList<int> QSplitter::sizes() const | - | ||||||||||||||||||||||||
| 1113 | { | - | ||||||||||||||||||||||||
| 1114 | const QSplitterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1115 | ensurePolished(); | - | ||||||||||||||||||||||||
| 1116 | - | |||||||||||||||||||||||||
| 1117 | const int numSizes = d->list.size(); | - | ||||||||||||||||||||||||
| 1118 | QList<int> list; | - | ||||||||||||||||||||||||
| 1119 | list.reserve(numSizes); | - | ||||||||||||||||||||||||
| 1120 | - | |||||||||||||||||||||||||
| 1121 |     for (int i = 0; i < numSizes
  | 0 | ||||||||||||||||||||||||
| 1122 | QSplitterLayoutStruct *s = d->list.at(i); | - | ||||||||||||||||||||||||
| 1123 | list.append(d->pick(s->rect.size())); | - | ||||||||||||||||||||||||
| 1124 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1125 |     return never executed:   list;return list;never executed:  return list; | 0 | ||||||||||||||||||||||||
| 1126 | } | - | ||||||||||||||||||||||||
| 1127 | void QSplitter::setSizes(const QList<int> &list) | - | ||||||||||||||||||||||||
| 1128 | { | - | ||||||||||||||||||||||||
| 1129 | QSplitterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1130 | d->setSizes_helper(list, true); | - | ||||||||||||||||||||||||
| 1131 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1132 | int QSplitter::handleWidth() const | - | ||||||||||||||||||||||||
| 1133 | { | - | ||||||||||||||||||||||||
| 1134 | const QSplitterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1135 |     if (d->handleWidth >= 0
  | 0 | ||||||||||||||||||||||||
| 1136 |         return never executed:   d->handleWidth;return d->handleWidth;never executed:  return d->handleWidth; | 0 | ||||||||||||||||||||||||
| 1137 | } else { | - | ||||||||||||||||||||||||
| 1138 |         return never executed:   style()->pixelMetric(QStyle::PM_SplitterWidth, 0, this);return style()->pixelMetric(QStyle::PM_SplitterWidth, 0, this);never executed:  return style()->pixelMetric(QStyle::PM_SplitterWidth, 0, this); | 0 | ||||||||||||||||||||||||
| 1139 | } | - | ||||||||||||||||||||||||
| 1140 | } | - | ||||||||||||||||||||||||
| 1141 | - | |||||||||||||||||||||||||
| 1142 | void QSplitter::setHandleWidth(int width) | - | ||||||||||||||||||||||||
| 1143 | { | - | ||||||||||||||||||||||||
| 1144 | QSplitterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1145 | d->handleWidth = width; | - | ||||||||||||||||||||||||
| 1146 | d->updateHandles(); | - | ||||||||||||||||||||||||
| 1147 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1148 | - | |||||||||||||||||||||||||
| 1149 | - | |||||||||||||||||||||||||
| 1150 | - | |||||||||||||||||||||||||
| 1151 | - | |||||||||||||||||||||||||
| 1152 | void QSplitter::changeEvent(QEvent *ev) | - | ||||||||||||||||||||||||
| 1153 | { | - | ||||||||||||||||||||||||
| 1154 | QSplitterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1155 |     if(ev->type() == QEvent::StyleChange
  | 0 | ||||||||||||||||||||||||
| 1156 |         d->updateHandles(); never executed:  d->updateHandles(); | 0 | ||||||||||||||||||||||||
| 1157 | QFrame::changeEvent(ev); | - | ||||||||||||||||||||||||
| 1158 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1159 | - | |||||||||||||||||||||||||
| 1160 | static const qint32 SplitterMagic = 0xff; | - | ||||||||||||||||||||||||
| 1161 | QByteArray QSplitter::saveState() const | - | ||||||||||||||||||||||||
| 1162 | { | - | ||||||||||||||||||||||||
| 1163 | const QSplitterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1164 | int version = 1; | - | ||||||||||||||||||||||||
| 1165 | QByteArray data; | - | ||||||||||||||||||||||||
| 1166 | QDataStream stream(&data, QIODevice::WriteOnly); | - | ||||||||||||||||||||||||
| 1167 | - | |||||||||||||||||||||||||
| 1168 | stream << qint32(SplitterMagic); | - | ||||||||||||||||||||||||
| 1169 | stream << qint32(version); | - | ||||||||||||||||||||||||
| 1170 | const int numSizes = d->list.size(); | - | ||||||||||||||||||||||||
| 1171 | QList<int> list; | - | ||||||||||||||||||||||||
| 1172 | list.reserve(numSizes); | - | ||||||||||||||||||||||||
| 1173 |     for (int i = 0; i < numSizes
  | 0 | ||||||||||||||||||||||||
| 1174 | QSplitterLayoutStruct *s = d->list.at(i); | - | ||||||||||||||||||||||||
| 1175 | list.append(s->sizer); | - | ||||||||||||||||||||||||
| 1176 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1177 | stream << list; | - | ||||||||||||||||||||||||
| 1178 | stream << childrenCollapsible(); | - | ||||||||||||||||||||||||
| 1179 | stream << qint32(d->handleWidth); | - | ||||||||||||||||||||||||
| 1180 | stream << opaqueResize(); | - | ||||||||||||||||||||||||
| 1181 | stream << qint32(orientation()); | - | ||||||||||||||||||||||||
| 1182 | stream << d->opaqueResizeSet; | - | ||||||||||||||||||||||||
| 1183 |     return never executed:   data;return data;never executed:  return data; | 0 | ||||||||||||||||||||||||
| 1184 | } | - | ||||||||||||||||||||||||
| 1185 | bool QSplitter::restoreState(const QByteArray &state) | - | ||||||||||||||||||||||||
| 1186 | { | - | ||||||||||||||||||||||||
| 1187 | QSplitterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1188 | int version = 1; | - | ||||||||||||||||||||||||
| 1189 | QByteArray sd = state; | - | ||||||||||||||||||||||||
| 1190 | QDataStream stream(&sd, QIODevice::ReadOnly); | - | ||||||||||||||||||||||||
| 1191 | QList<int> list; | - | ||||||||||||||||||||||||
| 1192 | bool b; | - | ||||||||||||||||||||||||
| 1193 | qint32 i; | - | ||||||||||||||||||||||||
| 1194 | qint32 marker; | - | ||||||||||||||||||||||||
| 1195 | qint32 v; | - | ||||||||||||||||||||||||
| 1196 | - | |||||||||||||||||||||||||
| 1197 | stream >> marker; | - | ||||||||||||||||||||||||
| 1198 | stream >> v; | - | ||||||||||||||||||||||||
| 1199 |     if (marker != SplitterMagic
 
  | 0 | ||||||||||||||||||||||||
| 1200 |         return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||
| 1201 | - | |||||||||||||||||||||||||
| 1202 | stream >> list; | - | ||||||||||||||||||||||||
| 1203 | d->setSizes_helper(list, false); | - | ||||||||||||||||||||||||
| 1204 | - | |||||||||||||||||||||||||
| 1205 | stream >> b; | - | ||||||||||||||||||||||||
| 1206 | setChildrenCollapsible(b); | - | ||||||||||||||||||||||||
| 1207 | - | |||||||||||||||||||||||||
| 1208 | stream >> i; | - | ||||||||||||||||||||||||
| 1209 | setHandleWidth(i); | - | ||||||||||||||||||||||||
| 1210 | - | |||||||||||||||||||||||||
| 1211 | stream >> b; | - | ||||||||||||||||||||||||
| 1212 | setOpaqueResize(b); | - | ||||||||||||||||||||||||
| 1213 | - | |||||||||||||||||||||||||
| 1214 | stream >> i; | - | ||||||||||||||||||||||||
| 1215 | setOrientation(Qt::Orientation(i)); | - | ||||||||||||||||||||||||
| 1216 | d->doResize(); | - | ||||||||||||||||||||||||
| 1217 | - | |||||||||||||||||||||||||
| 1218 |     if (v >= 1
  | 0 | ||||||||||||||||||||||||
| 1219 |         stream >> d->opaqueResizeSet; never executed:  stream >> d->opaqueResizeSet; | 0 | ||||||||||||||||||||||||
| 1220 | - | |||||||||||||||||||||||||
| 1221 |     return never executed:   true;return true;never executed:  return true; | 0 | ||||||||||||||||||||||||
| 1222 | } | - | ||||||||||||||||||||||||
| 1223 | void QSplitter::setStretchFactor(int index, int stretch) | - | ||||||||||||||||||||||||
| 1224 | { | - | ||||||||||||||||||||||||
| 1225 | QSplitterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1226 |     if (index <= -1
 
  | 0 | ||||||||||||||||||||||||
| 1227 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 1228 | - | |||||||||||||||||||||||||
| 1229 | QWidget *widget = d->list.at(index)->widget; | - | ||||||||||||||||||||||||
| 1230 | QSizePolicy sp = widget->sizePolicy(); | - | ||||||||||||||||||||||||
| 1231 | sp.setHorizontalStretch(stretch); | - | ||||||||||||||||||||||||
| 1232 | sp.setVerticalStretch(stretch); | - | ||||||||||||||||||||||||
| 1233 | widget->setSizePolicy(sp); | - | ||||||||||||||||||||||||
| 1234 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1235 | QTextStream& operator<<(QTextStream& ts, const QSplitter& splitter) | - | ||||||||||||||||||||||||
| 1236 | { | - | ||||||||||||||||||||||||
| 1237 | ts << splitter.saveState() << endl; | - | ||||||||||||||||||||||||
| 1238 |     return never executed:   ts;return ts;never executed:  return ts; | 0 | ||||||||||||||||||||||||
| 1239 | } | - | ||||||||||||||||||||||||
| 1240 | QTextStream& operator>>(QTextStream& ts, QSplitter& splitter) | - | ||||||||||||||||||||||||
| 1241 | { | - | ||||||||||||||||||||||||
| 1242 | QString line = ts.readLine(); | - | ||||||||||||||||||||||||
| 1243 | line = line.simplified(); | - | ||||||||||||||||||||||||
| 1244 | line.replace(QLatin1Char(' '), QString()); | - | ||||||||||||||||||||||||
| 1245 | line = line.toUpper(); | - | ||||||||||||||||||||||||
| 1246 | - | |||||||||||||||||||||||||
| 1247 | splitter.restoreState(line.toLatin1()); | - | ||||||||||||||||||||||||
| 1248 |     return never executed:   ts;return ts;never executed:  return ts; | 0 | ||||||||||||||||||||||||
| 1249 | } | - | ||||||||||||||||||||||||
| 1250 | - | |||||||||||||||||||||||||
| 1251 | - | |||||||||||||||||||||||||
| 1252 | - | |||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |