}
l.maxWidth = max(l.maxWidth, l.minWidth);
-#ifdef DEBUG_LAYOUT
- qDebug("col %d, final min=%d, max=%d, width=%d(%d)", effCol, l.minWidth, l.maxWidth, l.width.value, l.width.type);
-#endif
// ### we need to add col elements as well
}
if ((w.isFixed() || w.isPercent()) && w.isZero())
w = Length();
int cEffCol = m_table->colToEffCol(cCol);
-#ifdef DEBUG_LAYOUT
- qDebug(" col element %d (eff=%d): Length=%d(%d), span=%d, effColSpan=%d", cCol, cEffCol, w.value, w.type, span, m_table->spanOfEffCol(cEffCol));
-#endif
if (!w.isAuto() && span == 1 && cEffCol < nEffCols) {
if (m_table->spanOfEffCol(cEffCol) == 1) {
m_layoutStruct[cEffCol].width = w;
unsigned int nEffCols = m_layoutStruct.size();
int hspacing = m_table->hBorderSpacing();
-#ifdef DEBUG_LAYOUT
- qDebug("AutoTableLayout::calcEffectiveWidth for %d cols", nEffCols);
-#endif
+
for (unsigned int i = 0; i < nEffCols; i++) {
m_layoutStruct[i].effWidth = m_layoutStruct[i].width;
m_layoutStruct[i].effMinWidth = m_layoutStruct[i].minWidth;
fullRecalc();
nEffCols = m_table->numEffCols();
}
-#ifdef DEBUG_LAYOUT
- qDebug("AutoTableLayout::layout()");
-#endif
if (m_effWidthDirty)
calcEffectiveWidth();
-#ifdef DEBUG_LAYOUT
- qDebug(" tableWidth=%d, nEffCols=%d", tableWidth, nEffCols);
- for (int i = 0; i < nEffCols; i++) {
- qDebug(" effcol %d is of type %d value %d, minWidth=%d, maxWidth=%d",
- i, m_layoutStruct[i].width.type, m_layoutStruct[i].width.value,
- m_layoutStruct[i].minWidth, m_layoutStruct[i].maxWidth);
- qDebug(" effective: type %d value %d, minWidth=%d, maxWidth=%d",
- m_layoutStruct[i].effWidth.type, m_layoutStruct[i].effWidth.value,
- m_layoutStruct[i].effMinWidth, m_layoutStruct[i].effMaxWidth);
- }
-#endif
-
bool havePercent = false;
bool haveRelative = false;
int totalRelative = 0;
}
}
}
-#ifdef DEBUG_LAYOUT
- qDebug("percent satisfied: available is %d", available);
-#endif
// then allocate width to fixed cols
if (available > 0) {
}
}
}
-#ifdef DEBUG_LAYOUT
- qDebug("fixed satisfied: available is %d", available);
-#endif
// now satisfy relative
if (available > 0) {
}
}
}
-#ifdef DEBUG_LAYOUT
- qDebug("variable satisfied: available is %d", available);
-#endif
// spread over fixed columns
if (available > 0 && numFixed) {
}
}
}
-
-#ifdef DEBUG_LAYOUT
- qDebug("after fixed distribution: available=%d", available);
-#endif
-
+
// spread over percent colums
if (available > 0 && m_hasPercent && totalPercent < 100 * percentScaleFactor) {
// still have some width to spread, distribute weighted to percent columns
}
}
-#ifdef DEBUG_LAYOUT
- qDebug("after percent distribution: available=%d", available);
-#endif
-
// spread over the rest
if (available > 0 && nEffCols > numAutoEmptyCellsOnly) {
int total = nEffCols - numAutoEmptyCellsOnly;
int i = nEffCols;
while (i--) {
// variable columns with empty cells only don't get any width
- if (m_layoutStruct[i].width.isAuto() && m_layoutStruct[i].emptyCellsOnly)
+ if (m_layoutStruct[i].effWidth.isAuto() && m_layoutStruct[i].emptyCellsOnly)
continue;
int w = available / total;
available -= w;
}
}
-#ifdef DEBUG_LAYOUT
- qDebug("after equal distribution: available=%d", available);
-#endif
// if we have overallocated, reduce every cell according to the difference between desired width and minwidth
// this seems to produce to the pixel exaxt results with IE. Wonder is some of this also holds for width distributing.
if (available < 0) {
int pos = 0;
for (int i = 0; i < nEffCols; i++) {
-#ifdef DEBUG_LAYOUT
- qDebug("col %d: %d (width %d)", i, pos, m_layoutStruct[i].calcWidth);
-#endif
m_table->columnPositions()[i] = pos;
pos += m_layoutStruct[i].calcWidth + m_table->hBorderSpacing();
}