summaryrefslogtreecommitdiffabout
path: root/microkde/KDGanttMinimizeSplitter.cpp
Side-by-side diff
Diffstat (limited to 'microkde/KDGanttMinimizeSplitter.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/KDGanttMinimizeSplitter.cpp194
1 files changed, 103 insertions, 91 deletions
diff --git a/microkde/KDGanttMinimizeSplitter.cpp b/microkde/KDGanttMinimizeSplitter.cpp
index 72c4e60..4172cd0 100644
--- a/microkde/KDGanttMinimizeSplitter.cpp
+++ b/microkde/KDGanttMinimizeSplitter.cpp
@@ -35,57 +35,67 @@
#ifndef QT_NO_SPLITTER___
#include "qpainter.h"
#include "qdrawutil.h"
#include "qbitmap.h"
#if QT_VERSION >= 0x030000
-#include "qptrlist.h"
-#include "qmemarray.h"
+#include "q3ptrlist.h"
+#include "q3memarray.h"
#else
#include <qlist.h>
#include <qarray.h>
-#define QPtrList QList
-#define QMemArray QArray
+#define Q3PtrList QList
+#define Q3MemArray QArray
#endif
#include "qlayoutengine_p.h"
-#include "qobjectlist.h"
+#include "qobject.h"
#include "qstyle.h"
#include "qapplication.h" //sendPostedEvents
-#include <qvaluelist.h>
+#include <q3valuelist.h>
#include <qcursor.h>
-#include <qframe.h>
+#include <q3frame.h>
+#include <QDesktopWidget>
+//Added by qt3to4:
+#include <Q3PointArray>
+#include <QPixmap>
+#include <QResizeEvent>
+#include <QMouseEvent>
+#include <QChildEvent>
+#include <QEvent>
+#include <QPaintEvent>
#ifndef KDGANTT_MASTER_CVS
//#include "KDGanttMinimizeSplitter.moc"
#endif
#ifndef DOXYGEN_SKIP_INTERNAL
#if QT_VERSION >= 232
static int mouseOffset;
static int opaqueOldPos = -1; //### there's only one mouse, but this is a bit risky
-class KDRubberBand: public QFrame
+class KDRubberBand: public Q3Frame
{
public:
- KDRubberBand( QWidget *parent, const char * name, WFlags f ) :QFrame ( parent, name, f ) {;}
+ KDRubberBand( QWidget *parent, const char * name, Qt::WFlags f ) :Q3Frame ( parent, name, f ) {;}
protected:
virtual void mousePressEvent ( QMouseEvent * )
{
close();
};
};
KDGanttSplitterHandle::KDGanttSplitterHandle( Qt::Orientation o,
KDGanttMinimizeSplitter *parent, const char * name )
- : QWidget( parent, name ), _activeButton( 0 ), _collapsed( false )
+ : _activeButton( 0 ), _collapsed( false )
{
-
+ setObjectName(name);
+ setParent(parent);
if ( QApplication::desktop()->width() > 320 && QApplication::desktop()->width() < 650 ) {
mSizeHint = QSize(7,7);
mUseOffset = true;
} else {
mSizeHint = QSize(6,6);
mUseOffset = false;
@@ -103,24 +113,24 @@ QSize KDGanttSplitterHandle::sizeHint() const
}
void KDGanttSplitterHandle::setOrientation( Qt::Orientation o )
{
orient = o;
#ifndef QT_NO_CURSOR
- if ( o == KDGanttMinimizeSplitter::Horizontal )
- setCursor( splitHCursor );
+ if ( o == Qt::Horizontal )
+ setCursor( Qt::splitHCursor );
else
- setCursor( splitVCursor );
+ setCursor( Qt::splitVCursor );
#endif
}
void KDGanttSplitterHandle::mouseMoveEvent( QMouseEvent *e )
{
updateCursor( e->pos() );
- if ( !(e->state()&LeftButton) )
+ if ( !(e->state()&Qt::LeftButton) )
return;
if ( _activeButton != 0)
return;
QCOORD pos = s->pick(parentWidget()->mapFromGlobal(e->globalPos()))
@@ -134,31 +144,31 @@ void KDGanttSplitterHandle::mouseMoveEvent( QMouseEvent *e )
}
_collapsed = false;
}
void KDGanttSplitterHandle::mousePressEvent( QMouseEvent *e )
{
- if ( e->button() == LeftButton ) {
+ if ( e->button() == Qt::LeftButton ) {
_activeButton = onButton( e->pos() );
mouseOffset = s->pick(e->pos());
mMouseDown = true;
repaint();
updateCursor( e->pos() );
}
}
void KDGanttSplitterHandle::updateCursor( const QPoint& p)
{
if ( onButton( p ) != 0 ) {
- setCursor( arrowCursor );
+ setCursor( Qt::arrowCursor );
}
else {
- if ( orient == KDGanttMinimizeSplitter::Horizontal )
- setCursor( splitHCursor );
+ if ( orient == Qt::Horizontal )
+ setCursor( Qt::splitHCursor );
else
- setCursor( splitVCursor );
+ setCursor( Qt::splitVCursor );
}
}
void KDGanttSplitterHandle::toggle()
{
int pos;
int min, max;
@@ -192,13 +202,13 @@ void KDGanttSplitterHandle::mouseReleaseEvent( QMouseEvent *e )
toggle();
}
_activeButton = 0;
updateCursor( e->pos() );
}
else {
- if ( !opaque() && e->button() == LeftButton ) {
+ if ( !opaque() && e->button() == Qt::LeftButton ) {
QCOORD pos = s->pick(parentWidget()->mapFromGlobal(e->globalPos()))
- mouseOffset;
s->setRubberband( -1 );
s->moveSplitter( pos, id() );
}
}
@@ -208,16 +218,16 @@ void KDGanttSplitterHandle::mouseReleaseEvent( QMouseEvent *e )
}
repaint();
}
int KDGanttSplitterHandle::onButton( const QPoint& p )
{
- QValueList<QPointArray> list = buttonRegions();
+ Q3ValueList<Q3PointArray> list = buttonRegions();
int index = 1;
int add = 12;
- for( QValueList<QPointArray>::Iterator it = list.begin(); it != list.end(); ++it ) {
+ for( Q3ValueList<Q3PointArray>::Iterator it = list.begin(); it != list.end(); ++it ) {
QRect rect = (*it).boundingRect();
rect.setLeft( rect.left()- add );
rect.setRight( rect.right() + add);
rect.setTop( rect.top()- add );
rect.setBottom( rect.bottom() + add);
if ( rect.contains( p ) ) {
@@ -226,22 +236,22 @@ int KDGanttSplitterHandle::onButton( const QPoint& p )
index++;
}
return 0;
}
-QValueList<QPointArray> KDGanttSplitterHandle::buttonRegions()
+Q3ValueList<Q3PointArray> KDGanttSplitterHandle::buttonRegions()
{
- QValueList<QPointArray> list;
+ Q3ValueList<Q3PointArray> list;
int sw = 8;
int yyy = 1;
int xxx = 1;
int voffset[] = { (int) -sw*3, (int) sw*3 };
for ( int i = 0; i < 2; i++ ) {
- QPointArray arr;
+ Q3PointArray arr;
if ( !_collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Right ||
_collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Left) {
int mid = height()/2 + voffset[i];
arr.setPoints( 3,
1-xxx, mid - sw + 4,
sw-3-xxx, mid,
@@ -308,17 +318,17 @@ void KDGanttSplitterHandle::paintEvent( QPaintEvent * )
col = colorGroup().background().dark( 150 );
}
//QColor col = backgroundColor().dark( 130 );
p.setBrush( col );
p.setPen( col );
- QValueList<QPointArray> list = buttonRegions();
+ Q3ValueList<Q3PointArray> list = buttonRegions();
int index = 1;
if ( mUseOffset )
p.translate( 0, 1 );
- for ( QValueList<QPointArray>::Iterator it = list.begin(); it != list.end(); ++it ) {
+ for ( Q3ValueList<Q3PointArray>::Iterator it = list.begin(); it != list.end(); ++it ) {
if ( index == _activeButton ) {
/*
if ( ! _collapsed ) {
p.save();
// p.translate( parentWidget()->style().pixelMetric( QStyle::PM_ButtonShiftHorizontal ),
@@ -374,18 +384,18 @@ public:
class QSplitterData
{
public:
QSplitterData() : opaque( FALSE ), firstShow( TRUE ) {}
- QPtrList<QSplitterLayoutStruct> list;
+ Q3PtrList<QSplitterLayoutStruct> list;
bool opaque;
bool firstShow;
};
-void kdganttGeomCalc( QMemArray<QLayoutStruct> &chain, int start, int count, int pos,
+void kdganttGeomCalc( Q3MemArray<QLayoutStruct> &chain, int start, int count, int pos,
int space, int spacer );
#endif // DOXYGEN_SKIP_INTERNAL
/*!
\class KDGanttMinimizeSplitter KDGanttMinimizeSplitter.h
@@ -458,30 +468,31 @@ static QSize minSizeHint( const QWidget* w )
/*!
Constructs a horizontal splitter with the \a parent and \a
name arguments being passed on to the QFrame constructor.
*/
KDGanttMinimizeSplitter::KDGanttMinimizeSplitter( QWidget *parent, const char *name )
- :QFrame(parent,name,WPaintUnclipped)
+ :Q3Frame(parent,name)
{
+ setAttribute(Qt::WA_PaintUnclipped);
mRubberBand = 0;
mFirstHandle = 0;
#if QT_VERSION >= 232
- orient = Horizontal;
+ orient = Qt::Horizontal;
init();
#endif
}
/*!
Constructs a splitter with orientation \a o with the \a parent
and \a name arguments being passed on to the QFrame constructor.
*/
-KDGanttMinimizeSplitter::KDGanttMinimizeSplitter( Orientation o, QWidget *parent, const char *name )
- :QFrame(parent,name,WPaintUnclipped)
+KDGanttMinimizeSplitter::KDGanttMinimizeSplitter( Qt::Orientation o, QWidget *parent, const char *name )
+ :Q3Frame(parent,name)
{
-
+ setAttribute(Qt::WA_PaintUnclipped);
mRubberBand = 0;
mFirstHandle = 0;
#if QT_VERSION >= 232
orient = o;
init();
#endif
@@ -502,13 +513,13 @@ KDGanttMinimizeSplitter::~KDGanttMinimizeSplitter()
#if QT_VERSION >= 232
void KDGanttMinimizeSplitter::init()
{
data = new QSplitterData;
- if ( orient == Horizontal )
+ if ( orient == Qt::Horizontal )
setSizePolicy( QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Minimum) );
else
setSizePolicy( QSizePolicy(QSizePolicy::Minimum,QSizePolicy::Expanding) );
#ifndef DESKTOP_VERSION
setOpaqueResize( false );
#else
@@ -531,20 +542,20 @@ void KDGanttMinimizeSplitter::toggle()
/*!
\brief the orientation of the splitter
By default the orientation is horizontal (the widgets are side by side).
The possible orientations are Qt:Vertical and Qt::Horizontal (the default).
*/
-void KDGanttMinimizeSplitter::setOrientation( Orientation o )
+void KDGanttMinimizeSplitter::setOrientation( Qt::Orientation o )
{
#if QT_VERSION >= 232
if ( orient == o )
return;
orient = o;
- if ( orient == Horizontal )
+ if ( orient == Qt::Horizontal )
setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) );
else
setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Expanding ) );
QSplitterLayoutStruct *s = data->list.first();
while ( s ) {
@@ -583,27 +594,27 @@ QSplitterLayoutStruct *KDGanttMinimizeSplitter::addWidget( QWidget *w, bool firs
if ( data->list.count() > 0 ) {
s = new QSplitterLayoutStruct;
s->mode = KeepSize;
QString tmp = "qt_splithandle_";
tmp += w->name();
newHandle = new KDGanttSplitterHandle( orientation(), this, tmp.latin1() );
- if ( ! mFirstHandle )
- mFirstHandle = newHandle;
+ if ( ! mFirstHandle )
+ mFirstHandle = newHandle;
s->wid = newHandle;
newHandle->setId(data->list.count());
s->isSplitter = TRUE;
s->sizer = pick( newHandle->sizeHint() );
if ( first )
data->list.insert( 0, s );
else
data->list.append( s );
}
s = new QSplitterLayoutStruct;
s->mode = Stretch;
s->wid = w;
- if ( !testWState( WState_Resized ) && w->sizeHint().isValid() )
+ if ( !testAttribute( Qt::WA_Resized ) && w->sizeHint().isValid() )
s->sizer = pick( w->sizeHint() );
else
s->sizer = pick( w->size() );
s->isSplitter = FALSE;
if ( first )
data->list.insert( 0, s );
@@ -618,26 +629,32 @@ QSplitterLayoutStruct *KDGanttMinimizeSplitter::addWidget( QWidget *w, bool firs
/*!
Tells the splitter that a child widget has been inserted or removed.
The event is passed in \a c.
*/
void KDGanttMinimizeSplitter::childEvent( QChildEvent *c )
{
- if ( c->type() == QEvent::ChildInserted ) {
+ if ( c->type() == QEvent::ChildAdded ) {
if ( !c->child()->isWidgetType() )
return;
- if ( ((QWidget*)c->child())->testWFlags( WType_TopLevel ) )
+ QWidget *cw = (QWidget*)c->child();
+
+ if ( (cw->windowFlags())&Qt::Window )
+ return;
+
+ // avoid infinite recursion
+ if(cw->objectName().startsWith("qt_splithandle_"))
return;
QSplitterLayoutStruct *s = data->list.first();
while ( s ) {
- if ( s->wid == c->child() )
+ if ( s->wid == cw )
return;
s = data->list.next();
}
- addWidget( (QWidget*)c->child() );
+ addWidget( cw );
recalc( isVisible() );
} else if ( c->type() == QEvent::ChildRemoved ) {
QSplitterLayoutStruct *p = 0;
if ( data->list.count() > 1 )
p = data->list.at(1); //remove handle _after_ first widget.
@@ -667,23 +684,23 @@ void KDGanttMinimizeSplitter::childEvent( QChildEvent *c )
rubber band is removed.
*/
void KDGanttMinimizeSplitter::setRubberband( int p )
{
#ifdef DESKTOP_VERSION
QPainter paint( this );
- paint.setPen( gray );
- paint.setBrush( gray );
- paint.setRasterOp( XorROP );
+ paint.setPen( Qt::gray );
+ paint.setBrush( Qt::gray );
+ paint.setCompositionMode( QPainter::CompositionMode_Xor );
QRect r = contentsRect();
const int rBord = 3; //Themable????
#if QT_VERSION >= 0x030000
- int sw = style().pixelMetric(QStyle::PM_SplitterWidth, this);
+ int sw = style()->pixelMetric(QStyle::PM_SplitterWidth, 0, this);
#else
int sw = style().splitterWidth();
#endif
- if ( orient == Horizontal ) {
+ if ( orient == Qt::Horizontal ) {
if ( opaqueOldPos >= 0 )
paint.drawRect( opaqueOldPos + sw/2 - rBord , r.y(),
2*rBord, r.height() );
if ( p >= 0 )
paint.drawRect( p + sw/2 - rBord, r.y(), 2*rBord, r.height() );
} else {
@@ -693,13 +710,13 @@ void KDGanttMinimizeSplitter::setRubberband( int p )
if ( p >= 0 )
paint.drawRect( r.x(), p + sw/2 - rBord, r.width(), 2*rBord );
}
opaqueOldPos = p;
#else
if ( !mRubberBand ) {
- mRubberBand = new KDRubberBand( 0, "rubber", WStyle_NoBorder | WStyle_Customize | WStyle_StaysOnTop);
+ mRubberBand = new KDRubberBand( 0, "rubber", Qt::WStyle_NoBorder | Qt::WStyle_Customize | Qt::WStyle_StaysOnTop);
mRubberBand->setFrameStyle( Box | Raised );
//mRubberBand->setPalette( QPalette ( Qt::red.light(),Qt::red.dark() ) );
mRubberBand->setPalette( QPalette ( colorGroup().background().light(), colorGroup().background().dark() ));
}
QRect r = contentsRect();
static int rBord = 0; //Themable????
@@ -707,13 +724,13 @@ void KDGanttMinimizeSplitter::setRubberband( int p )
if (QApplication::desktop()->width() <= 320 )
rBord = 3;
else
rBord = 4;
}
int sw = style().splitterWidth();
- if ( orient == Horizontal ) {
+ if ( orient == Qt::Horizontal ) {
if ( p >= 0 ) {
QPoint geo = mapToGlobal (QPoint ( p + sw/2 - rBord, r.y()));
mRubberBand->setGeometry( geo.x(), geo.y(), 2*rBord, r.height() );
}
} else {
if ( p >= 0 ) {
@@ -729,13 +746,13 @@ void KDGanttMinimizeSplitter::setRubberband( int p )
}
/*! \reimp */
bool KDGanttMinimizeSplitter::event( QEvent *e )
{
- if ( e->type() == QEvent::LayoutHint || ( e->type() == QEvent::Show && data->firstShow ) ) {
+ if ( e->type() == QEvent::LayoutRequest || ( e->type() == QEvent::Show && data->firstShow ) ) {
recalc( isVisible() );
if ( e->type() == QEvent::Show )
data->firstShow = FALSE;
}
return QWidget::event( e );
}
@@ -752,13 +769,13 @@ void KDGanttMinimizeSplitter::drawSplitter( QPainter *p,
QCOORD x, QCOORD y, QCOORD w, QCOORD h )
{
#if 0
// LR
style().drawPrimitive(QStyle::PE_Splitter, p, QRect(x, y, w, h), colorGroup(),
(orientation() == Qt::Horizontal ?
- QStyle::Style_Horizontal : 0));
+ QStyle::State_Horizontal : 0));
#endif
}
/*!
Returns the id of the splitter to the right of or below the widget \a w,
@@ -793,15 +810,15 @@ int KDGanttMinimizeSplitter::idAfter( QWidget* w ) const
\sa idAfter()
*/
void KDGanttMinimizeSplitter::moveSplitter( QCOORD p, int id )
{
p = adjustPos( p, id );
QSplitterLayoutStruct *s = data->list.at(id);
- int oldP = orient == Horizontal ? s->wid->x() : s->wid->y();
+ int oldP = orient == Qt::Horizontal ? s->wid->x() : s->wid->y();
bool upLeft;
- if ( false && orient == Horizontal ) {
+ if ( false && orient == Qt::Horizontal ) {
p += s->wid->width();
upLeft = p > oldP;
} else
upLeft = p < oldP;
moveAfter( p, id, upLeft );
@@ -810,14 +827,14 @@ void KDGanttMinimizeSplitter::moveSplitter( QCOORD p, int id )
storeSizes();
}
void KDGanttMinimizeSplitter::setG( QWidget *w, int p, int s, bool isSplitter )
{
- if ( orient == Horizontal ) {
- if ( false && orient == Horizontal && !isSplitter )
+ if ( orient == Qt::Horizontal ) {
+ if ( false && orient == Qt::Horizontal && !isSplitter )
p = contentsRect().width() - p - s;
w->setGeometry( p, contentsRect().y(), s, contentsRect().height() );
} else
w->setGeometry( contentsRect().x(), p, contentsRect().width(), s );
}
@@ -837,13 +854,13 @@ void KDGanttMinimizeSplitter::moveBefore( int pos, int id, bool upLeft )
QWidget *w = s->wid;
if ( w->isHidden() ) {
moveBefore( pos, id-1, upLeft );
} else if ( s->isSplitter ) {
int pos1, pos2;
int dd = s->sizer;
- if( false && orient == Horizontal ) {
+ if( false && orient == Qt::Horizontal ) {
pos1 = pos;
pos2 = pos + dd;
} else {
pos2 = pos - dd;
pos1 = pos2 + 1;
}
@@ -853,13 +870,13 @@ void KDGanttMinimizeSplitter::moveBefore( int pos, int id, bool upLeft )
} else {
moveBefore( pos2, id-1, upLeft );
setG( w, pos1, dd, TRUE );
}
} else {
int dd, newLeft, nextPos;
- if( false && orient == Horizontal ) {
+ if( false && orient == Qt::Horizontal ) {
dd = w->geometry().right() - pos;
dd = QMAX( pick(minSize(w)), QMIN(dd, pick(w->maximumSize())));
newLeft = pos+1;
nextPos = newLeft + dd;
} else {
dd = pos - pick( w->pos() ) + 1;
@@ -890,13 +907,13 @@ void KDGanttMinimizeSplitter::moveAfter( int pos, int id, bool upLeft )
} else if ( pick( w->pos() ) == pos ) {
//No need to do anything if it's already there.
return;
} else if ( s->isSplitter ) {
int dd = s->sizer;
int pos1, pos2;
- if( false && orient == Horizontal ) {
+ if( false && orient == Qt::Horizontal ) {
pos2 = pos - dd;
pos1 = pos2 + 1;
} else {
pos1 = pos;
pos2 = pos + dd;
}
@@ -907,13 +924,13 @@ void KDGanttMinimizeSplitter::moveAfter( int pos, int id, bool upLeft )
moveAfter( pos2, id+1, upLeft );
setG( w, pos1, dd, TRUE );
}
} else {
int left = pick( w->pos() );
int right, dd,/* newRight,*/ newLeft, nextPos;
- if ( false && orient == Horizontal ) {
+ if ( false && orient == Qt::Horizontal ) {
dd = pos - left + 1;
dd = QMAX( pick(minSize(w)), QMIN(dd, pick(w->maximumSize())));
newLeft = pos-dd+1;
nextPos = newLeft - 1;
} else {
right = pick( w->geometry().bottomRight() );
@@ -985,15 +1002,15 @@ void KDGanttMinimizeSplitter::getRange( int id, int *min, int *max )
} else {
minA += pick( minSize(s->wid) );
maxA += pick( s->wid->maximumSize() );
}
}
QRect r = contentsRect();
- if ( orient == Horizontal && false ) {
+ if ( orient == Qt::Horizontal && false ) {
#if QT_VERSION >= 0x030000
- int splitterWidth = style().pixelMetric(QStyle::PM_SplitterWidth, this);
+ int splitterWidth = style()->pixelMetric(QStyle::PM_SplitterWidth, 0,this);
#else
int splitterWidth = style().splitterWidth();
#endif
if ( min )
*min = pick(r.topRight()) - QMIN( maxB, pick(r.size())-minA ) - splitterWidth;
@@ -1027,13 +1044,13 @@ int KDGanttMinimizeSplitter::adjustPos( int p, int id )
void KDGanttMinimizeSplitter::doResize()
{
QRect r = contentsRect();
int i;
int n = data->list.count();
- QMemArray<QLayoutStruct> a( n );
+ Q3MemArray<QLayoutStruct> a( n );
for ( i = 0; i< n; i++ ) {
a[i].init();
QSplitterLayoutStruct *s = data->list.at(i);
if ( s->wid->isHidden() ) {
a[i].stretch = 0;
a[i].sizeHint = a[i].minimumSize = 0;
@@ -1129,13 +1146,13 @@ void KDGanttMinimizeSplitter::recalc( bool update )
} else {
maxl = QMIN( maxl, QWIDGETSIZE_MAX );
}
if ( maxt < mint )
maxt = mint;
- if ( orient == Horizontal ) {
+ if ( orient == Qt::Horizontal ) {
setMaximumSize( maxl, maxt );
setMinimumSize( minl, mint );
} else {
setMaximumSize( maxt, maxl );
setMinimumSize( mint, minl );
}
@@ -1264,60 +1281,54 @@ void KDGanttMinimizeSplitter::recalcId()
*/
QSize KDGanttMinimizeSplitter::sizeHint() const
{
constPolish();
int l = 0;
int t = 0;
- if ( children() ) {
- const QObjectList * c = children();
- QObjectListIt it( *c );
- QObject * o;
-
- while( (o=it.current()) != 0 ) {
- ++it;
+ if ( !children().empty() ) {
+ const QObjectList c = children();
+ for(QObjectList::const_iterator i=c.begin();i!=c.end();++i) {
+ QObject * o = *i;
if ( o->isWidgetType() &&
!((QWidget*)o)->isHidden() ) {
QSize s = ((QWidget*)o)->sizeHint();
if ( s.isValid() ) {
l += pick( s );
t = QMAX( t, trans( s ) );
}
}
}
}
- return orientation() == Horizontal ? QSize( l, t ) : QSize( t, l );
+ return orientation() == Qt::Horizontal ? QSize( l, t ) : QSize( t, l );
}
/*!
\reimp
*/
QSize KDGanttMinimizeSplitter::minimumSizeHint() const
{
constPolish();
int l = 0;
int t = 0;
- if ( children() ) {
- const QObjectList * c = children();
- QObjectListIt it( *c );
- QObject * o;
-
- while( (o=it.current()) != 0 ) {
- ++it;
+ if ( !children().empty() ) {
+ const QObjectList c = children();
+ for(QObjectList::const_iterator i=c.begin();i!=c.end();++i) {
+ QObject * o = *i;
if ( o->isWidgetType() &&
!((QWidget*)o)->isHidden() ) {
QSize s = minSizeHint((QWidget*)o);
if ( s.isValid() ) {
l += pick( s );
t = QMAX( t, trans( s ) );
}
}
}
}
- return orientation() == Horizontal ? QSize( l, t ) : QSize( t, l );
+ return orientation() == Qt::Horizontal ? QSize( l, t ) : QSize( t, l );
}
/*
Calculates stretch parameters from current sizes
*/
@@ -1399,19 +1410,20 @@ bool KDGanttMinimizeSplitter::isHidden( QWidget *w ) const
}
\endcode
\sa setSizes()
*/
-QValueList<int> KDGanttMinimizeSplitter::sizes() const
+Q3ValueList<int> KDGanttMinimizeSplitter::sizes() const
{
+ /* TODO: hacker
if ( !testWState(WState_Polished) ) {
QWidget* that = (QWidget*) this;
that->polish();
- }
- QValueList<int> list;
+ } */
+ Q3ValueList<int> list;
QSplitterLayoutStruct *s = data->list.first();
while ( s ) {
if ( !s->isSplitter )
list.append( s->sizer );
s = data->list.next();
}
@@ -1430,16 +1442,16 @@ QValueList<int> KDGanttMinimizeSplitter::sizes() const
If \a list contains too few values, the result is undefined
but the program will still be well-behaved.
\sa sizes()
*/
-void KDGanttMinimizeSplitter::setSizes( QValueList<int> list )
+void KDGanttMinimizeSplitter::setSizes( Q3ValueList<int> list )
{
processChildEvents();
- QValueList<int>::Iterator it = list.begin();
+ Q3ValueList<int>::Iterator it = list.begin();
QSplitterLayoutStruct *s = data->list.first();
while ( s && it != list.end() ) {
if ( !s->isSplitter ) {
s->sizer = *it;
++it;
}
@@ -1453,36 +1465,36 @@ void KDGanttMinimizeSplitter::setSizes( QValueList<int> list )
Gets all posted child events, ensuring that the internal state of
the splitter is consistent.
*/
void KDGanttMinimizeSplitter::processChildEvents()
{
- QApplication::sendPostedEvents( this, QEvent::ChildInserted );
+ QApplication::sendPostedEvents( this, QEvent::ChildAdded );
}
/*!
\reimp
*/
void KDGanttMinimizeSplitter::styleChange( QStyle& old )
{
#if QT_VERSION >= 0x030000
- int sw = style().pixelMetric(QStyle::PM_SplitterWidth, this);
+ int sw = style()->pixelMetric(QStyle::PM_SplitterWidth, 0, this);
#else
int sw = style().splitterWidth();
#endif
QSplitterLayoutStruct *s = data->list.first();
while ( s ) {
if ( s->isSplitter )
s->sizer = sw;
s = data->list.next();
}
doResize();
- QFrame::styleChange( old );
+ Q3Frame::styleChange( old );
}
#endif
/*!
Specifies the direction of the minimize buttons.
@@ -1509,13 +1521,13 @@ KDGanttMinimizeSplitter::Direction KDGanttMinimizeSplitter::minimizeDirection()
unfortunately isn't exported.
*/
static inline int toFixed( int i ) { return i * 256; }
static inline int fRound( int i ) {
return ( i % 256 < 128 ) ? i / 256 : 1 + i / 256;
}
-void kdganttGeomCalc( QMemArray<QLayoutStruct> &chain, int start, int count, int pos,
+void kdganttGeomCalc( Q3MemArray<QLayoutStruct> &chain, int start, int count, int pos,
int space, int spacer )
{
typedef int fixed;
int cHint = 0;
int cMin = 0;
int cMax = 0;