if (!lay)
return false;
int i = 0;
- QLayoutItem *child;
- while ((child = lay->itemAt(i))) {
+ while (QLayoutItem *child = lay->itemAt(i)) {
if (child->widget() == w) {
delete lay->takeAt(i);
lay->invalidate();
This function may be called during the QObject destructor,
when the parent no longer is a QWidget.
*/
- if (d->topLevel && parent() && parent()->isWidgetType() &&
- ((QWidget*)parent())->layout() == this)
- ((QWidget*)parent())->d_func()->layout = 0;
+ QWidget *mw = static_cast<QWidget*>(parent());
+ if (d->topLevel && mw && mw->isWidgetType() && mw->layout() == this)
+ mw->d_func()->layout = Q_NULLPTR;
}
item->invalidate();
QLayout *layout = item->layout();
if (layout) {
- QLayoutItem *child;
int i=0;
- while ((child = layout->itemAt(i++)))
+ while (QLayoutItem *child = layout->itemAt(i++))
activateRecursiveHelper(child);
layout->d_func()->activated = true;
}
void QLayout::removeWidget(QWidget *widget)
{
int i = 0;
- QLayoutItem *child;
- while ((child = itemAt(i))) {
+ while (QLayoutItem *child = itemAt(i)) {
if (child->widget() == widget) {
delete takeAt(i);
invalidate();
void QLayout::removeItem(QLayoutItem *item)
{
int i = 0;
- QLayoutItem *child;
- while ((child = itemAt(i))) {
+ while (QLayoutItem *child = itemAt(i)) {
if (child == item) {
takeAt(i);
invalidate();
bool allEmptyNonstretch = true;
int pendingSpacing = -1;
int spacerCount = 0;
- int i;
- for (i = start; i < start + count; i++) {
+ for (int i = start; i < start + count; i++) {
QLayoutStruct *data = &chain[i];
data->done = false;
QList<int> list;
- for (i = start; i < start + count; i++)
+ for (int i = start; i < start + count; i++)
list << chain.at(i).minimumSize;
qSort(list);
int maxval = current - deficitPerItem;
int rest = 0;
- for (i = start; i < start + count; i++) {
+ for (int i = start; i < start + count; i++) {
int maxv = maxval;
rest += remainder;
if (rest >= items) {
int overdraft = cHint - space_left;
// first give to the fixed ones:
- for (i = start; i < start + count; i++) {
+ for (int i = start; i < start + count; i++) {
QLayoutStruct *data = &chain[i];
if (!data->done
&& data->minimumSize >= data->smartSizeHint()) {
Fixed64 fp_over = toFixed(overdraft);
Fixed64 fp_w = 0;
- for (i = start; i < start+count; i++) {
+ for (int i = start; i < start+count; i++) {
QLayoutStruct *data = &chain[i];
if (data->done)
continue;
int n = count;
int space_left = space - sumSpacing;
// first give to the fixed ones, and handle non-expansiveness
- for (i = start; i < start + count; i++) {
+ for (int i = start; i < start + count; i++) {
QLayoutStruct *data = &chain[i];
if (!data->done
&& (data->maximumSize <= data->smartSizeHint()
surplus = deficit = 0;
Fixed64 fp_space = toFixed(space_left);
Fixed64 fp_w = 0;
- for (i = start; i < start + count; i++) {
+ for (int i = start; i < start + count; i++) {
QLayoutStruct *data = &chain[i];
if (data->done)
continue;
}
if (deficit > 0 && surplus <= deficit) {
// give to the ones that have too little
- for (i = start; i < start+count; i++) {
+ for (int i = start; i < start+count; i++) {
QLayoutStruct *data = &chain[i];
if (!data->done && data->size < data->smartSizeHint()) {
data->size = data->smartSizeHint();
}
if (surplus > 0 && surplus >= deficit) {
// take from the ones that have too much
- for (i = start; i < start + count; i++) {
+ for (int i = start; i < start + count; i++) {
QLayoutStruct *data = &chain[i];
if (!data->done && data->size > data->maximumSize) {
data->size = data->maximumSize;
*/
int extra = extraspace / (spacerCount + 2);
int p = pos + extra;
- for (i = start; i < start+count; i++) {
+ for (int i = start; i < start+count; i++) {
QLayoutStruct *data = &chain[i];
data->pos = p;
p += data->size;
#ifdef QLAYOUT_EXTRA_DEBUG
qDebug() << "qGeomCalc" << "start" << start << "count" << count << "pos" << pos
<< "space" << space << "spacer" << spacer;
- for (i = start; i < start + count; ++i) {
+ for (int i = start; i < start + count; ++i) {
qDebug() << i << ':' << chain[i].minimumSize << chain[i].smartSizeHint()
<< chain[i].maximumSize << "stretch" << chain[i].stretch
<< "empty" << chain[i].empty << "expansive" << chain[i].expansive