summaryrefslogtreecommitdiffstats
path: root/lib/widgets/qcomboview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/widgets/qcomboview.cpp')
-rw-r--r--lib/widgets/qcomboview.cpp422
1 files changed, 211 insertions, 211 deletions
diff --git a/lib/widgets/qcomboview.cpp b/lib/widgets/qcomboview.cpp
index 2cab4fea..800eec47 100644
--- a/lib/widgets/qcomboview.cpp
+++ b/lib/widgets/qcomboview.cpp
@@ -16,21 +16,21 @@
#include "qcomboview.h"
#include <kdeversion.h>
#ifndef QT_NO_COMBOBOX
-#include "qpopupmenu.h"
-#include "qlistview.h"
-#include "qpainter.h"
-#include "qdrawutil.h"
-#include "qstrlist.h"
-#include "qpixmap.h"
-#include "qtimer.h"
-#include "qapplication.h"
-#include "qlineedit.h"
-#include "qbitmap.h"
+#include "tqpopupmenu.h"
+#include "tqlistview.h"
+#include "tqpainter.h"
+#include "tqdrawutil.h"
+#include "tqstrlist.h"
+#include "tqpixmap.h"
+#include "tqtimer.h"
+#include "tqapplication.h"
+#include "tqlineedit.h"
+#include "tqbitmap.h"
#include "private/qeffects_p.h"
-#include "qstringlist.h"
-#include "qcombobox.h"
-#include "qstyle.h"
-#include "qheader.h"
+#include "tqstringlist.h"
+#include "tqcombobox.h"
+#include "tqstyle.h"
+#include "tqheader.h"
#include <limits.h>
class QComboViewData
@@ -39,16 +39,16 @@ public:
QComboViewData( QComboView *cb ): current(0), lView( 0 ), combo( cb )
{
duplicatesEnabled = TRUE;
- cb->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Fixed ) );
+ cb->setSizePolicy( TQSizePolicy( TQSizePolicy::Minimum, TQSizePolicy::Fixed ) );
}
- inline QListView * listView() { return lView; }
+ inline TQListView * listView() { return lView; }
void updateLinedGeometry();
- void setListView( QListView *l ) { lView = l ;
+ void setListView( TQListView *l ) { lView = l ;
l->setMouseTracking( TRUE );}
- QListViewItem *current;
+ TQListViewItem *current;
int maxCount;
int sizeLimit;
QComboView::Policy p;
@@ -65,14 +65,14 @@ public:
bool duplicatesEnabled;
int fullHeight, currHeight;
- QLineEdit * ed; // /bin/ed rules!
- QTimer *completionTimer;
+ TQLineEdit * ed; // /bin/ed rules!
+ TQTimer *completionTimer;
- QSize sizeHint;
+ TQSize sizeHint;
private:
bool usinglView;
- QListView *lView;
+ TQListView *lView;
QComboView *combo;
};
@@ -81,11 +81,11 @@ void QComboViewData::updateLinedGeometry()
{
if ( !ed || !combo )
return;
- QRect r = QStyle::visualRect( combo->style().querySubControlMetrics(QStyle::CC_ComboBox, combo,
- QStyle::SC_ComboBoxEditField), combo );
+ TQRect r = TQStyle::visualRect( combo->style().querySubControlMetrics(TQStyle::CC_ComboBox, combo,
+ TQStyle::SC_ComboBoxEditField), combo );
// qWarning("updateLinedGeometry(): currentItem is %d", combo->currentItem() == 0 ? 0 : 1);
- const QPixmap *pix = combo->currentItem() ? combo->currentItem()->pixmap(0) : 0;
+ const TQPixmap *pix = combo->currentItem() ? combo->currentItem()->pixmap(0) : 0;
if ( pix && pix->width() < r.width() )
r.setLeft( r.left() + pix->width() + 4 );
if ( r != ed->geometry() )
@@ -138,8 +138,8 @@ static inline bool checkIndex( const char *method, const char * name,
*/
-QComboView::QComboView( bool rw, QWidget *parent, const char *name )
- : QWidget( parent, name, WResizeNoErase )
+QComboView::QComboView( bool rw, TQWidget *parent, const char *name )
+ : TQWidget( parent, name, WResizeNoErase )
{
d = new QComboViewData( this );
setUpListView();
@@ -156,7 +156,7 @@ QComboView::QComboView( bool rw, QWidget *parent, const char *name )
d->useCompletion = FALSE;
d->completeAt = 0;
d->completeNow = FALSE;
- d->completionTimer = new QTimer( this );
+ d->completionTimer = new TQTimer( this );
setFocusPolicy( StrongFocus );
@@ -204,18 +204,18 @@ void QComboView::clear()
d->current = 0;
if ( d->ed ) {
- d->ed->setText( QString::fromLatin1("") );
+ d->ed->setText( TQString::fromLatin1("") );
d->updateLinedGeometry();
}
currentChanged();
}
-QListViewItem *QComboView::currentItem() const
+TQListViewItem *QComboView::currentItem() const
{
return d->current;
}
-void QComboView::setCurrentItem( QListViewItem *item )
+void QComboView::setCurrentItem( TQListViewItem *item )
{
if ( item == d->current && !d->ed ) {
return;
@@ -272,16 +272,16 @@ void QComboView::setAutoResize( bool enable )
the contents change dynamically. To invalidate the cached value
call setFont().
*/
-QSize QComboView::sizeHint() const
+TQSize QComboView::sizeHint() const
{
if ( isVisible() && d->sizeHint.isValid() )
return d->sizeHint;
constPolish();
// int i, w;
- QFontMetrics fm = fontMetrics();
+ TQFontMetrics fm = fontMetrics();
- int maxW = childCount() ? 18 : 7 * fm.width(QChar('x')) + 18;
+ int maxW = childCount() ? 18 : 7 * fm.width(TQChar('x')) + 18;
int maxH = QMAX( fm.lineSpacing(), 14 ) + 2;
/* for( i = 0; i < count(); i++ ) {
@@ -290,8 +290,8 @@ QSize QComboView::sizeHint() const
maxW = w;
}
*/
- d->sizeHint = (style().sizeFromContents(QStyle::CT_ComboBox, this,
- QSize(maxW, maxH)).expandedTo(QApplication::globalStrut()));
+ d->sizeHint = (style().sizeFromContents(TQStyle::CT_ComboBox, this,
+ TQSize(maxW, maxH)).expandedTo(TQApplication::globalStrut()));
return d->sizeHint;
}
@@ -303,7 +303,7 @@ QSize QComboView::sizeHint() const
the activated() signal.
*/
-void QComboView::internalActivate( QListViewItem * item )
+void QComboView::internalActivate( TQListViewItem * item )
{
if (!item)
{
@@ -319,7 +319,7 @@ void QComboView::internalActivate( QListViewItem * item )
d->current = item;
- QString t( item->text(0) );
+ TQString t( item->text(0) );
if ( d->ed ) {
d->ed->setText( t );
// qWarning("internalActivate( %s )", item->text(0).latin1());
@@ -337,7 +337,7 @@ void QComboView::internalActivate( QListViewItem * item )
the highlighted() signal.
*/
-void QComboView::internalHighlight( QListViewItem * item )
+void QComboView::internalHighlight( TQListViewItem * item )
{
if (!item)
{
@@ -349,7 +349,7 @@ void QComboView::internalHighlight( QListViewItem * item )
return;
}
emit highlighted( item );
- QString t = item->text(0);
+ TQString t = item->text(0);
if ( !t.isNull() )
emit highlighted( t );
}
@@ -369,9 +369,9 @@ void QComboView::internalClickTimeout()
popup list to \a palette.
*/
-void QComboView::setPalette( const QPalette &palette )
+void QComboView::setPalette( const TQPalette &palette )
{
- QWidget::setPalette( palette );
+ TQWidget::setPalette( palette );
if( d ) {
if(d->listView())
d->listView()->setPalette( palette );
@@ -383,10 +383,10 @@ void QComboView::setPalette( const QPalette &palette )
list to \a font.
*/
-void QComboView::setFont( const QFont &font )
+void QComboView::setFont( const TQFont &font )
{
- d->sizeHint = QSize(); // invalidate size hint
- QWidget::setFont( font );
+ d->sizeHint = TQSize(); // invalidate size hint
+ TQWidget::setFont( font );
d->listView()->setFont( font );
if (d->ed)
d->ed->setFont( font );
@@ -398,49 +398,49 @@ void QComboView::setFont( const QFont &font )
/*!reimp
*/
-void QComboView::resizeEvent( QResizeEvent * e )
+void QComboView::resizeEvent( TQResizeEvent * e )
{
if ( d->ed )
d->updateLinedGeometry();
d->listView()->resize( width(), d->listView()->height() );
- QWidget::resizeEvent( e );
+ TQWidget::resizeEvent( e );
}
/*!reimp
*/
-void QComboView::paintEvent( QPaintEvent * )
+void QComboView::paintEvent( TQPaintEvent * )
{
- QPainter p( this );
- const QColorGroup & g = colorGroup();
+ TQPainter p( this );
+ const TQColorGroup & g = colorGroup();
p.setPen(g.text());
- QStyle::SFlags flags = QStyle::Style_Default;
+ TQStyle::SFlags flags = TQStyle::Style_Default;
if (isEnabled())
- flags |= QStyle::Style_Enabled;
+ flags |= TQStyle::Style_Enabled;
if (hasFocus())
- flags |= QStyle::Style_HasFocus;
+ flags |= TQStyle::Style_HasFocus;
if ( width() < 5 || height() < 5 ) {
qDrawShadePanel( &p, rect(), g, FALSE, 2,
- &g.brush( QColorGroup::Button ) );
+ &g.brush( TQColorGroup::Button ) );
return;
}
-// bool reverse = QApplication::reverseLayout();
- style().drawComplexControl( QStyle::CC_ComboBox, &p, this, rect(), g,
- flags, QStyle::SC_All,
+// bool reverse = TQApplication::reverseLayout();
+ style().drawComplexControl( TQStyle::CC_ComboBox, &p, this, rect(), g,
+ flags, TQStyle::SC_All,
(d->arrowDown ?
- QStyle::SC_ComboBoxArrow :
- QStyle::SC_None ));
+ TQStyle::SC_ComboBoxArrow :
+ TQStyle::SC_None ));
- QRect re = style().querySubControlMetrics( QStyle::CC_ComboBox, this,
- QStyle::SC_ComboBoxEditField );
- re = QStyle::visualRect(re, this);
+ TQRect re = style().querySubControlMetrics( TQStyle::CC_ComboBox, this,
+ TQStyle::SC_ComboBoxEditField );
+ re = TQStyle::visualRect(re, this);
p.setClipRect( re );
if ( !d->ed ) {
- QListViewItem * item = d->current;
+ TQListViewItem * item = d->current;
if ( item ) {
// we calculate the QListBoxTexts height (ignoring strut)
int itemh = d->listView()->fontMetrics().lineSpacing() + 2;
@@ -448,11 +448,11 @@ void QComboView::paintEvent( QPaintEvent * )
item->paintCell( &p, d->listView()->colorGroup(), 0, width(), AlignLeft | AlignVCenter );
}
} else if ( d->listView() && d->listView()->currentItem( ) && d->current ) {
- QListViewItem * item = d->current ;
- const QPixmap *pix = item->pixmap(0);
+ TQListViewItem * item = d->current ;
+ const TQPixmap *pix = item->pixmap(0);
if ( pix ) {
p.fillRect( re.x(), re.y(), pix->width() + 4, re.height(),
- colorGroup().brush( QColorGroup::Base ) );
+ colorGroup().brush( TQColorGroup::Base ) );
p.drawPixmap( re.x() + 2, re.y() +
( re.height() - pix->height() ) / 2, *pix );
}
@@ -464,7 +464,7 @@ void QComboView::paintEvent( QPaintEvent * )
/*!reimp
*/
-void QComboView::mousePressEvent( QMouseEvent *e )
+void QComboView::mousePressEvent( TQMouseEvent *e )
{
if ( e->button() != LeftButton )
return;
@@ -472,9 +472,9 @@ void QComboView::mousePressEvent( QMouseEvent *e )
d->discardNextMousePress = FALSE;
return;
}
- QRect arrowRect = style().querySubControlMetrics( QStyle::CC_ComboBox, this,
- QStyle::SC_ComboBoxArrow);
- arrowRect = QStyle::visualRect(arrowRect, this);
+ TQRect arrowRect = style().querySubControlMetrics( TQStyle::CC_ComboBox, this,
+ TQStyle::SC_ComboBoxArrow);
+ arrowRect = TQStyle::visualRect(arrowRect, this);
// Correction for motif style, where arrow is smaller
// and thus has a rect that doesn't fit the button.
@@ -491,7 +491,7 @@ void QComboView::mousePressEvent( QMouseEvent *e )
d->arrowDown = TRUE;
repaint( FALSE );
}
- QTimer::singleShot( 200, this, SLOT(internalClickTimeout()));
+ TQTimer::singleShot( 200, this, TQT_SLOT(internalClickTimeout()));
d->shortClick = TRUE;
}
}
@@ -499,21 +499,21 @@ void QComboView::mousePressEvent( QMouseEvent *e )
/*!reimp
*/
-void QComboView::mouseMoveEvent( QMouseEvent * )
+void QComboView::mouseMoveEvent( TQMouseEvent * )
{
}
/*!reimp
*/
-void QComboView::mouseReleaseEvent( QMouseEvent * )
+void QComboView::mouseReleaseEvent( TQMouseEvent * )
{
}
/*!reimp
*/
-void QComboView::mouseDoubleClickEvent( QMouseEvent *e )
+void QComboView::mouseDoubleClickEvent( TQMouseEvent *e )
{
mousePressEvent( e );
}
@@ -522,9 +522,9 @@ void QComboView::mouseDoubleClickEvent( QMouseEvent *e )
/*!reimp
*/
-void QComboView::keyPressEvent( QKeyEvent *e )
+void QComboView::keyPressEvent( TQKeyEvent *e )
{
- QListViewItem *c = currentItem();
+ TQListViewItem *c = currentItem();
if ( ( e->key() == Key_F4 && e->state() == 0 ) ||
( e->key() == Key_Down && (e->state() & AltButton) ) ||
( !d->ed && e->key() == Key_Space ) ) {
@@ -571,7 +571,7 @@ void QComboView::keyPressEvent( QKeyEvent *e )
return;
} else {
d->completionTimer->stop();
- QString ct = currentText().left( d->completeAt ) + e->text();
+ TQString ct = currentText().left( d->completeAt ) + e->text();
c = completionIndex( ct, c );
if ( c == 0 && d->completeAt > 0 ) {
c = completionIndex( e->text(), listView()->firstChild() );
@@ -597,22 +597,22 @@ void QComboView::keyPressEvent( QKeyEvent *e )
emit activated( c );
}
-QString QComboView::currentText() const
+TQString QComboView::currentText() const
{
if ( d->ed )
return d->ed->text();
else if ( d->current )
return currentItem()->text(0);
else
- return QString::null;
+ return TQString::null;
}
/*!reimp
*/
-void QComboView::focusInEvent( QFocusEvent * e )
+void QComboView::focusInEvent( TQFocusEvent * e )
{
- QWidget::focusInEvent( e );
+ TQWidget::focusInEvent( e );
d->completeNow = FALSE;
d->completeAt = 0;
@@ -622,9 +622,9 @@ void QComboView::focusInEvent( QFocusEvent * e )
/*!reimp
*/
-void QComboView::focusOutEvent( QFocusEvent * e )
+void QComboView::focusOutEvent( TQFocusEvent * e )
{
- QWidget::focusOutEvent( e );
+ TQWidget::focusOutEvent( e );
d->completeNow = FALSE;
d->completeAt = 0;
@@ -634,20 +634,20 @@ void QComboView::focusOutEvent( QFocusEvent * e )
/*!reimp
*/
-void QComboView::wheelEvent( QWheelEvent *e )
+void QComboView::wheelEvent( TQWheelEvent *e )
{
if ( d->poppedUp ) {
- QApplication::sendEvent( d->listView(), e );
+ TQApplication::sendEvent( d->listView(), e );
} else {
if ( e->delta() > 0 ) {
- QListViewItem *c = currentItem();
+ TQListViewItem *c = currentItem();
if ( c && c->itemAbove() ) {
setCurrentItem( c->itemAbove() );
emit activated( currentItem() );
emit activated( currentText() );
}
} else {
- QListViewItem *c = currentItem();
+ TQListViewItem *c = currentItem();
if ( c && c->itemBelow() ) {
setCurrentItem( c->itemBelow() );
emit activated( currentItem() );
@@ -658,10 +658,10 @@ void QComboView::wheelEvent( QWheelEvent *e )
}
}
-int childCount(QListViewItem *it)
+int childCount(TQListViewItem *it)
{
int count = 1;
- QListViewItem * myChild = it->firstChild();
+ TQListViewItem * myChild = it->firstChild();
while( myChild ) {
count += childCount(myChild);
myChild = myChild->nextSibling();
@@ -669,10 +669,10 @@ int childCount(QListViewItem *it)
return count;
}
-int childCount(QListView *lv)
+int childCount(TQListView *lv)
{
int count = 0;
- QListViewItem * myChild = lv->firstChild();
+ TQListViewItem * myChild = lv->firstChild();
while( myChild ) {
count += childCount(myChild);
// count += 1;
@@ -686,7 +686,7 @@ int childCount(QListView *lv)
Calculates the listbox height needed to contain all items, or as
many as the list box is supposed to contain.
*/
-static int listHeight( QListView *l, int /*sl*/ )
+static int listHeight( TQListView *l, int /*sl*/ )
{
/* if ( l->childCount() > 0 )
return QMIN( l->childCount(), (uint)sl) * l->firstChild()->height();
@@ -722,7 +722,7 @@ void QComboView::popup()
return;
// Send all listbox events to eventFilter():
- QListView* lb = d->listView();
+ TQListView* lb = d->listView();
lb->triggerUpdate( );
lb->installEventFilter( this );
lb->viewport()->installEventFilter( this );
@@ -730,13 +730,13 @@ void QComboView::popup()
// int w = lb->variableWidth() ? lb->sizeHint().width() : width();
int w = width();
int h = listHeight( lb, d->sizeLimit );
- QRect screen = QApplication::desktop()->availableGeometry( const_cast<QComboView*>(this) );
+ TQRect screen = TQApplication::desktop()->availableGeometry( const_cast<QComboView*>(this) );
int sx = screen.x(); // screen pos
int sy = screen.y();
int sw = screen.width(); // screen width
int sh = screen.height(); // screen height
- QPoint pos = mapToGlobal( QPoint(0,height()) );
+ TQPoint pos = mapToGlobal( TQPoint(0,height()) );
// ## Similar code is in QPopupMenu
int x = pos.x();
int y = pos.y();
@@ -748,10 +748,10 @@ void QComboView::popup()
x = sx;
if (y + h > sy+sh && y - h - height() >= 0 )
y = y - h - height();
- QRect rect =
- style().querySubControlMetrics( QStyle::CC_ComboBox, this,
- QStyle::SC_ComboBoxListBoxPopup,
- QStyleOption( x, y, w, h ) );
+ TQRect rect =
+ style().querySubControlMetrics( TQStyle::CC_ComboBox, this,
+ TQStyle::SC_ComboBoxListBoxPopup,
+ TQStyleOption( x, y, w, h ) );
if ( rect.isNull() )
rect.setRect( x, y, w, h );
lb->setGeometry( rect );
@@ -759,17 +759,17 @@ void QComboView::popup()
lb->raise();
bool block = lb->signalsBlocked();
lb->blockSignals( TRUE );
- QListViewItem *currentLBItem = d->current ;
+ TQListViewItem *currentLBItem = d->current ;
lb->setCurrentItem( currentLBItem );
// set the current item to also be the selected item if it isn't already
if ( currentLBItem && currentLBItem->isSelectable() && !currentLBItem->isSelected() )
lb->setSelected( currentLBItem, TRUE );
lb->blockSignals( block );
- lb->setVScrollBarMode(QScrollView::Auto);
+ lb->setVScrollBarMode(TQScrollView::Auto);
//#ifndef QT_NO_EFFECTS
-/* if ( QApplication::isEffectEnabled( UI_AnimateCombo ) ) {
- if ( lb->y() < mapToGlobal(QPoint(0,0)).y() )
+/* if ( TQApplication::isEffectEnabled( UI_AnimateCombo ) ) {
+ if ( lb->y() < mapToGlobal(TQPoint(0,0)).y() )
qScrollEffect( lb, QEffects::UpScroll );
else
qScrollEffect( lb );
@@ -785,12 +785,12 @@ void QComboView::popup()
*/
void QComboView::updateMask()
{
- QBitmap bm( size() );
+ TQBitmap bm( size() );
bm.fill( color0 );
{
- QPainter p( &bm, this );
- style().drawComplexControlMask(QStyle::CC_ComboBox, &p, this, rect());
+ TQPainter p( &bm, this );
+ style().drawComplexControlMask(TQStyle::CC_ComboBox, &p, this, rect());
}
setMask( bm );
@@ -846,42 +846,42 @@ void QComboView::currentChanged()
when the mouse button is released.
*/
-bool QComboView::eventFilter( QObject *object, QEvent *event )
+bool QComboView::eventFilter( TQObject *object, TQEvent *event )
{
if ( !event )
return TRUE;
else if ( object == d->ed ) {
- if ( event->type() == QEvent::KeyPress ) {
- bool isAccepted = ( (QKeyEvent*)event )->isAccepted();
- keyPressEvent( (QKeyEvent *)event );
- if ( ((QKeyEvent *)event)->isAccepted() ) {
+ if ( event->type() == TQEvent::KeyPress ) {
+ bool isAccepted = ( (TQKeyEvent*)event )->isAccepted();
+ keyPressEvent( (TQKeyEvent *)event );
+ if ( ((TQKeyEvent *)event)->isAccepted() ) {
d->completeNow = FALSE;
return TRUE;
- } else if ( ((QKeyEvent *)event)->key() != Key_End ) {
+ } else if ( ((TQKeyEvent *)event)->key() != Key_End ) {
d->completeNow = TRUE;
d->completeAt = d->ed->cursorPosition();
}
if ( isAccepted )
- ( (QKeyEvent*)event )->accept();
+ ( (TQKeyEvent*)event )->accept();
else
- ( (QKeyEvent*)event )->ignore();
- } else if ( event->type() == QEvent::KeyRelease ) {
+ ( (TQKeyEvent*)event )->ignore();
+ } else if ( event->type() == TQEvent::KeyRelease ) {
d->completeNow = FALSE;
- keyReleaseEvent( (QKeyEvent *)event );
- return ((QKeyEvent *)event)->isAccepted();
- } else if ( event->type() == QEvent::FocusIn ) {
- focusInEvent( (QFocusEvent *)event );
- } else if ( event->type() == QEvent::FocusOut ) {
- focusOutEvent( (QFocusEvent *)event );
+ keyReleaseEvent( (TQKeyEvent *)event );
+ return ((TQKeyEvent *)event)->isAccepted();
+ } else if ( event->type() == TQEvent::FocusIn ) {
+ focusInEvent( (TQFocusEvent *)event );
+ } else if ( event->type() == TQEvent::FocusOut ) {
+ focusOutEvent( (TQFocusEvent *)event );
} else if ( d->useCompletion && d->completeNow ) {
if ( !d->ed->text().isNull() &&
d->ed->cursorPosition() > d->completeAt &&
d->ed->cursorPosition() == (int)d->ed->text().length() ) {
d->completeNow = FALSE;
- QString ct( d->ed->text() );
- QListViewItem *i = completionIndex( ct, currentItem() );
+ TQString ct( d->ed->text() );
+ TQListViewItem *i = completionIndex( ct, currentItem() );
if ( i ) {
- QString it = i->text(0);
+ TQString it = i->text(0);
d->ed->validateAndSet( it, ct.length(),
ct.length(), it.length() );
}
@@ -889,22 +889,22 @@ bool QComboView::eventFilter( QObject *object, QEvent *event )
}
} else if ( ( object == d->listView() ||
object == d->listView()->viewport() )) {
- QMouseEvent *e = (QMouseEvent*)event;
+ TQMouseEvent *e = (TQMouseEvent*)event;
switch( event->type() ) {
- case QEvent::MouseMove:
+ case TQEvent::MouseMove:
if ( !d->mouseWasInsidePopup ) {
// qWarning("!d->mouseWasInsidePopup");
- QPoint pos = e->pos();
+ TQPoint pos = e->pos();
if ( d->listView()->rect().contains( pos ) )
d->mouseWasInsidePopup = TRUE;
// Check if arrow button should toggle
if ( d->arrowPressed ) {
- QPoint comboPos;
+ TQPoint comboPos;
comboPos = mapFromGlobal( d->listView()->mapToGlobal(pos) );
- QRect arrowRect =
- style().querySubControlMetrics( QStyle::CC_ComboBox, this,
- QStyle::SC_ComboBoxArrow);
- arrowRect = QStyle::visualRect(arrowRect, this);
+ TQRect arrowRect =
+ style().querySubControlMetrics( TQStyle::CC_ComboBox, this,
+ TQStyle::SC_ComboBoxArrow);
+ arrowRect = TQStyle::visualRect(arrowRect, this);
if ( arrowRect.contains( comboPos ) ) {
if ( !d->arrowDown ) {
d->arrowDown = TRUE;
@@ -918,12 +918,12 @@ bool QComboView::eventFilter( QObject *object, QEvent *event )
}
}
} else if ((e->state() & ( RightButton | LeftButton | MidButton ) ) == 0 &&
- style().styleHint(QStyle::SH_ComboBox_ListMouseTracking, this)) {
+ style().styleHint(TQStyle::SH_ComboBox_ListMouseTracking, this)) {
// qWarning("event filter:: emu");
- QWidget *mouseW = QApplication::widgetAt( e->globalPos(), TRUE );
+ TQWidget *mouseW = TQApplication::widgetAt( e->globalPos(), TRUE );
// if ( mouseW == d->listView()->viewport() ) { //###
if ( mouseW == d->listView()->viewport() ) {
- QListViewItem *sel = d->listView()->itemAt(e->pos());
+ TQListViewItem *sel = d->listView()->itemAt(e->pos());
if (sel)
{
d->listView()->setCurrentItem(sel);
@@ -934,12 +934,12 @@ bool QComboView::eventFilter( QObject *object, QEvent *event )
}
break;
- case QEvent::MouseButtonRelease:
+ case TQEvent::MouseButtonRelease:
if ( d->listView()->rect().contains( e->pos() ) ) {
- QMouseEvent tmp( QEvent::MouseButtonDblClick,
+ TQMouseEvent tmp( TQEvent::MouseButtonDblClick,
e->pos(), e->button(), e->state() ) ;
// will hide popup
- QApplication::sendEvent( object, &tmp );
+ TQApplication::sendEvent( object, &tmp );
return TRUE;
} else {
if ( d->mouseWasInsidePopup ) {
@@ -953,11 +953,11 @@ bool QComboView::eventFilter( QObject *object, QEvent *event )
}
}
break;
- case QEvent::MouseButtonDblClick:
- case QEvent::MouseButtonPress:
+ case TQEvent::MouseButtonDblClick:
+ case TQEvent::MouseButtonPress:
if ( !d->listView()->rect().contains( e->pos() ) ) {
- QPoint globalPos = d->listView()->mapToGlobal(e->pos());
- if ( QApplication::widgetAt( globalPos, TRUE ) == this ) {
+ TQPoint globalPos = d->listView()->mapToGlobal(e->pos());
+ if ( TQApplication::widgetAt( globalPos, TRUE ) == this ) {
d->discardNextMousePress = TRUE;
// avoid popping up again
}
@@ -965,11 +965,11 @@ bool QComboView::eventFilter( QObject *object, QEvent *event )
return TRUE;
}
break;
- case QEvent::KeyPress:
- switch( ((QKeyEvent *)event)->key() ) {
+ case TQEvent::KeyPress:
+ switch( ((TQKeyEvent *)event)->key() ) {
case Key_Up:
case Key_Down:
- if ( !(((QKeyEvent *)event)->state() & AltButton) )
+ if ( !(((TQKeyEvent *)event)->state() & AltButton) )
break;
case Key_F4:
case Key_Escape:
@@ -986,14 +986,14 @@ bool QComboView::eventFilter( QObject *object, QEvent *event )
break;
}
break;
- case QEvent::Hide:
+ case TQEvent::Hide:
popDownListView();
break;
default:
break;
}
}
- return QWidget::eventFilter( object, event );
+ return TQWidget::eventFilter( object, event );
}
@@ -1003,10 +1003,10 @@ bool QComboView::eventFilter( QObject *object, QEvent *event )
items start with \a prefix.
*/
-QListViewItem *QComboView::completionIndex( const QString & prefix,
- QListViewItem *startingAt ) const
+TQListViewItem *QComboView::completionIndex( const TQString & prefix,
+ TQListViewItem *startingAt ) const
{
- QListViewItem *start = startingAt;
+ TQListViewItem *start = startingAt;
/* if ( start < 0 || start >= count() )
start = 0;
if ( start >= count() )
@@ -1017,12 +1017,12 @@ QListViewItem *QComboView::completionIndex( const QString & prefix,
return 0;
/* if (!start->itemBelow())
return 0;*/
- QString match = prefix.lower();
+ TQString match = prefix.lower();
if ( match.length() < 1 )
return start;
- QString current;
- QListViewItem *i = start;
+ TQString current;
+ TQListViewItem *i = start;
do {
current = i->text(0).lower();
if ( current.startsWith( match ) )
@@ -1077,12 +1077,12 @@ void QComboView::setInsertionPolicy( Policy policy )
void QComboView::returnPressed()
{
- QString s( d->ed->text() );
+ TQString s( d->ed->text() );
if ( s.isEmpty() )
return;
- QListViewItem *c = 0;
+ TQListViewItem *c = 0;
bool doInsert = TRUE;
if ( !d->duplicatesEnabled ) {
c = listView()->findItem(s, 0);
@@ -1113,11 +1113,11 @@ void QComboView::returnPressed()
return;
// break;
case AtBottom:
- c = new QListViewItem(listView(), listView()->lastItem(), s);
+ c = new TQListViewItem(listView(), listView()->lastItem(), s);
break;
case BeforeCurrent:
if (currentItem() && currentItem()->itemAbove())
- c = new QListViewItem(listView(), currentItem()->itemAbove(), s);
+ c = new TQListViewItem(listView(), currentItem()->itemAbove(), s);
else
{
c = 0;
@@ -1126,7 +1126,7 @@ void QComboView::returnPressed()
break;
case AfterCurrent:
if (currentItem() && currentItem()->itemBelow())
- c = new QListViewItem(listView(), currentItem()->itemBelow(), s);
+ c = new TQListViewItem(listView(), currentItem()->itemBelow(), s);
else
{
c = 0;
@@ -1150,7 +1150,7 @@ void QComboView::returnPressed()
void QComboView::setEnabled( bool enable )
{
- QWidget::setEnabled( enable );
+ TQWidget::setEnabled( enable );
}
@@ -1164,7 +1164,7 @@ void QComboView::setEnabled( bool enable )
\sa validator() clearValidator() QValidator
*/
-void QComboView::setValidator( const QValidator * v )
+void QComboView::setValidator( const TQValidator * v )
{
if ( d && d->ed )
d->ed->setValidator( v );
@@ -1178,7 +1178,7 @@ void QComboView::setValidator( const QValidator * v )
\sa setValidator() clearValidator() QValidator
*/
-const QValidator * QComboView::validator() const
+const TQValidator * QComboView::validator() const
{
return d && d->ed ? d->ed->validator() : 0;
}
@@ -1205,19 +1205,19 @@ void QComboView::clearValidator()
necessary because of the line edit in QComboView.
*/
-void QComboView::setListView( QListView * newListView )
+void QComboView::setListView( TQListView * newListView )
{
clear();
delete d->listView();
- newListView->reparent( this, WType_Popup, QPoint(0,0), FALSE );
+ newListView->reparent( this, WType_Popup, TQPoint(0,0), FALSE );
d->setListView( newListView );
d->listView()->setFont( font() );
d->listView()->setPalette( palette() );
-/* d->listView()->setVScrollBarMode(QScrollView::AlwaysOff);
- d->listView()->setHScrollBarMode(QScrollView::AlwaysOff);*/
- d->listView()->setFrameStyle( QFrame::Box | QFrame::Plain );
+/* d->listView()->setVScrollBarMode(TQScrollView::AlwaysOff);
+ d->listView()->setHScrollBarMode(TQScrollView::AlwaysOff);*/
+ d->listView()->setFrameStyle( TQFrame::Box | TQFrame::Plain );
d->listView()->setLineWidth( 1 );
/* d->listView()->setRootIsDecorated( true );
d->listView()->setAllColumnsShowFocus(true);*/
@@ -1231,9 +1231,9 @@ void QComboView::setListView( QListView * newListView )
/* d->listView()->setFont( font() );
d->listView()->setPalette( palette() );
- d->listView()->setVScrollBarMode( QScrollView::AlwaysOff );
- d->listView()->setHScrollBarMode( QScrollView::AlwaysOff );
- d->listView()->setFrameStyle( QFrame::Box | QFrame::Plain );
+ d->listView()->setVScrollBarMode( TQScrollView::AlwaysOff );
+ d->listView()->setHScrollBarMode( TQScrollView::AlwaysOff );
+ d->listView()->setFrameStyle( TQFrame::Box | TQFrame::Plain );
d->listView()->setLineWidth( 1 );
d->listView()->setRootIsDecorated( true );
d->listView()->setAllColumnsShowFocus(true);
@@ -1241,28 +1241,28 @@ void QComboView::setListView( QListView * newListView )
d->listView()->resize( 100, 10 );
*/
- connect( d->listView(), SIGNAL(returnPressed(QListViewItem*)),
- SLOT(internalActivate(QListViewItem*)));
- connect( d->listView(), SIGNAL(doubleClicked(QListViewItem*)),
- SLOT(internalActivate(QListViewItem*)));
- connect( d->listView(), SIGNAL(doubleClicked(QListViewItem*)),
- SLOT(checkState(QListViewItem*)));
- connect( d->listView(), SIGNAL(currentChanged(QListViewItem*)),
- SLOT(internalHighlight(QListViewItem*)));
- connect( d->listView(), SIGNAL(selectionChanged(QListViewItem*)),
- SLOT(internalHighlight(QListViewItem*)));
+ connect( d->listView(), TQT_SIGNAL(returnPressed(TQListViewItem*)),
+ TQT_SLOT(internalActivate(TQListViewItem*)));
+ connect( d->listView(), TQT_SIGNAL(doubleClicked(TQListViewItem*)),
+ TQT_SLOT(internalActivate(TQListViewItem*)));
+ connect( d->listView(), TQT_SIGNAL(doubleClicked(TQListViewItem*)),
+ TQT_SLOT(checkState(TQListViewItem*)));
+ connect( d->listView(), TQT_SIGNAL(currentChanged(TQListViewItem*)),
+ TQT_SLOT(internalHighlight(TQListViewItem*)));
+ connect( d->listView(), TQT_SIGNAL(selectionChanged(TQListViewItem*)),
+ TQT_SLOT(internalHighlight(TQListViewItem*)));
}
/*!
Returns the current list box, or 0 if there is no list box.
- (QComboView can use QPopupMenu instead of QListBox.) Provided to
+ (QComboView can use TQPopupMenu instead of TQListBox.) Provided to
match setlistView().
\sa setlistView()
*/
-QListView * QComboView::listView() const
+TQListView * QComboView::listView() const
{
return d ? d->listView() : 0;
}
@@ -1272,7 +1272,7 @@ QListView * QComboView::listView() const
Only editable listboxes have a line editor.
*/
-QLineEdit* QComboView::lineEdit() const
+TQLineEdit* QComboView::lineEdit() const
{
return d->ed;
}
@@ -1309,7 +1309,7 @@ void QComboView::clearEdit()
\sa clearEdit() insertItem()
*/
-void QComboView::setEditText( const QString &newText )
+void QComboView::setEditText( const TQString &newText )
{
if ( d && d->ed ) {
d->updateLinedGeometry();
@@ -1331,12 +1331,12 @@ bool QComboView::autoCompletion() const
/*!reimp
*/
-void QComboView::styleChange( QStyle& s )
+void QComboView::styleChange( TQStyle& s )
{
- d->sizeHint = QSize(); // invalidate size hint...
+ d->sizeHint = TQSize(); // invalidate size hint...
if ( d->ed )
d->updateLinedGeometry();
- QWidget::styleChange( s );
+ TQWidget::styleChange( s );
}
bool QComboView::editable() const
@@ -1367,49 +1367,49 @@ void QComboView::setEditable( bool y )
void QComboView::setUpListView()
{
- d->setListView( new QListView( this, "in-combo", WType_Popup ) );
+ d->setListView( new TQListView( this, "in-combo", WType_Popup ) );
d->listView()->setFont( font() );
d->listView()->setPalette( palette() );
-/* d->listView()->setVScrollBarMode( QScrollView::AlwaysOff );
- d->listView()->setHScrollBarMode( QScrollView::AlwaysOff );*/
- d->listView()->setFrameStyle( QFrame::Box | QFrame::Plain );
+/* d->listView()->setVScrollBarMode( TQScrollView::AlwaysOff );
+ d->listView()->setHScrollBarMode( TQScrollView::AlwaysOff );*/
+ d->listView()->setFrameStyle( TQFrame::Box | TQFrame::Plain );
d->listView()->setLineWidth( 1 );
d->listView()->setRootIsDecorated( false );
d->listView()->setAllColumnsShowFocus(true);
d->listView()->addColumn("");
d->listView()->resize( 100, 10 );
- d->listView()->setResizeMode(QListView::LastColumn);
+ d->listView()->setResizeMode(TQListView::LastColumn);
if (d->listView()->firstChild())
d->current = d->listView()->firstChild();
d->listView()->header()->hide();
- connect( d->listView(), SIGNAL(returnPressed(QListViewItem*)),
- SLOT(internalActivate(QListViewItem*)));
- connect( d->listView(), SIGNAL(doubleClicked(QListViewItem*)),
- SLOT(internalActivate(QListViewItem*)));
- connect( d->listView(), SIGNAL(doubleClicked(QListViewItem*)),
- SLOT(checkState(QListViewItem*)));
- connect( d->listView(), SIGNAL(currentChanged(QListViewItem*)),
- SLOT(internalHighlight(QListViewItem*)));
- connect( d->listView(), SIGNAL(selectionChanged(QListViewItem*)),
- SLOT(internalHighlight(QListViewItem*)));
+ connect( d->listView(), TQT_SIGNAL(returnPressed(TQListViewItem*)),
+ TQT_SLOT(internalActivate(TQListViewItem*)));
+ connect( d->listView(), TQT_SIGNAL(doubleClicked(TQListViewItem*)),
+ TQT_SLOT(internalActivate(TQListViewItem*)));
+ connect( d->listView(), TQT_SIGNAL(doubleClicked(TQListViewItem*)),
+ TQT_SLOT(checkState(TQListViewItem*)));
+ connect( d->listView(), TQT_SIGNAL(currentChanged(TQListViewItem*)),
+ TQT_SLOT(internalHighlight(TQListViewItem*)));
+ connect( d->listView(), TQT_SIGNAL(selectionChanged(TQListViewItem*)),
+ TQT_SLOT(internalHighlight(TQListViewItem*)));
}
void QComboView::setUpLineEdit()
{
if ( !d->ed )
- setLineEdit( new QLineEdit( this, "combo edit" ) );
+ setLineEdit( new TQLineEdit( this, "combo edit" ) );
}
/*!
Sets the line edit to use \a edit instead of the current line edit.
*/
-void QComboView::setLineEdit( QLineEdit *edit )
+void QComboView::setLineEdit( TQLineEdit *edit )
{
if ( !edit ) {
#if defined(QT_CHECK_NULL)
@@ -1431,13 +1431,13 @@ void QComboView::setLineEdit( QLineEdit *edit )
d->ed = edit;
if ( edit->parent() != this ) {
- edit->reparent( this, QPoint(0,0), FALSE );
+ edit->reparent( this, TQPoint(0,0), FALSE );
edit->setFont( font() );
}
- connect (edit, SIGNAL( textChanged( const QString& ) ),
- this, SIGNAL( textChanged( const QString& ) ) );
- connect( edit, SIGNAL(returnPressed()), SLOT(returnPressed()) );
+ connect (edit, TQT_SIGNAL( textChanged( const TQString& ) ),
+ this, TQT_SIGNAL( textChanged( const TQString& ) ) );
+ connect( edit, TQT_SIGNAL(returnPressed()), TQT_SLOT(returnPressed()) );
edit->setFrame( FALSE );
d->updateLinedGeometry();
@@ -1454,9 +1454,9 @@ void QComboView::setLineEdit( QLineEdit *edit )
update();
}
-void QComboView::setCurrentText( const QString& txt )
+void QComboView::setCurrentText( const TQString& txt )
{
- QListViewItem *i;
+ TQListViewItem *i;
i = listView()->findItem(txt, 0);
if ( i )
setCurrentItem( i );
@@ -1466,12 +1466,12 @@ void QComboView::setCurrentText( const QString& txt )
currentItem()->setText(0, txt);
}
-void QComboView::checkState( QListViewItem * item)
+void QComboView::checkState( TQListViewItem * item)
{
item->setOpen(!item->isOpen());
}
-void QComboView::setCurrentActiveItem( QListViewItem * item )
+void QComboView::setCurrentActiveItem( TQListViewItem * item )
{
if ( item == d->current && !d->ed ) {
return;