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.cpp120
1 files changed, 60 insertions, 60 deletions
diff --git a/lib/widgets/qcomboview.cpp b/lib/widgets/qcomboview.cpp
index 625e4d25..4a940f0a 100644
--- a/lib/widgets/qcomboview.cpp
+++ b/lib/widgets/qcomboview.cpp
@@ -38,7 +38,7 @@ class QComboViewData
public:
QComboViewData( QComboView *cb ): current(0), lView( 0 ), combo( cb )
{
- duplicatesEnabled = TRUE;
+ duplicatesEnabled = true;
cb->setSizePolicy( TQSizePolicy( TQSizePolicy::Minimum, TQSizePolicy::Fixed ) );
}
@@ -46,7 +46,7 @@ public:
void updateLinedGeometry();
void setListView( TQListView *l ) { lView = l ;
- l->setMouseTracking( TRUE );}
+ l->setMouseTracking( true );}
TQListViewItem *current;
int maxCount;
@@ -130,7 +130,7 @@ static inline bool checkIndex( const char *method, const char * name,
Constructs a combobox with a maximum size and either Motif 2.0 or
Windows look and feel.
- The input field can be edited if \a rw is TRUE, otherwise the user
+ The input field can be edited if \a rw is true, otherwise the user
may only choose one of the items in the combobox.
The \a parent and \a name arguments are passed on to the TQWidget
@@ -148,14 +148,14 @@ QComboView::QComboView( bool rw, TQWidget *parent, const char *name )
d->maxCount = INT_MAX;
setSizeLimit(10);
d->p = AtBottom;
- d->autoresize = FALSE;
- d->poppedUp = FALSE;
- d->arrowDown = FALSE;
- d->discardNextMousePress = FALSE;
- d->shortClick = FALSE;
- d->useCompletion = FALSE;
+ d->autoresize = false;
+ d->poppedUp = false;
+ d->arrowDown = false;
+ d->discardNextMousePress = false;
+ d->shortClick = false;
+ d->useCompletion = false;
d->completeAt = 0;
- d->completeNow = FALSE;
+ d->completeNow = false;
d->completionTimer = new TQTimer( this );
setFocusPolicy( TQWidget::StrongFocus );
@@ -315,7 +315,7 @@ void QComboView::internalActivate( TQListViewItem * item )
return;
}
popDownListView();
- d->poppedUp = FALSE;
+ d->poppedUp = false;
d->current = item;
@@ -361,7 +361,7 @@ void QComboView::internalHighlight( TQListViewItem * item )
*/
void QComboView::internalClickTimeout()
{
- d->shortClick = FALSE;
+ d->shortClick = false;
}
/*!
@@ -422,7 +422,7 @@ void QComboView::paintEvent( TQPaintEvent * )
flags |= TQStyle::Style_HasFocus;
if ( width() < 5 || height() < 5 ) {
- qDrawShadePanel( &p, rect(), g, FALSE, 2,
+ qDrawShadePanel( &p, rect(), g, false, 2,
&g.brush( TQColorGroup::Button ) );
return;
}
@@ -457,7 +457,7 @@ void QComboView::paintEvent( TQPaintEvent * )
( re.height() - pix->height() ) / 2, *pix );
}
}
- p.setClipping( FALSE );
+ p.setClipping( false );
}
@@ -469,7 +469,7 @@ void QComboView::mousePressEvent( TQMouseEvent *e )
if ( e->button() != TQt::LeftButton )
return;
if ( d->discardNextMousePress ) {
- d->discardNextMousePress = FALSE;
+ d->discardNextMousePress = false;
return;
}
TQRect arrowRect = style().querySubControlMetrics( TQStyle::CC_ComboBox, this,
@@ -481,18 +481,18 @@ void QComboView::mousePressEvent( TQMouseEvent *e )
arrowRect.setHeight( TQMAX( height() - (2 * arrowRect.y()), arrowRect.height() ) );
if ( childCount() && ( !editable() || arrowRect.contains( e->pos() ) ) ) {
- d->arrowPressed = FALSE;
- listView()->blockSignals( TRUE );
+ d->arrowPressed = false;
+ listView()->blockSignals( true );
tqApp->sendEvent( listView(), e ); // trigger the listbox's autoscroll
- listView()->blockSignals( FALSE );
+ listView()->blockSignals( false );
popup();
if ( arrowRect.contains( e->pos() ) ) {
- d->arrowPressed = TRUE;
- d->arrowDown = TRUE;
- repaint( FALSE );
+ d->arrowPressed = true;
+ d->arrowDown = true;
+ repaint( false );
}
TQTimer::singleShot( 200, this, TQ_SLOT(internalClickTimeout()));
- d->shortClick = TRUE;
+ d->shortClick = true;
}
}
@@ -585,7 +585,7 @@ void QComboView::keyPressEvent( TQKeyEvent *e )
else
return;
}
- d->completionTimer->start( 400, TRUE );
+ d->completionTimer->start( 400, true );
} else {
e->ignore();
return;
@@ -613,7 +613,7 @@ TQString QComboView::currentText() const
void QComboView::focusInEvent( TQFocusEvent * e )
{
TQWidget::focusInEvent( e );
- d->completeNow = FALSE;
+ d->completeNow = false;
d->completeAt = 0;
emit focusGranted();
@@ -625,7 +625,7 @@ void QComboView::focusInEvent( TQFocusEvent * e )
void QComboView::focusOutEvent( TQFocusEvent * e )
{
TQWidget::focusOutEvent( e );
- d->completeNow = FALSE;
+ d->completeNow = false;
d->completeAt = 0;
emit focusLost();
@@ -726,7 +726,7 @@ void QComboView::popup()
lb->triggerUpdate( );
lb->installEventFilter( this );
lb->viewport()->installEventFilter( this );
- d->mouseWasInsidePopup = FALSE;
+ d->mouseWasInsidePopup = false;
// int w = lb->variableWidth() ? lb->sizeHint().width() : width();
int w = width();
int h = listHeight( lb, d->sizeLimit );
@@ -758,12 +758,12 @@ void QComboView::popup()
lb->raise();
bool block = lb->signalsBlocked();
- lb->blockSignals( TRUE );
+ lb->blockSignals( true );
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->setSelected( currentLBItem, true );
lb->blockSignals( block );
lb->setVScrollBarMode(TQScrollView::Auto);
@@ -776,7 +776,7 @@ void QComboView::popup()
} else*/
//#endif
lb->show();
- d->poppedUp = TRUE;
+ d->poppedUp = true;
}
@@ -807,10 +807,10 @@ void QComboView::popDownListView()
d->listView()->hide();
d->listView()->setCurrentItem( d->current );
if ( d->arrowDown ) {
- d->arrowDown = FALSE;
- repaint( FALSE );
+ d->arrowDown = false;
+ repaint( false );
}
- d->poppedUp = FALSE;
+ d->poppedUp = false;
}
@@ -849,16 +849,16 @@ void QComboView::currentChanged()
bool QComboView::eventFilter( TQObject *object, TQEvent *event )
{
if ( !event )
- return TRUE;
+ return true;
else if ( object == d->ed ) {
if ( event->type() == TQEvent::KeyPress ) {
bool isAccepted = ( (TQKeyEvent*)event )->isAccepted();
keyPressEvent( (TQKeyEvent *)event );
if ( ((TQKeyEvent *)event)->isAccepted() ) {
- d->completeNow = FALSE;
- return TRUE;
+ d->completeNow = false;
+ return true;
} else if ( ((TQKeyEvent *)event)->key() != Key_End ) {
- d->completeNow = TRUE;
+ d->completeNow = true;
d->completeAt = d->ed->cursorPosition();
}
if ( isAccepted )
@@ -866,7 +866,7 @@ bool QComboView::eventFilter( TQObject *object, TQEvent *event )
else
( (TQKeyEvent*)event )->ignore();
} else if ( event->type() == TQEvent::KeyRelease ) {
- d->completeNow = FALSE;
+ d->completeNow = false;
keyReleaseEvent( (TQKeyEvent *)event );
return ((TQKeyEvent *)event)->isAccepted();
} else if ( event->type() == TQEvent::FocusIn ) {
@@ -877,7 +877,7 @@ bool QComboView::eventFilter( TQObject *object, TQEvent *event )
if ( !d->ed->text().isNull() &&
d->ed->cursorPosition() > d->completeAt &&
d->ed->cursorPosition() == (int)d->ed->text().length() ) {
- d->completeNow = FALSE;
+ d->completeNow = false;
TQString ct( d->ed->text() );
TQListViewItem *i = completionIndex( ct, currentItem() );
if ( i ) {
@@ -896,7 +896,7 @@ bool QComboView::eventFilter( TQObject *object, TQEvent *event )
// tqWarning("!d->mouseWasInsidePopup");
TQPoint pos = e->pos();
if ( d->listView()->rect().contains( pos ) )
- d->mouseWasInsidePopup = TRUE;
+ d->mouseWasInsidePopup = true;
// Check if arrow button should toggle
if ( d->arrowPressed ) {
TQPoint comboPos;
@@ -907,20 +907,20 @@ bool QComboView::eventFilter( TQObject *object, TQEvent *event )
arrowRect = TQStyle::visualRect(arrowRect, this);
if ( arrowRect.contains( comboPos ) ) {
if ( !d->arrowDown ) {
- d->arrowDown = TRUE;
- repaint( FALSE );
+ d->arrowDown = true;
+ repaint( false );
}
} else {
if ( d->arrowDown ) {
- d->arrowDown = FALSE;
- repaint( FALSE );
+ d->arrowDown = false;
+ repaint( false );
}
}
}
} else if ((e->state() & ( TQt::RightButton | TQt::LeftButton | TQt::MidButton ) ) == 0 &&
style().styleHint(TQStyle::SH_ComboBox_ListMouseTracking, this)) {
// tqWarning("event filter:: emu");
- TQWidget *mouseW = TQApplication::widgetAt( e->globalPos(), TRUE );
+ TQWidget *mouseW = TQApplication::widgetAt( e->globalPos(), true );
// if ( mouseW == d->listView()->viewport() ) { //###
if ( mouseW == d->listView()->viewport() ) {
TQListViewItem *sel = d->listView()->itemAt(e->pos());
@@ -929,7 +929,7 @@ bool QComboView::eventFilter( TQObject *object, TQEvent *event )
d->listView()->setCurrentItem(sel);
d->listView()->setSelected(sel, true);
}
- return TRUE;
+ return true;
}
}
@@ -940,15 +940,15 @@ bool QComboView::eventFilter( TQObject *object, TQEvent *event )
e->pos(), e->button(), e->state() ) ;
// will hide popup
TQApplication::sendEvent( object, &tmp );
- return TRUE;
+ return true;
} else {
if ( d->mouseWasInsidePopup ) {
popDownListView();
} else {
- d->arrowPressed = FALSE;
+ d->arrowPressed = false;
if ( d->arrowDown ) {
- d->arrowDown = FALSE;
- repaint( FALSE );
+ d->arrowDown = false;
+ repaint( false );
}
}
}
@@ -957,12 +957,12 @@ bool QComboView::eventFilter( TQObject *object, TQEvent *event )
case TQEvent::MouseButtonPress:
if ( !d->listView()->rect().contains( e->pos() ) ) {
TQPoint globalPos = d->listView()->mapToGlobal(e->pos());
- if ( TQApplication::widgetAt( globalPos, TRUE ) == this ) {
- d->discardNextMousePress = TRUE;
+ if ( TQApplication::widgetAt( globalPos, true ) == this ) {
+ d->discardNextMousePress = true;
// avoid popping up again
}
popDownListView();
- return TRUE;
+ return true;
}
break;
case TQEvent::KeyPress:
@@ -975,13 +975,13 @@ bool QComboView::eventFilter( TQObject *object, TQEvent *event )
case Key_Escape:
if ( d->poppedUp ) {
popDownListView();
- return TRUE;
+ return true;
}
break;
case Key_Enter:
case Key_Return:
// work around TQDialog's enter handling
- return FALSE;
+ return false;
default:
break;
}
@@ -1083,11 +1083,11 @@ void QComboView::returnPressed()
return;
TQListViewItem *c = 0;
- bool doInsert = TRUE;
+ bool doInsert = true;
if ( !d->duplicatesEnabled ) {
c = listView()->findItem(s, 0);
if ( c )
- doInsert = FALSE;
+ doInsert = false;
}
if ( doInsert ) {
@@ -1211,7 +1211,7 @@ void QComboView::setListView( TQListView * newListView )
delete d->listView();
- newListView->reparent( this, WType_Popup, TQPoint(0,0), FALSE );
+ newListView->reparent( this, WType_Popup, TQPoint(0,0), false );
d->setListView( newListView );
d->listView()->setFont( font() );
d->listView()->setPalette( palette() );
@@ -1320,7 +1320,7 @@ void QComboView::setEditText( const TQString &newText )
void QComboView::setAutoCompletion( bool enable )
{
d->useCompletion = enable;
- d->completeNow = FALSE;
+ d->completeNow = false;
}
@@ -1431,7 +1431,7 @@ void QComboView::setLineEdit( TQLineEdit *edit )
d->ed = edit;
if ( edit->parent() != this ) {
- edit->reparent( this, TQPoint(0,0), FALSE );
+ edit->reparent( this, TQPoint(0,0), false );
edit->setFont( font() );
}
@@ -1439,7 +1439,7 @@ void QComboView::setLineEdit( TQLineEdit *edit )
this, TQ_SIGNAL( textChanged( const TQString& ) ) );
connect( edit, TQ_SIGNAL(returnPressed()), TQ_SLOT(returnPressed()) );
- edit->setFrame( FALSE );
+ edit->setFrame( false );
d->updateLinedGeometry();
edit->installEventFilter( this );
setFocusProxy( edit );