summaryrefslogtreecommitdiffstats
path: root/kexi/widget/utils/kexiflowlayout.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-25 05:28:35 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-25 05:28:35 +0000
commitf008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch)
tree8e9244c4d4957c36be81e15b566b4aa5ea26c982 /kexi/widget/utils/kexiflowlayout.cpp
parent1210f27b660efb7b37ff43ec68763e85a403471f (diff)
downloadkoffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.tar.gz
koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.zip
TQt4 port koffice
This should enable compilation under both Qt3 and Qt4; fixes for any missed components will be forthcoming git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1238284 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kexi/widget/utils/kexiflowlayout.cpp')
-rw-r--r--kexi/widget/utils/kexiflowlayout.cpp329
1 files changed, 182 insertions, 147 deletions
diff --git a/kexi/widget/utils/kexiflowlayout.cpp b/kexi/widget/utils/kexiflowlayout.cpp
index b8a8601e..d7150c6b 100644
--- a/kexi/widget/utils/kexiflowlayout.cpp
+++ b/kexi/widget/utils/kexiflowlayout.cpp
@@ -23,20 +23,20 @@
/// Iterator class
-class KexiFlowLayoutIterator : public QGLayoutIterator
+class KexiFlowLayoutIterator : public TQGLayoutIterator
{
public:
- KexiFlowLayoutIterator( QPtrList<QLayoutItem> *list )
+ KexiFlowLayoutIterator( TQPtrList<TQLayoutItem> *list )
: m_idx(0), m_list( list )
{}
uint count() const;
- QLayoutItem *current();
- QLayoutItem *next();
- QLayoutItem *takeCurrent();
+ TQLayoutItem *current();
+ TQLayoutItem *next();
+ TQLayoutItem *takeCurrent();
private:
int m_idx;
- QPtrList<QLayoutItem> *m_list;
+ TQPtrList<TQLayoutItem> *m_list;
};
uint
@@ -45,47 +45,47 @@ KexiFlowLayoutIterator::count() const
return m_list->count();
}
-QLayoutItem *
+TQLayoutItem *
KexiFlowLayoutIterator::current()
{
return (m_idx < (int)count()) ? m_list->at(m_idx) : 0;
}
-QLayoutItem *
+TQLayoutItem *
KexiFlowLayoutIterator::next()
{
m_idx++;
return current();
}
-QLayoutItem *
+TQLayoutItem *
KexiFlowLayoutIterator::takeCurrent()
{
return (m_idx < (int)count()) ? m_list->take(m_idx) : 0;
}
-//// The layout itself
+//// The tqlayout itself
-KexiFlowLayout::KexiFlowLayout(QWidget *parent, int border, int space, const char *name)
- : QLayout(parent, border, space, name)
+KexiFlowLayout::KexiFlowLayout(TQWidget *tqparent, int border, int space, const char *name)
+ : TQLayout(tqparent, border, space, name)
{
- m_orientation = Horizontal;
+ m_orientation =Qt::Horizontal;
m_justify = false;
m_cached_width = 0;
}
-KexiFlowLayout::KexiFlowLayout(QLayout* parent, int space, const char *name)
- : QLayout( parent, space, name )
+KexiFlowLayout::KexiFlowLayout(TQLayout* tqparent, int space, const char *name)
+ : TQLayout( tqparent, space, name )
{
- m_orientation = Horizontal;
+ m_orientation =Qt::Horizontal;
m_justify = false;
m_cached_width = 0;
}
KexiFlowLayout::KexiFlowLayout(int space, const char *name)
- : QLayout(space, name)
+ : TQLayout(space, name)
{
- m_orientation = Horizontal;
+ m_orientation =Qt::Horizontal;
m_justify = false;
m_cached_width = 0;
}
@@ -98,29 +98,35 @@ KexiFlowLayout::~KexiFlowLayout()
void
KexiFlowLayout::addItem(QLayoutItem *item)
{
- m_list.append(item);
+ m_list.append(TQT_TQLAYOUTITEM(item));
}
void
KexiFlowLayout::addSpacing(int size)
{
- if (m_orientation == Horizontal)
- addItem( new QSpacerItem( size, 0, QSizePolicy::Fixed, QSizePolicy::Minimum ) );
+ if (m_orientation ==Qt::Horizontal)
+ addItem( TQT_TQLAYOUTITEM(new TQSpacerItem( size, 0, TQSizePolicy::Fixed, TQSizePolicy::Minimum )) );
else
- addItem( new QSpacerItem( 0, size, QSizePolicy::Minimum, QSizePolicy::Fixed ) );
+ addItem( TQT_TQLAYOUTITEM(new TQSpacerItem( 0, size, TQSizePolicy::Minimum, TQSizePolicy::Fixed )) );
}
-QLayoutIterator
+TQLayoutIterator
KexiFlowLayout::iterator()
{
- return QLayoutIterator( new KexiFlowLayoutIterator(&m_list) );
+ // [FIXME]
+#ifdef USE_QT4
+ #warning [FIXME] ContainerAreaLayout iterators may not function correctly under Qt4
+ return TQLayoutIterator( this ); // [FIXME]
+#else // USE_QT4
+ return TQLayoutIterator( new KexiFlowLayoutIterator(&m_list) );
+#endif // USE_QT4
}
-QPtrList<QWidget>*
+TQPtrList<TQWidget>*
KexiFlowLayout::widgetList() const
{
- QPtrList<QWidget> *list = new QPtrList<QWidget>();
- for (QPtrListIterator<QLayoutItem> it(m_list); it.current(); ++it) {
+ TQPtrList<TQWidget> *list = new TQPtrList<TQWidget>();
+ for (TQPtrListIterator<TQLayoutItem> it(m_list); it.current(); ++it) {
if(it.current()->widget())
list->append(it.current()->widget());
}
@@ -128,11 +134,11 @@ KexiFlowLayout::widgetList() const
}
void
-KexiFlowLayout::invalidate()
+KexiFlowLayout::tqinvalidate()
{
- QLayout::invalidate();
- m_cached_sizeHint = QSize();
- m_cached_minSize = QSize();
+ TQLayout::tqinvalidate();
+ m_cached_tqsizeHint = TQSize();
+ m_cached_minSize = TQSize();
m_cached_width = 0;
}
@@ -145,7 +151,7 @@ KexiFlowLayout::isEmpty()
bool
KexiFlowLayout::hasHeightForWidth() const
{
- return (m_orientation == Horizontal);
+ return (m_orientation ==Qt::Horizontal);
}
int
@@ -154,7 +160,7 @@ KexiFlowLayout::heightForWidth(int w) const
if(m_cached_width != w) {
// workaround to allow this method to stay 'const'
KexiFlowLayout *mthis = (KexiFlowLayout*)this;
- int h = mthis->simulateLayout( QRect(0,0,w,0) );
+ int h = mthis->simulateLayout( TQRect(0,0,w,0) );
mthis->m_cached_hfw = h;
mthis->m_cached_width = w;
return h;
@@ -162,73 +168,73 @@ KexiFlowLayout::heightForWidth(int w) const
return m_cached_hfw;
}
-QSize
-KexiFlowLayout::sizeHint() const
+TQSize
+KexiFlowLayout::tqsizeHint() const
{
- if(m_cached_sizeHint.isEmpty()) {
+ if(m_cached_tqsizeHint.isEmpty()) {
KexiFlowLayout *mthis = (KexiFlowLayout*)this;
- QRect r = QRect(0, 0, 2000, 2000);
+ TQRect r = TQRect(0, 0, 2000, 2000);
mthis->simulateLayout(r);
}
- return m_cached_sizeHint;
+ return m_cached_tqsizeHint;
}
-QSize
-KexiFlowLayout::minimumSize() const
+TQSize
+KexiFlowLayout::tqminimumSize() const
{
-//js: do we really need to simulate layout here?
-// I commented this out because it was impossible to stretch layout conveniently.
-// Now, minimum size is computed automatically based on item's minimumSize...
+//js: do we really need to simulate tqlayout here?
+// I commented this out because it was impossible to stretch tqlayout conveniently.
+// Now, minimum size is computed automatically based on item's tqminimumSize...
#if 0
if(m_cached_minSize.isEmpty()) {
KexiFlowLayout *mthis = (KexiFlowLayout*)this;
- QRect r = QRect(0, 0, 2000, 2000);
+ TQRect r = TQRect(0, 0, 2000, 2000);
mthis->simulateLayout(r);
}
#endif
return m_cached_minSize;
}
-QSizePolicy::ExpandData
+TQSizePolicy::ExpandData
KexiFlowLayout::expanding() const
{
- if(m_orientation == Vertical)
- return QSizePolicy::Vertically;
+ if(m_orientation == Qt::Vertical)
+ return TQ_SPVertically;
else
- return QSizePolicy::Horizontally;
+ return TQ_SPHorizontally;
}
void
-KexiFlowLayout::setGeometry(const QRect &r)
+KexiFlowLayout::setGeometry(const TQRect &r)
{
- QLayout::setGeometry(r);
- if(m_orientation == Horizontal)
+ TQLayout::setGeometry(r);
+ if(m_orientation ==Qt::Horizontal)
doHorizontalLayout(r);
else
doVerticalLayout(r);
}
int
-KexiFlowLayout::simulateLayout(const QRect &r)
+KexiFlowLayout::simulateLayout(const TQRect &r)
{
- if(m_orientation == Horizontal)
+ if(m_orientation ==Qt::Horizontal)
return doHorizontalLayout(r, true);
else
return doVerticalLayout(r, true);
}
int
-KexiFlowLayout::doHorizontalLayout(const QRect &r, bool testOnly)
+KexiFlowLayout::doHorizontalLayout(const TQRect &r, bool testOnly)
{
int x = r.x();
int y = r.y();
int h = 0; // height of this line
int availableSpace = r.width() + spacing();
- int expandingWidgets=0; // number of widgets in the line with QSizePolicy == Expanding
- QPtrListIterator<QLayoutItem> it(m_list);
- QPtrList<QLayoutItem> currentLine;
- QLayoutItem *o;
- QSize minSize, sizeHint(20, 20);
+ int expandingWidgets=0; // number of widgets in the line with TQSizePolicy == Expanding
+ TQPtrListIterator<TQLayoutItem> it(m_list);
+ TQPtrList<TQLayoutItem> currentLine;
+ TQLayoutItem *o;
+ TQSize minSize, tqsizeHint(20, 20);
int minSizeHeight = 0 - spacing();
while ( (o = it.current()) != 0 ) {
@@ -238,41 +244,41 @@ KexiFlowLayout::doHorizontalLayout(const QRect &r, bool testOnly)
}
// kdDebug() << "- doHorizontalLayout(): " << o->widget()->className() << " " << o->widget()->name() << endl;
- QSize oSizeHint = o->sizeHint(); // we cache these ones because it can take a while to get it (eg for child layouts)
+ TQSize oSizeHint = o->tqsizeHint(); // we cache these ones because it can take a while to get it (eg for child tqlayouts)
if ((x + oSizeHint.width()) > r.right() && h > 0) {
- // do the layout of current line
- QPtrListIterator<QLayoutItem> it2(currentLine);
- QLayoutItem *item;
+ // do the tqlayout of current line
+ TQPtrListIterator<TQLayoutItem> it2(currentLine);
+ TQLayoutItem *item;
int wx = r.x();
- int sizeHintWidth = 0 -spacing(), minSizeWidth=0 - spacing(), lineMinHeight=0;
+ int tqsizeHintWidth = 0 -spacing(), minSizeWidth=0 - spacing(), lineMinHeight=0;
while( (item = it2.current()) != 0 ) {
- QSize itemSizeHint = item->sizeHint(); // we cache these ones because it can take
- QSize itemMinSize = item->minimumSize(); // a while to get them
- QSize s;
+ TQSize itemSizeHint = item->tqsizeHint(); // we cache these ones because it can take
+ TQSize itemMinSize = item->tqminimumSize(); // a while to get them
+ TQSize s;
if(m_justify) {
if(expandingWidgets != 0) {
- if(item->expanding() == QSizePolicy::Horizontally || item->expanding() == QSizePolicy::BothDirections)
- s = QSize( QMIN(itemSizeHint.width() + availableSpace / expandingWidgets
+ if(item->expandingDirections() == TQSizePolicy::Horizontally || item->expandingDirections() == TQSizePolicy::BothDirections)
+ s = TQSize( TQMIN(itemSizeHint.width() + availableSpace / expandingWidgets
, r.width()), itemSizeHint.height() );
else
- s = QSize( QMIN(itemSizeHint.width(), r.width()), itemSizeHint.height() );
+ s = TQSize( TQMIN(itemSizeHint.width(), r.width()), itemSizeHint.height() );
}
else
- s = QSize( QMIN(itemSizeHint.width() + availableSpace / (int)currentLine.count()
+ s = TQSize( TQMIN(itemSizeHint.width() + availableSpace / (int)currentLine.count()
, r.width()), itemSizeHint.height() );
}
else
- s = QSize ( QMIN(itemSizeHint.width(), r.width()), itemSizeHint.height() );
+ s = TQSize ( TQMIN(itemSizeHint.width(), r.width()), itemSizeHint.height() );
if(!testOnly)
- item->setGeometry( QRect(QPoint(wx, y), s) );
+ item->setGeometry( TQRect(TQPoint(wx, y), s) );
wx = wx + s.width() + spacing();
minSizeWidth = minSizeWidth + spacing() + itemMinSize.width();
- sizeHintWidth = sizeHintWidth + spacing() + itemSizeHint.width();
- lineMinHeight = QMAX( lineMinHeight, itemMinSize.height() );
+ tqsizeHintWidth = tqsizeHintWidth + spacing() + itemSizeHint.width();
+ lineMinHeight = TQMAX( lineMinHeight, itemMinSize.height() );
++it2;
}
- sizeHint = sizeHint.expandedTo( QSize(sizeHintWidth, 0) );
- minSize = minSize.expandedTo( QSize(minSizeWidth, 0) );
+ tqsizeHint = tqsizeHint.expandedTo( TQSize(tqsizeHintWidth, 0) );
+ minSize = minSize.expandedTo( TQSize(minSizeWidth, 0) );
minSizeHeight = minSizeHeight + spacing() + lineMinHeight;
// start a new line
y = y + spacing() + h;
@@ -284,68 +290,68 @@ KexiFlowLayout::doHorizontalLayout(const QRect &r, bool testOnly)
}
x = x + spacing() + oSizeHint.width();
- h = QMAX( h, oSizeHint.height() );
+ h = TQMAX( h, oSizeHint.height() );
currentLine.append(o);
- if(o->expanding() == QSizePolicy::Horizontally || o->expanding() == QSizePolicy::BothDirections)
+ if(o->expandingDirections() == TQSizePolicy::Horizontally || o->expandingDirections() == TQSizePolicy::BothDirections)
++expandingWidgets;
- availableSpace = QMAX(0, availableSpace - spacing() - oSizeHint.width());
+ availableSpace = TQMAX(0, availableSpace - spacing() - oSizeHint.width());
++it;
}
- // don't forget to layout the last line
- QPtrListIterator<QLayoutItem> it2(currentLine);
- QLayoutItem *item;
+ // don't forget to tqlayout the last line
+ TQPtrListIterator<TQLayoutItem> it2(currentLine);
+ TQLayoutItem *item;
int wx = r.x();
- int sizeHintWidth = 0 -spacing(), minSizeWidth=0 - spacing(), lineMinHeight=0;
+ int tqsizeHintWidth = 0 -spacing(), minSizeWidth=0 - spacing(), lineMinHeight=0;
while( (item = it2.current()) != 0 ) {
- QSize itemSizeHint = item->sizeHint(); // we cache these ones because it can take
- QSize itemMinSize = item->minimumSize(); // a while to get them
- QSize s;
+ TQSize itemSizeHint = item->tqsizeHint(); // we cache these ones because it can take
+ TQSize itemMinSize = item->tqminimumSize(); // a while to get them
+ TQSize s;
if(m_justify) {
if(expandingWidgets != 0) {
- if(item->expanding() == QSizePolicy::Horizontally || item->expanding() == QSizePolicy::BothDirections)
- s = QSize( QMIN(itemSizeHint.width() + availableSpace / expandingWidgets
+ if(item->expandingDirections() == TQSizePolicy::Horizontally || item->expandingDirections() == TQSizePolicy::BothDirections)
+ s = TQSize( TQMIN(itemSizeHint.width() + availableSpace / expandingWidgets
, r.width()), itemSizeHint.height() );
else
- s = QSize( QMIN(itemSizeHint.width(), r.width()), itemSizeHint.height() );
+ s = TQSize( TQMIN(itemSizeHint.width(), r.width()), itemSizeHint.height() );
}
else
- s = QSize( QMIN(itemSizeHint.width() + availableSpace / (int)currentLine.count()
+ s = TQSize( TQMIN(itemSizeHint.width() + availableSpace / (int)currentLine.count()
, r.width()), itemSizeHint.height() );
}
else
- s = QSize ( QMIN(itemSizeHint.width(), r.width()), itemSizeHint.height() );
+ s = TQSize ( TQMIN(itemSizeHint.width(), r.width()), itemSizeHint.height() );
if(!testOnly)
- item->setGeometry( QRect(QPoint(wx, y), s) );
+ item->setGeometry( TQRect(TQPoint(wx, y), s) );
wx = wx + s.width() + spacing();
minSizeWidth = minSizeWidth + spacing() + itemMinSize.width();
- sizeHintWidth = sizeHintWidth + spacing() + itemSizeHint.width();
- lineMinHeight = QMAX( lineMinHeight, itemMinSize.height() );
+ tqsizeHintWidth = tqsizeHintWidth + spacing() + itemSizeHint.width();
+ lineMinHeight = TQMAX( lineMinHeight, itemMinSize.height() );
++it2;
}
- sizeHint = sizeHint.expandedTo( QSize(sizeHintWidth, y + spacing() + h) );
+ tqsizeHint = tqsizeHint.expandedTo( TQSize(tqsizeHintWidth, y + spacing() + h) );
minSizeHeight = minSizeHeight + spacing() + lineMinHeight;
- minSize = minSize.expandedTo( QSize(minSizeWidth, minSizeHeight) );
+ minSize = minSize.expandedTo( TQSize(minSizeWidth, minSizeHeight) );
- // store sizeHint() and minimumSize()
- m_cached_sizeHint = sizeHint + QSize(2* margin(), 2*margin());
- m_cached_minSize = minSize + QSize(2* margin() , 2*margin());
+ // store tqsizeHint() and tqminimumSize()
+ m_cached_tqsizeHint = tqsizeHint + TQSize(2* margin(), 2*margin());
+ m_cached_minSize = minSize + TQSize(2* margin() , 2*margin());
// return our height
return y + h - r.y();
}
int
-KexiFlowLayout::doVerticalLayout(const QRect &r, bool testOnly)
+KexiFlowLayout::doVerticalLayout(const TQRect &r, bool testOnly)
{
int x = r.x();
int y = r.y();
int w = 0; // width of this line
int availableSpace = r.height() + spacing();
- int expandingWidgets=0; // number of widgets in the line with QSizePolicy == Expanding
- QPtrListIterator<QLayoutItem> it(m_list);
- QPtrList<QLayoutItem> currentLine;
- QLayoutItem *o;
- QSize minSize, sizeHint(20, 20);
+ int expandingWidgets=0; // number of widgets in the line with TQSizePolicy == Expanding
+ TQPtrListIterator<TQLayoutItem> it(m_list);
+ TQPtrList<TQLayoutItem> currentLine;
+ TQLayoutItem *o;
+ TQSize minSize, tqsizeHint(20, 20);
int minSizeWidth = 0 - spacing();
while ( (o = it.current()) != 0 ) {
@@ -354,41 +360,41 @@ KexiFlowLayout::doVerticalLayout(const QRect &r, bool testOnly)
continue;
}
- QSize oSizeHint = o->sizeHint(); // we cache these ones because it can take a while to get it (eg for child layouts)
+ TQSize oSizeHint = o->tqsizeHint(); // we cache these ones because it can take a while to get it (eg for child tqlayouts)
if (y + oSizeHint.height() > r.bottom() && w > 0) {
- // do the layout of current line
- QPtrListIterator<QLayoutItem> it2(currentLine);
- QLayoutItem *item;
+ // do the tqlayout of current line
+ TQPtrListIterator<TQLayoutItem> it2(currentLine);
+ TQLayoutItem *item;
int wy = r.y();
- int sizeHintHeight = 0 - spacing(), minSizeHeight = 0 - spacing(), colMinWidth=0;
+ int tqsizeHintHeight = 0 - spacing(), minSizeHeight = 0 - spacing(), colMinWidth=0;
while( (item = it2.current()) != 0 ) {
- QSize itemSizeHint = item->sizeHint(); // we cache these ones because it can take
- QSize itemMinSize = item->minimumSize(); // a while to get them
- QSize s;
+ TQSize itemSizeHint = item->tqsizeHint(); // we cache these ones because it can take
+ TQSize itemMinSize = item->tqminimumSize(); // a while to get them
+ TQSize s;
if(m_justify) {
if(expandingWidgets != 0) {
- if(item->expanding() == QSizePolicy::Vertically || item->expanding() == QSizePolicy::BothDirections)
- s = QSize( itemSizeHint.width(), QMIN(itemSizeHint.height() + availableSpace / expandingWidgets
+ if(item->expandingDirections() == TQSizePolicy::Vertically || item->expandingDirections() == TQSizePolicy::BothDirections)
+ s = TQSize( itemSizeHint.width(), TQMIN(itemSizeHint.height() + availableSpace / expandingWidgets
, r.height()) );
else
- s = QSize( itemSizeHint.width(), QMIN(itemSizeHint.height(), r.height()) );
+ s = TQSize( itemSizeHint.width(), TQMIN(itemSizeHint.height(), r.height()) );
}
else
- s = QSize( itemSizeHint.width(), QMIN(itemSizeHint.height() + availableSpace / (int)currentLine.count()
+ s = TQSize( itemSizeHint.width(), TQMIN(itemSizeHint.height() + availableSpace / (int)currentLine.count()
, r.height()) );
}
else
- s = QSize ( itemSizeHint.width(), QMIN(itemSizeHint.height(), r.height()) );
+ s = TQSize ( itemSizeHint.width(), TQMIN(itemSizeHint.height(), r.height()) );
if(!testOnly)
- item->setGeometry( QRect(QPoint(x, wy), s) );
+ item->setGeometry( TQRect(TQPoint(x, wy), s) );
wy = wy + s.height() + spacing();
minSizeHeight = minSizeHeight + spacing() + itemMinSize.height();
- sizeHintHeight = sizeHintHeight + spacing() + itemSizeHint.height();
- colMinWidth = QMAX( colMinWidth, itemMinSize.width() );
+ tqsizeHintHeight = tqsizeHintHeight + spacing() + itemSizeHint.height();
+ colMinWidth = TQMAX( colMinWidth, itemMinSize.width() );
++it2;
}
- sizeHint = sizeHint.expandedTo( QSize(0, sizeHintHeight) );
- minSize = minSize.expandedTo( QSize(0, minSizeHeight) );
+ tqsizeHint = tqsizeHint.expandedTo( TQSize(0, tqsizeHintHeight) );
+ minSize = minSize.expandedTo( TQSize(0, minSizeHeight) );
minSizeWidth = minSizeWidth + spacing() + colMinWidth;
// start a new column
x = x + spacing() + w;
@@ -400,53 +406,82 @@ KexiFlowLayout::doVerticalLayout(const QRect &r, bool testOnly)
}
y = y + spacing() + oSizeHint.height();
- w = QMAX( w, oSizeHint.width() );
+ w = TQMAX( w, oSizeHint.width() );
currentLine.append(o);
- if(o->expanding() == QSizePolicy::Vertically || o->expanding() == QSizePolicy::BothDirections)
+ if(o->expandingDirections() == TQSizePolicy::Vertically || o->expandingDirections() == TQSizePolicy::BothDirections)
++expandingWidgets;
- availableSpace = QMAX(0, availableSpace - spacing() - oSizeHint.height());
+ availableSpace = TQMAX(0, availableSpace - spacing() - oSizeHint.height());
++it;
}
- // don't forget to layout the last line
- QPtrListIterator<QLayoutItem> it2(currentLine);
- QLayoutItem *item;
+ // don't forget to tqlayout the last line
+ TQPtrListIterator<TQLayoutItem> it2(currentLine);
+ TQLayoutItem *item;
int wy = r.y();
- int sizeHintHeight = 0 - spacing(), minSizeHeight = 0 - spacing(), colMinWidth=0;
+ int tqsizeHintHeight = 0 - spacing(), minSizeHeight = 0 - spacing(), colMinWidth=0;
while( (item = it2.current()) != 0 ) {
- QSize itemSizeHint = item->sizeHint(); // we cache these ones because it can take
- QSize itemMinSize = item->minimumSize(); // a while to get them
- QSize s;
+ TQSize itemSizeHint = item->tqsizeHint(); // we cache these ones because it can take
+ TQSize itemMinSize = item->tqminimumSize(); // a while to get them
+ TQSize s;
if(m_justify) {
if(expandingWidgets != 0) {
- if(item->expanding() == QSizePolicy::Vertically || item->expanding() == QSizePolicy::BothDirections)
- s = QSize( itemSizeHint.width(), QMIN(itemSizeHint.height() + availableSpace / expandingWidgets
+ if(item->expandingDirections() == TQSizePolicy::Vertically || item->expandingDirections() == TQSizePolicy::BothDirections)
+ s = TQSize( itemSizeHint.width(), TQMIN(itemSizeHint.height() + availableSpace / expandingWidgets
, r.height()) );
else
- s = QSize( itemSizeHint.width(), QMIN(itemSizeHint.height(), r.height()) );
+ s = TQSize( itemSizeHint.width(), TQMIN(itemSizeHint.height(), r.height()) );
}
else
- s = QSize( itemSizeHint.width(), QMIN(itemSizeHint.height() + availableSpace / (int)currentLine.count()
+ s = TQSize( itemSizeHint.width(), TQMIN(itemSizeHint.height() + availableSpace / (int)currentLine.count()
, r.height()) );
}
else
- s = QSize ( itemSizeHint.width(), QMIN(itemSizeHint.height(), r.height()) );
+ s = TQSize ( itemSizeHint.width(), TQMIN(itemSizeHint.height(), r.height()) );
if(!testOnly)
- item->setGeometry( QRect(QPoint(x, wy), s) );
+ item->setGeometry( TQRect(TQPoint(x, wy), s) );
wy = wy + s.height() + spacing();
minSizeHeight = minSizeHeight + spacing() + itemMinSize.height();
- sizeHintHeight = sizeHintHeight + spacing() + itemSizeHint.height();
- colMinWidth = QMAX( colMinWidth, itemMinSize.width() );
+ tqsizeHintHeight = tqsizeHintHeight + spacing() + itemSizeHint.height();
+ colMinWidth = TQMAX( colMinWidth, itemMinSize.width() );
++it2;
}
- sizeHint = sizeHint.expandedTo( QSize( x + spacing() + w, sizeHintHeight) );
+ tqsizeHint = tqsizeHint.expandedTo( TQSize( x + spacing() + w, tqsizeHintHeight) );
minSizeWidth = minSizeWidth + spacing() + colMinWidth;
- minSize = minSize.expandedTo( QSize(minSizeWidth, minSizeHeight) );
+ minSize = minSize.expandedTo( TQSize(minSizeWidth, minSizeHeight) );
- // store sizeHint() and minimumSize()
- m_cached_sizeHint = sizeHint + QSize(2* margin(), 2*margin());
- m_cached_minSize = minSize + QSize(2* margin(), 2*margin());
+ // store tqsizeHint() and tqminimumSize()
+ m_cached_tqsizeHint = tqsizeHint + TQSize(2* margin(), 2*margin());
+ m_cached_minSize = minSize + TQSize(2* margin(), 2*margin());
// return our width
return x + w - r.x();
}
+#ifdef USE_QT4
+/*!
+ \reimp
+*/
+int KexiFlowLayout::count() const {
+ return m_list.count();
+}
+
+/*!
+ \reimp
+*/
+TQLayoutItem* KexiFlowLayout::itemAt(int index) const {
+ return index >= 0 && index < m_list.count() ? (const_cast<TQPtrList<TQLayoutItem>&>(m_list).tqat(index)) : 0;
+}
+
+/*!
+ \reimp
+*/
+TQLayoutItem* KexiFlowLayout::takeAt(int index) {
+ if (index < 0 || index >= m_list.count())
+ return 0;
+ TQLayoutItem *item = m_list.tqat(index);
+ m_list.remove(m_list.tqat(index));
+ delete item;
+
+ invalidate();
+ return item;
+}
+#endif // USE_QT4 \ No newline at end of file