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.cpp148
1 files changed, 74 insertions, 74 deletions
diff --git a/lib/widgets/qcomboview.cpp b/lib/widgets/qcomboview.cpp
index 800eec47..eea88588 100644
--- a/lib/widgets/qcomboview.cpp
+++ b/lib/widgets/qcomboview.cpp
@@ -15,7 +15,7 @@
#include "qcomboview.h"
#include <kdeversion.h>
-#ifndef QT_NO_COMBOBOX
+#ifndef TQT_NO_COMBOBOX
#include "tqpopupmenu.h"
#include "tqlistview.h"
#include "tqpainter.h"
@@ -26,7 +26,7 @@
#include "tqapplication.h"
#include "tqlineedit.h"
#include "tqbitmap.h"
-#include "private/qeffects_p.h"
+#include "private/tqeffects_p.h"
#include "tqstringlist.h"
#include "tqcombobox.h"
#include "tqstyle.h"
@@ -39,7 +39,7 @@ public:
QComboViewData( QComboView *cb ): current(0), lView( 0 ), combo( cb )
{
duplicatesEnabled = TRUE;
- cb->setSizePolicy( TQSizePolicy( TQSizePolicy::Minimum, TQSizePolicy::Fixed ) );
+ cb->tqsetSizePolicy( TQSizePolicy( TQSizePolicy::Minimum, TQSizePolicy::Fixed ) );
}
inline TQListView * listView() { return lView; }
@@ -68,7 +68,7 @@ public:
TQLineEdit * ed; // /bin/ed rules!
TQTimer *completionTimer;
- TQSize sizeHint;
+ TQSize tqsizeHint;
private:
bool usinglView;
@@ -81,14 +81,14 @@ void QComboViewData::updateLinedGeometry()
{
if ( !ed || !combo )
return;
- TQRect r = TQStyle::visualRect( combo->style().querySubControlMetrics(TQStyle::CC_ComboBox, combo,
+ TQRect r = TQStyle::tqvisualRect( combo->tqstyle().querySubControlMetrics(TQStyle::CC_ComboBox, combo,
TQStyle::SC_ComboBoxEditField), combo );
// qWarning("updateLinedGeometry(): currentItem is %d", combo->currentItem() == 0 ? 0 : 1);
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() )
+ if ( r != ed->tqgeometry() )
ed->setGeometry( r );
}
@@ -96,7 +96,7 @@ static inline bool checkInsertIndex( const char *method, const char * name,
int count, int *index)
{
bool range_err = (*index > count);
-#if defined(QT_CHECK_RANGE)
+#if defined(TQT_CHECK_RANGE)
if ( range_err )
qWarning( "QComboView::%s: (%s) Index %d out of range",
method, name ? name : "<no name>", *index );
@@ -114,7 +114,7 @@ static inline bool checkIndex( const char *method, const char * name,
int count, int index )
{
bool range_err = (index >= count);
-#if defined(QT_CHECK_RANGE)
+#if defined(TQT_CHECK_RANGE)
if ( range_err )
qWarning( "QComboView::%s: (%s) Index %i out of range",
method, name ? name : "<no name>", index );
@@ -133,13 +133,13 @@ static inline bool checkIndex( const char *method, const char * name,
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 QWidget
+ The \a tqparent and \a name arguments are passed on to the TQWidget
constructor.
*/
-QComboView::QComboView( bool rw, TQWidget *parent, const char *name )
- : TQWidget( parent, name, WResizeNoErase )
+QComboView::QComboView( bool rw, TQWidget *tqparent, const char *name )
+ : TQWidget( tqparent, name, WResizeNoErase )
{
d = new QComboViewData( this );
setUpListView();
@@ -158,7 +158,7 @@ QComboView::QComboView( bool rw, TQWidget *parent, const char *name )
d->completeNow = FALSE;
d->completionTimer = new TQTimer( this );
- setFocusPolicy( StrongFocus );
+ setFocusPolicy( TQ_StrongFocus );
d->ed = 0;
if ( rw )
@@ -204,7 +204,7 @@ void QComboView::clear()
d->current = 0;
if ( d->ed ) {
- d->ed->setText( TQString::fromLatin1("") );
+ d->ed->setText( TQString::tqfromLatin1("") );
d->updateLinedGeometry();
}
currentChanged();
@@ -269,20 +269,20 @@ void QComboView::setAutoResize( bool enable )
reimp
This implementation caches the size hint to avoid resizing when
- the contents change dynamically. To invalidate the cached value
+ the contents change dynamically. To tqinvalidate the cached value
call setFont().
*/
-TQSize QComboView::sizeHint() const
+TQSize QComboView::tqsizeHint() const
{
- if ( isVisible() && d->sizeHint.isValid() )
- return d->sizeHint;
+ if ( isVisible() && d->tqsizeHint.isValid() )
+ return d->tqsizeHint;
constPolish();
// int i, w;
TQFontMetrics fm = fontMetrics();
int maxW = childCount() ? 18 : 7 * fm.width(TQChar('x')) + 18;
- int maxH = QMAX( fm.lineSpacing(), 14 ) + 2;
+ int maxH = TQMAX( fm.lineSpacing(), 14 ) + 2;
/* for( i = 0; i < count(); i++ ) {
w = d->listView()->item( i )->width( d->listView() );
@@ -290,10 +290,10 @@ TQSize QComboView::sizeHint() const
maxW = w;
}
*/
- d->sizeHint = (style().sizeFromContents(TQStyle::CT_ComboBox, this,
+ d->tqsizeHint = (tqstyle().tqsizeFromContents(TQStyle::CT_ComboBox, this,
TQSize(maxW, maxH)).expandedTo(TQApplication::globalStrut()));
- return d->sizeHint;
+ return d->tqsizeHint;
}
@@ -385,7 +385,7 @@ void QComboView::setPalette( const TQPalette &palette )
void QComboView::setFont( const TQFont &font )
{
- d->sizeHint = TQSize(); // invalidate size hint
+ d->tqsizeHint = TQSize(); // tqinvalidate size hint
TQWidget::setFont( font );
d->listView()->setFont( font );
if (d->ed)
@@ -412,7 +412,7 @@ void QComboView::resizeEvent( TQResizeEvent * e )
void QComboView::paintEvent( TQPaintEvent * )
{
TQPainter p( this );
- const TQColorGroup & g = colorGroup();
+ const TQColorGroup & g = tqcolorGroup();
p.setPen(g.text());
TQStyle::SFlags flags = TQStyle::Style_Default;
@@ -428,31 +428,31 @@ void QComboView::paintEvent( TQPaintEvent * )
}
// bool reverse = TQApplication::reverseLayout();
- style().drawComplexControl( TQStyle::CC_ComboBox, &p, this, rect(), g,
+ tqstyle().tqdrawComplexControl( TQStyle::CC_ComboBox, &p, this, rect(), g,
flags, TQStyle::SC_All,
(d->arrowDown ?
TQStyle::SC_ComboBoxArrow :
TQStyle::SC_None ));
- TQRect re = style().querySubControlMetrics( TQStyle::CC_ComboBox, this,
+ TQRect re = tqstyle().querySubControlMetrics( TQStyle::CC_ComboBox, this,
TQStyle::SC_ComboBoxEditField );
- re = TQStyle::visualRect(re, this);
+ re = TQStyle::tqvisualRect(re, this);
p.setClipRect( re );
if ( !d->ed ) {
TQListViewItem * item = d->current;
if ( item ) {
- // we calculate the QListBoxTexts height (ignoring strut)
+ // we calculate the TQListBoxTexts height (ignoring strut)
int itemh = d->listView()->fontMetrics().lineSpacing() + 2;
p.translate( re.x(), re.y() + (re.height() - itemh)/2 );
- item->paintCell( &p, d->listView()->colorGroup(), 0, width(), AlignLeft | AlignVCenter );
+ item->paintCell( &p, d->listView()->tqcolorGroup(), 0, width(), AlignLeft | AlignVCenter );
}
} else if ( d->listView() && d->listView()->currentItem( ) && d->current ) {
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( TQColorGroup::Base ) );
+ tqcolorGroup().brush( TQColorGroup::Base ) );
p.drawPixmap( re.x() + 2, re.y() +
( re.height() - pix->height() ) / 2, *pix );
}
@@ -466,30 +466,30 @@ void QComboView::paintEvent( TQPaintEvent * )
void QComboView::mousePressEvent( TQMouseEvent *e )
{
- if ( e->button() != LeftButton )
+ if ( e->button() != Qt::LeftButton )
return;
if ( d->discardNextMousePress ) {
d->discardNextMousePress = FALSE;
return;
}
- TQRect arrowRect = style().querySubControlMetrics( TQStyle::CC_ComboBox, this,
+ TQRect arrowRect = tqstyle().querySubControlMetrics( TQStyle::CC_ComboBox, this,
TQStyle::SC_ComboBoxArrow);
- arrowRect = TQStyle::visualRect(arrowRect, this);
+ arrowRect = TQStyle::tqvisualRect(arrowRect, this);
// Correction for motif style, where arrow is smaller
// and thus has a rect that doesn't fit the button.
- arrowRect.setHeight( QMAX( height() - (2 * arrowRect.y()), arrowRect.height() ) );
+ arrowRect.setHeight( TQMAX( height() - (2 * arrowRect.y()), arrowRect.height() ) );
- if ( childCount() && ( !editable() || arrowRect.contains( e->pos() ) ) ) {
+ if ( childCount() && ( !editable() || arrowRect.tqcontains( e->pos() ) ) ) {
d->arrowPressed = FALSE;
listView()->blockSignals( TRUE );
- qApp->sendEvent( listView(), e ); // trigger the listbox's autoscroll
+ tqApp->sendEvent( listView(), e ); // trigger the listbox's autoscroll
listView()->blockSignals( FALSE );
popup();
- if ( arrowRect.contains( e->pos() ) ) {
+ if ( arrowRect.tqcontains( e->pos() ) ) {
d->arrowPressed = TRUE;
d->arrowDown = TRUE;
- repaint( FALSE );
+ tqrepaint( FALSE );
}
TQTimer::singleShot( 200, this, TQT_SLOT(internalClickTimeout()));
d->shortClick = TRUE;
@@ -604,7 +604,7 @@ TQString QComboView::currentText() const
else if ( d->current )
return currentItem()->text(0);
else
- return TQString::null;
+ return TQString();
}
/*!reimp
@@ -689,23 +689,23 @@ int childCount(TQListView *lv)
static int listHeight( TQListView *l, int /*sl*/ )
{
/* if ( l->childCount() > 0 )
- return QMIN( l->childCount(), (uint)sl) * l->firstChild()->height();
+ return TQMIN( l->childCount(), (uint)sl) * l->firstChild()->height();
else*/
int prefH = 0;
int ch = childCount(l);
- ch = QMIN(ch, 10);
+ ch = TQMIN(ch, 10);
if (l->firstChild())
{
prefH = ch * l->firstChild()->height();
}
else
- prefH = l->sizeHint().height();
+ prefH = l->tqsizeHint().height();
if (l->header()->isVisible())
- prefH += l->header()->sizeHint().height();
+ prefH += l->header()->tqsizeHint().height();
-// return prefH < l->sizeHint().height() ? prefH : l->sizeHint().height();
+// return prefH < l->tqsizeHint().height() ? prefH : l->tqsizeHint().height();
return prefH+2;
}
@@ -727,7 +727,7 @@ void QComboView::popup()
lb->installEventFilter( this );
lb->viewport()->installEventFilter( this );
d->mouseWasInsidePopup = FALSE;
-// int w = lb->variableWidth() ? lb->sizeHint().width() : width();
+// int w = lb->variableWidth() ? lb->tqsizeHint().width() : width();
int w = width();
int h = listHeight( lb, d->sizeLimit );
TQRect screen = TQApplication::desktop()->availableGeometry( const_cast<QComboView*>(this) );
@@ -737,7 +737,7 @@ void QComboView::popup()
int sw = screen.width(); // screen width
int sh = screen.height(); // screen height
TQPoint pos = mapToGlobal( TQPoint(0,height()) );
- // ## Similar code is in QPopupMenu
+ // ## Similar code is in TQPopupMenu
int x = pos.x();
int y = pos.y();
@@ -749,7 +749,7 @@ void QComboView::popup()
if (y + h > sy+sh && y - h - height() >= 0 )
y = y - h - height();
TQRect rect =
- style().querySubControlMetrics( TQStyle::CC_ComboBox, this,
+ tqstyle().querySubControlMetrics( TQStyle::CC_ComboBox, this,
TQStyle::SC_ComboBoxListBoxPopup,
TQStyleOption( x, y, w, h ) );
if ( rect.isNull() )
@@ -767,10 +767,10 @@ void QComboView::popup()
lb->blockSignals( block );
lb->setVScrollBarMode(TQScrollView::Auto);
-//#ifndef QT_NO_EFFECTS
+//#ifndef TQT_NO_EFFECTS
/* if ( TQApplication::isEffectEnabled( UI_AnimateCombo ) ) {
if ( lb->y() < mapToGlobal(TQPoint(0,0)).y() )
- qScrollEffect( lb, QEffects::UpScroll );
+ qScrollEffect( lb, TQEffects::UpScroll );
else
qScrollEffect( lb );
} else*/
@@ -790,7 +790,7 @@ void QComboView::updateMask()
{
TQPainter p( &bm, this );
- style().drawComplexControlMask(TQStyle::CC_ComboBox, &p, this, rect());
+ tqstyle().tqdrawComplexControlMask(TQStyle::CC_ComboBox, &p, this, rect());
}
setMask( bm );
@@ -808,7 +808,7 @@ void QComboView::popDownListView()
d->listView()->setCurrentItem( d->current );
if ( d->arrowDown ) {
d->arrowDown = FALSE;
- repaint( FALSE );
+ tqrepaint( FALSE );
}
d->poppedUp = FALSE;
}
@@ -850,7 +850,7 @@ bool QComboView::eventFilter( TQObject *object, TQEvent *event )
{
if ( !event )
return TRUE;
- else if ( object == d->ed ) {
+ else if ( TQT_BASE_OBJECT(object) == TQT_BASE_OBJECT(d->ed) ) {
if ( event->type() == TQEvent::KeyPress ) {
bool isAccepted = ( (TQKeyEvent*)event )->isAccepted();
keyPressEvent( (TQKeyEvent *)event );
@@ -887,38 +887,38 @@ bool QComboView::eventFilter( TQObject *object, TQEvent *event )
}
}
}
- } else if ( ( object == d->listView() ||
- object == d->listView()->viewport() )) {
+ } else if ( ( TQT_BASE_OBJECT(object) == TQT_BASE_OBJECT(d->listView()) ||
+ TQT_BASE_OBJECT(object) == TQT_BASE_OBJECT(d->listView()->viewport()) )) {
TQMouseEvent *e = (TQMouseEvent*)event;
switch( event->type() ) {
case TQEvent::MouseMove:
if ( !d->mouseWasInsidePopup ) {
// qWarning("!d->mouseWasInsidePopup");
TQPoint pos = e->pos();
- if ( d->listView()->rect().contains( pos ) )
+ if ( TQT_TQRECT_OBJECT(d->listView()->rect()).tqcontains( pos ) )
d->mouseWasInsidePopup = TRUE;
// Check if arrow button should toggle
if ( d->arrowPressed ) {
TQPoint comboPos;
comboPos = mapFromGlobal( d->listView()->mapToGlobal(pos) );
TQRect arrowRect =
- style().querySubControlMetrics( TQStyle::CC_ComboBox, this,
+ tqstyle().querySubControlMetrics( TQStyle::CC_ComboBox, this,
TQStyle::SC_ComboBoxArrow);
- arrowRect = TQStyle::visualRect(arrowRect, this);
- if ( arrowRect.contains( comboPos ) ) {
+ arrowRect = TQStyle::tqvisualRect(arrowRect, this);
+ if ( arrowRect.tqcontains( comboPos ) ) {
if ( !d->arrowDown ) {
d->arrowDown = TRUE;
- repaint( FALSE );
+ tqrepaint( FALSE );
}
} else {
if ( d->arrowDown ) {
d->arrowDown = FALSE;
- repaint( FALSE );
+ tqrepaint( FALSE );
}
}
}
- } else if ((e->state() & ( RightButton | LeftButton | MidButton ) ) == 0 &&
- style().styleHint(TQStyle::SH_ComboBox_ListMouseTracking, this)) {
+ } else if ((e->state() & ( Qt::RightButton | Qt::LeftButton | Qt::MidButton ) ) == 0 &&
+ tqstyle().tqstyleHint(TQStyle::SH_ComboBox_ListMouseTracking, this)) {
// qWarning("event filter:: emu");
TQWidget *mouseW = TQApplication::widgetAt( e->globalPos(), TRUE );
// if ( mouseW == d->listView()->viewport() ) { //###
@@ -935,7 +935,7 @@ bool QComboView::eventFilter( TQObject *object, TQEvent *event )
break;
case TQEvent::MouseButtonRelease:
- if ( d->listView()->rect().contains( e->pos() ) ) {
+ if ( TQT_TQRECT_OBJECT(d->listView()->rect()).tqcontains( e->pos() ) ) {
TQMouseEvent tmp( TQEvent::MouseButtonDblClick,
e->pos(), e->button(), e->state() ) ;
// will hide popup
@@ -948,14 +948,14 @@ bool QComboView::eventFilter( TQObject *object, TQEvent *event )
d->arrowPressed = FALSE;
if ( d->arrowDown ) {
d->arrowDown = FALSE;
- repaint( FALSE );
+ tqrepaint( FALSE );
}
}
}
break;
case TQEvent::MouseButtonDblClick:
case TQEvent::MouseButtonPress:
- if ( !d->listView()->rect().contains( e->pos() ) ) {
+ if ( !TQT_TQRECT_OBJECT(d->listView()->rect()).tqcontains( e->pos() ) ) {
TQPoint globalPos = d->listView()->mapToGlobal(e->pos());
if ( TQApplication::widgetAt( globalPos, TRUE ) == this ) {
d->discardNextMousePress = TRUE;
@@ -980,7 +980,7 @@ bool QComboView::eventFilter( TQObject *object, TQEvent *event )
break;
case Key_Enter:
case Key_Return:
- // work around QDialog's enter handling
+ // work around TQDialog's enter handling
return FALSE;
default:
break;
@@ -1085,7 +1085,7 @@ void QComboView::returnPressed()
TQListViewItem *c = 0;
bool doInsert = TRUE;
if ( !d->duplicatesEnabled ) {
- c = listView()->findItem(s, 0);
+ c = listView()->tqfindItem(s, 0);
if ( c )
doInsert = FALSE;
}
@@ -1161,7 +1161,7 @@ void QComboView::setEnabled( bool enable )
This function does nothing if the combobox is not editable.
- \sa validator() clearValidator() QValidator
+ \sa validator() clearValidator() TQValidator
*/
void QComboView::setValidator( const TQValidator * v )
@@ -1175,7 +1175,7 @@ void QComboView::setValidator( const TQValidator * v )
Returns the validator which constrains editing for this combobox
if there is one; otherwise returns 0.
- \sa setValidator() clearValidator() QValidator
+ \sa setValidator() clearValidator() TQValidator
*/
const TQValidator * QComboView::validator() const
@@ -1333,7 +1333,7 @@ bool QComboView::autoCompletion() const
*/
void QComboView::styleChange( TQStyle& s )
{
- d->sizeHint = TQSize(); // invalidate size hint...
+ d->tqsizeHint = TQSize(); // tqinvalidate size hint...
if ( d->ed )
d->updateLinedGeometry();
TQWidget::styleChange( s );
@@ -1359,7 +1359,7 @@ void QComboView::setEditable( bool y )
d->ed = 0;
}
- setFocusPolicy( StrongFocus );
+ setFocusPolicy( TQ_StrongFocus );
updateGeometry();
update();
}
@@ -1412,7 +1412,7 @@ void QComboView::setUpLineEdit()
void QComboView::setLineEdit( TQLineEdit *edit )
{
if ( !edit ) {
-#if defined(QT_CHECK_NULL)
+#if defined(TQT_CHECK_NULL)
Q_ASSERT( edit != 0 );
#endif
return;
@@ -1430,7 +1430,7 @@ void QComboView::setLineEdit( TQLineEdit *edit )
d->ed = edit;
- if ( edit->parent() != this ) {
+ if ( TQT_BASE_OBJECT(edit->tqparent()) != TQT_BASE_OBJECT(this) ) {
edit->reparent( this, TQPoint(0,0), FALSE );
edit->setFont( font() );
}
@@ -1443,7 +1443,7 @@ void QComboView::setLineEdit( TQLineEdit *edit )
d->updateLinedGeometry();
edit->installEventFilter( this );
setFocusProxy( edit );
- setFocusPolicy( StrongFocus );
+ setFocusPolicy( TQ_StrongFocus );
setUpListView();
@@ -1457,7 +1457,7 @@ void QComboView::setLineEdit( TQLineEdit *edit )
void QComboView::setCurrentText( const TQString& txt )
{
TQListViewItem *i;
- i = listView()->findItem(txt, 0);
+ i = listView()->tqfindItem(txt, 0);
if ( i )
setCurrentItem( i );
else if ( d->ed )
@@ -1501,5 +1501,5 @@ void QComboView::setCurrentActiveItem( TQListViewItem * item )
#include "qcomboview.moc"
-#endif // QT_NO_COMBOBOX
+#endif // TQT_NO_COMBOBOX