diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-16 19:02:47 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-16 19:02:47 +0000 |
commit | e985f7e545f4739493965aad69bbecb136dc9346 (patch) | |
tree | 54afd409d8acd6202dd8ab611d24e78c28e4c0a0 /lib/compatibility/kmdi/qextmdi/kdockwidget_private.cpp | |
parent | f7670c198945adc3b95ad69a959fe5f8ae55b493 (diff) | |
download | tdewebdev-e985f7e545f4739493965aad69bbecb136dc9346.tar.gz tdewebdev-e985f7e545f4739493965aad69bbecb136dc9346.zip |
TQt4 port kdewebdev
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdewebdev@1237029 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'lib/compatibility/kmdi/qextmdi/kdockwidget_private.cpp')
-rw-r--r-- | lib/compatibility/kmdi/qextmdi/kdockwidget_private.cpp | 150 |
1 files changed, 75 insertions, 75 deletions
diff --git a/lib/compatibility/kmdi/qextmdi/kdockwidget_private.cpp b/lib/compatibility/kmdi/qextmdi/kdockwidget_private.cpp index 4106d101..f428783a 100644 --- a/lib/compatibility/kmdi/qextmdi/kdockwidget_private.cpp +++ b/lib/compatibility/kmdi/qextmdi/kdockwidget_private.cpp @@ -26,8 +26,8 @@ #include <tqtimer.h> #include <tqapplication.h> -KDockSplitter::KDockSplitter(TQWidget *parent, const char *name, Orientation orient, int pos, bool highResolution) -: TQWidget(parent, name) +KDockSplitter::KDockSplitter(TQWidget *tqparent, const char *name, Qt::Orientation orient, int pos, bool highResolution) +: TQWidget(tqparent, name) { m_dontRecalc=false; divider = 0L; @@ -59,7 +59,7 @@ void KDockSplitter::activate(TQWidget *c0, TQWidget *c1) divider->setLineWidth(1); divider->raise(); - if (m_orientation == Horizontal) + if (m_orientation ==Qt::Horizontal) divider->setCursor(TQCursor(sizeVerCursor)); else divider->setCursor(TQCursor(sizeHorCursor)); @@ -179,21 +179,21 @@ void KDockSplitter::setupMinMaxSize() { // Set the minimum and maximum sizes int minx, maxx, miny, maxy; - if (m_orientation == Horizontal) { - miny = child0->minimumSize().height() + child1->minimumSize().height()+4; - maxy = child0->maximumSize().height() + child1->maximumSize().height()+4; - minx = (child0->minimumSize().width() > child1->minimumSize().width()) ? child0->minimumSize().width() : child1->minimumSize().width(); - maxx = (child0->maximumSize().width() > child1->maximumSize().width()) ? child0->maximumSize().width() : child1->maximumSize().width(); + if (m_orientation ==Qt::Horizontal) { + miny = child0->tqminimumSize().height() + child1->tqminimumSize().height()+4; + maxy = child0->tqmaximumSize().height() + child1->tqmaximumSize().height()+4; + minx = (child0->tqminimumSize().width() > child1->tqminimumSize().width()) ? child0->tqminimumSize().width() : child1->tqminimumSize().width(); + maxx = (child0->tqmaximumSize().width() > child1->tqmaximumSize().width()) ? child0->tqmaximumSize().width() : child1->tqmaximumSize().width(); miny = (miny > 4) ? miny : 4; maxy = (maxy < 32000) ? maxy : 32000; minx = (minx > 2) ? minx : 2; maxx = (maxx < 32000) ? maxx : 32000; } else { - minx = child0->minimumSize().width() + child1->minimumSize().width()+4; - maxx = child0->maximumSize().width() + child1->maximumSize().width()+4; - miny = (child0->minimumSize().height() > child1->minimumSize().height()) ? child0->minimumSize().height() : child1->minimumSize().height(); - maxy = (child0->maximumSize().height() > child1->maximumSize().height()) ? child0->maximumSize().height() : child1->maximumSize().height(); + minx = child0->tqminimumSize().width() + child1->tqminimumSize().width()+4; + maxx = child0->tqmaximumSize().width() + child1->tqmaximumSize().width()+4; + miny = (child0->tqminimumSize().height() > child1->tqminimumSize().height()) ? child0->tqminimumSize().height() : child1->tqminimumSize().height(); + maxy = (child0->tqmaximumSize().height() > child1->tqmaximumSize().height()) ? child0->tqmaximumSize().height() : child1->tqmaximumSize().height(); minx = (minx > 4) ? minx : 4; maxx = (maxx < 32000) ? maxx : 32000; @@ -238,32 +238,32 @@ void KDockSplitter::resizeEvent(TQResizeEvent *ev) double factor = (mHighResolution)? 10000.0:100.0; // real resize event, recalculate xpos if (ev && mKeepSize && isVisible()) { -// kdDebug(282)<<"mKeepSize : "<< ((m_orientation == Horizontal) ? "Horizontal":"Vertical") <<endl; +// kdDebug(282)<<"mKeepSize : "<< ((m_orientation ==Qt::Horizontal) ? "Horizontal":"Vertical") <<endl; if (ev->oldSize().width() != ev->size().width()) { - if (m_orientation == Horizontal) { - xpos = qRound(factor * checkValue( child0->height()+1 ) / height()); + if (m_orientation ==Qt::Horizontal) { + xpos = tqRound(factor * checkValue( child0->height()+1 ) / height()); } else { - xpos = qRound(factor * checkValue( child0->width()+1 ) / width()); + xpos = tqRound(factor * checkValue( child0->width()+1 ) / width()); } } } else { -// kdDebug(282)<<"!mKeepSize : "<< ((m_orientation == Horizontal) ? "Horizontal":"Vertical") <<endl; +// kdDebug(282)<<"!mKeepSize : "<< ((m_orientation ==Qt::Horizontal) ? "Horizontal":"Vertical") <<endl; if (/*ev &&*/ isVisible()) { - if (m_orientation == Horizontal) { + if (m_orientation ==Qt::Horizontal) { /* if (ev->oldSize().height() != ev->size().height())*/ { if (fixedHeight0!=-1) // xpos=floor(fixedHeight0*factor/height()); - xpos=qRound(fixedHeight0*factor/height()); + xpos=tqRound(fixedHeight0*factor/height()); else if (fixedHeight1!=-1) // xpos=ceil((height()-fixedHeight1)*factor/height()); - xpos=qRound((height()-fixedHeight1)*factor/height()); + xpos=tqRound((height()-fixedHeight1)*factor/height()); } } else @@ -272,11 +272,11 @@ void KDockSplitter::resizeEvent(TQResizeEvent *ev) { if (fixedWidth0!=-1) // xpos=floor(fixedWidth0*factor/width()); - xpos=qRound(fixedWidth0*factor/width()); + xpos=tqRound(fixedWidth0*factor/width()); else if (fixedWidth1!=-1) // xpos=ceil((width()-fixedWidth1)*factor/width()); - xpos=qRound((width()-fixedWidth1)*factor/width()); + xpos=tqRound((width()-fixedWidth1)*factor/width()); } } } @@ -287,15 +287,15 @@ void KDockSplitter::resizeEvent(TQResizeEvent *ev) KDockWidget *c0=(KDockWidget*)child0; KDockWidget *c1=(KDockWidget*)child1; bool stdHandling=false; - if ( ( (m_orientation==Vertical) &&((fixedWidth0==-1) && (fixedWidth1==-1)) ) || - ( (m_orientation==Horizontal) &&((fixedHeight0==-1) && (fixedHeight1==-1)) ) ) { + if ( ( (m_orientation==Qt::Vertical) &&((fixedWidth0==-1) && (fixedWidth1==-1)) ) || + ( (m_orientation==Qt::Horizontal) &&((fixedHeight0==-1) && (fixedHeight1==-1)) ) ) { if ((c0->getWidget()) && (dc=dynamic_cast<KDockContainer*>(c0->getWidget())) && (dc->m_overlapMode)) { - int position= qRound((m_orientation == Vertical ? width() : height()) * xpos/factor); + int position= tqRound((m_orientation ==Qt::Vertical ? width() : height()) * xpos/factor); position=checkValueOverlapped(position,child0); child0->raise(); divider->raise(); - if (m_orientation == Horizontal){ + if (m_orientation ==Qt::Horizontal){ child0->setGeometry(0, 0, width(), position); child1->setGeometry(0, dc->m_nonOverlapSize+4, width(), height()-dc->m_nonOverlapSize-4); @@ -309,11 +309,11 @@ void KDockSplitter::resizeEvent(TQResizeEvent *ev) } else { if ((c1->getWidget()) && (dc=dynamic_cast<KDockContainer*>(c1->getWidget())) && (dc->m_overlapMode)) { - int position= qRound((m_orientation == Vertical ? width() : height()) * xpos/factor); + int position= tqRound((m_orientation ==Qt::Vertical ? width() : height()) * xpos/factor); position=checkValueOverlapped(position,child1); child1->raise(); divider->raise(); - if (m_orientation == Horizontal){ + if (m_orientation ==Qt::Horizontal){ child0->setGeometry(0, 0, width(), height()-dc->m_nonOverlapSize-4); child1->setGeometry(0, position+4, width(), height()-position-4); @@ -331,8 +331,8 @@ void KDockSplitter::resizeEvent(TQResizeEvent *ev) else stdHandling=true; if (stdHandling) { - int position = checkValue( qRound((m_orientation == Vertical ? width() : height()) * xpos/factor) ); - if (m_orientation == Horizontal){ + int position = checkValue( tqRound((m_orientation ==Qt::Vertical ? width() : height()) * xpos/factor) ); + if (m_orientation ==Qt::Horizontal){ child0->setGeometry(0, 0, width(), position); child1->setGeometry(0, position+4, width(), height()-position-4); divider->setGeometry(0, position, width(), 4); @@ -349,22 +349,22 @@ void KDockSplitter::resizeEvent(TQResizeEvent *ev) int KDockSplitter::checkValueOverlapped(int position, TQWidget *overlappingWidget) const { if (initialised) { - if (m_orientation == Vertical) { + if (m_orientation ==Qt::Vertical) { if (child0==overlappingWidget) { - if (position<(child0->minimumSize().width())) - position=child0->minimumSize().width(); + if (position<(child0->tqminimumSize().width())) + position=child0->tqminimumSize().width(); if (position>width()) position=width()-4; - } else if (position>(width()-(child1->minimumSize().width())-4)){ - position=width()-(child1->minimumSize().width())-4; + } else if (position>(width()-(child1->tqminimumSize().width())-4)){ + position=width()-(child1->tqminimumSize().width())-4; if (position<0) position=0; } - } else {// orientation == Horizontal + } else {// orientation ==Qt::Horizontal if (child0==overlappingWidget) { - if (position<(child0->minimumSize().height())) - position=child0->minimumSize().height(); + if (position<(child0->tqminimumSize().height())) + position=child0->tqminimumSize().height(); if (position>height()) position=height()-4; - } else if (position>(height()-(child1->minimumSize().height())-4)){ - position=height()-(child1->minimumSize().height())-4; + } else if (position>(height()-(child1->tqminimumSize().height())-4)){ + position=height()-(child1->tqminimumSize().height())-4; if (position<0) position=0; } @@ -377,24 +377,24 @@ int KDockSplitter::checkValueOverlapped(int position, TQWidget *overlappingWidge int KDockSplitter::checkValue( int position ) const { if (initialised){ - if (m_orientation == Vertical){ - if (position < (child0->minimumSize().width())) - position = child0->minimumSize().width(); - if ((width()-4-position) < (child1->minimumSize().width())) - position = width() - (child1->minimumSize().width()) -4; + if (m_orientation ==Qt::Vertical){ + if (position < (child0->tqminimumSize().width())) + position = child0->tqminimumSize().width(); + if ((width()-4-position) < (child1->tqminimumSize().width())) + position = width() - (child1->tqminimumSize().width()) -4; } else { - if (position < (child0->minimumSize().height())) - position = (child0->minimumSize().height()); - if ((height()-4-position) < (child1->minimumSize().height())) - position = height() - (child1->minimumSize().height()) -4; + if (position < (child0->tqminimumSize().height())) + position = (child0->tqminimumSize().height()); + if ((height()-4-position) < (child1->tqminimumSize().height())) + position = height() - (child1->tqminimumSize().height()) -4; } } if (position < 0) position = 0; - if ((m_orientation == Vertical) && (position > width())) + if ((m_orientation ==Qt::Vertical) && (position > width())) position = width(); - if ((m_orientation == Horizontal) && (position > height())) + if ((m_orientation ==Qt::Horizontal) && (position > height())) position = height(); return position; @@ -411,7 +411,7 @@ bool KDockSplitter::eventFilter(TQObject *o, TQEvent *e) mev= (TQMouseEvent*)e; child0->setUpdatesEnabled(mOpaqueResize); child1->setUpdatesEnabled(mOpaqueResize); - if (m_orientation == Horizontal) { + if (m_orientation ==Qt::Horizontal) { if ((fixedHeight0!=-1) || (fixedHeight1!=-1)) { handled=true; break; @@ -423,7 +423,7 @@ bool KDockSplitter::eventFilter(TQObject *o, TQEvent *e) } else { xpos = factor * checkValue( mapFromGlobal(mev->globalPos()).y() ) / height(); resizeEvent(0); - divider->repaint(true); + divider->tqrepaint(true); } } else { if ((fixedWidth0!=-1) || (fixedWidth1!=-1)) @@ -436,7 +436,7 @@ bool KDockSplitter::eventFilter(TQObject *o, TQEvent *e) } else { xpos = factor * checkValue( mapFromGlobal( mev->globalPos()).x() ) / width(); resizeEvent(0); - divider->repaint(true); + divider->tqrepaint(true); } } handled= true; @@ -445,14 +445,14 @@ bool KDockSplitter::eventFilter(TQObject *o, TQEvent *e) child0->setUpdatesEnabled(true); child1->setUpdatesEnabled(true); mev= (TQMouseEvent*)e; - if (m_orientation == Horizontal){ + if (m_orientation ==Qt::Horizontal){ if ((fixedHeight0!=-1) || (fixedHeight1!=-1)) { handled=true; break; } xpos = factor* checkValue( mapFromGlobal(mev->globalPos()).y() ) / height(); resizeEvent(0); - divider->repaint(true); + divider->tqrepaint(true); } else { if ((fixedWidth0!=-1) || (fixedWidth1!=-1)) { @@ -460,7 +460,7 @@ bool KDockSplitter::eventFilter(TQObject *o, TQEvent *e) } xpos = factor* checkValue( mapFromGlobal(mev->globalPos()).x() ) / width(); resizeEvent(0); - divider->repaint(true); + divider->tqrepaint(true); } handled= true; break; @@ -473,7 +473,7 @@ bool KDockSplitter::eventFilter(TQObject *o, TQEvent *e) bool KDockSplitter::event( TQEvent* e ) { if ( e->type() == TQEvent::LayoutHint ){ - // change children min/max size + // change tqchildren min/max size setupMinMaxSize(); setSeparatorPos(xpos); } @@ -490,15 +490,15 @@ void KDockSplitter::updateName() if ( !initialised ) return; TQString new_name = TQString( child0->name() ) + "," + child1->name(); - parentWidget()->setName( new_name.latin1() ); - parentWidget()->setCaption( child0->caption() + "," + child1->caption() ); - parentWidget()->repaint( false ); + tqparentWidget()->setName( new_name.latin1() ); + tqparentWidget()->setCaption( child0->caption() + "," + child1->caption() ); + tqparentWidget()->tqrepaint( false ); - ((KDockWidget*)parentWidget())->firstName = child0->name(); - ((KDockWidget*)parentWidget())->lastName = child1->name(); - ((KDockWidget*)parentWidget())->splitterOrientation = m_orientation; + ((KDockWidget*)tqparentWidget())->firstName = child0->name(); + ((KDockWidget*)tqparentWidget())->lastName = child1->name(); + ((KDockWidget*)tqparentWidget())->splitterOrientation = m_orientation; - TQWidget* p = parentWidget()->parentWidget(); + TQWidget* p = tqparentWidget()->tqparentWidget(); if ( p && p->inherits("KDockSplitter" ) ) ((KDockSplitter*)p)->updateName(); } @@ -540,11 +540,11 @@ bool KDockSplitter::highResolution() const /*************************************************************************/ -KDockButton_Private::KDockButton_Private( TQWidget *parent, const char * name ) -:TQPushButton( parent, name ) +KDockButton_Private::KDockButton_Private( TQWidget *tqparent, const char * name ) +:TQPushButton( tqparent, name ) { moveMouse = false; - setFocusPolicy( NoFocus ); + setFocusPolicy( TQ_NoFocus ); } KDockButton_Private::~KDockButton_Private() @@ -553,7 +553,7 @@ KDockButton_Private::~KDockButton_Private() void KDockButton_Private::drawButton( TQPainter* p ) { - p->fillRect( 0,0, width(), height(), TQBrush(colorGroup().brush(TQColorGroup::Background)) ); + p->fillRect( 0,0, width(), height(), TQBrush(tqcolorGroup().brush(TQColorGroup::Background)) ); p->drawPixmap( (width() - pixmap()->width()) / 2, (height() - pixmap()->height()) / 2, *pixmap() ); if ( moveMouse && !isDown() ){ p->setPen( white ); @@ -561,12 +561,12 @@ void KDockButton_Private::drawButton( TQPainter* p ) p->lineTo( 0, 0 ); p->lineTo( width() - 1, 0 ); - p->setPen( colorGroup().dark() ); + p->setPen( tqcolorGroup().dark() ); p->lineTo( width() - 1, height() - 1 ); p->lineTo( 0, height() - 1 ); } if ( isOn() || isDown() ){ - p->setPen( colorGroup().dark() ); + p->setPen( tqcolorGroup().dark() ); p->moveTo( 0, height() - 1 ); p->lineTo( 0, 0 ); p->lineTo( width() - 1, 0 ); @@ -580,13 +580,13 @@ void KDockButton_Private::drawButton( TQPainter* p ) void KDockButton_Private::enterEvent( TQEvent * ) { moveMouse = true; - repaint(); + tqrepaint(); } void KDockButton_Private::leaveEvent( TQEvent * ) { moveMouse = false; - repaint(); + tqrepaint(); } /*************************************************************************/ @@ -620,12 +620,12 @@ void KDockWidgetPrivate::slotFocusEmbeddedWidget(TQWidget* w) { if (w) { TQWidget* embeddedWdg = ((KDockWidget*)w)->getWidget(); - if (embeddedWdg && ((embeddedWdg->focusPolicy() == TQWidget::ClickFocus) || (embeddedWdg->focusPolicy() == TQWidget::StrongFocus))) { + if (embeddedWdg && ((embeddedWdg->focusPolicy() == TQ_ClickFocus) || (embeddedWdg->focusPolicy() == TQ_StrongFocus))) { embeddedWdg->setFocus(); } } } -#ifndef NO_INCLUDE_MOCFILES // for Qt-only projects, because tmake doesn't take this name +#ifndef NO_INCLUDE_TQMOCFILES // for TQt-only projects, because tmake doesn't take this name #include "kdockwidget_private.moc" #endif |