diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
commit | f008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch) | |
tree | 8e9244c4d4957c36be81e15b566b4aa5ea26c982 /kexi/plugins/forms/widgets/kexidbcombobox.cpp | |
parent | 1210f27b660efb7b37ff43ec68763e85a403471f (diff) | |
download | koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.tar.gz koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.zip |
TQt4 port koffice
This should enable compilation under both Qt3 and Qt4; fixes for any missed components will be forthcoming
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1238284 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kexi/plugins/forms/widgets/kexidbcombobox.cpp')
-rw-r--r-- | kexi/plugins/forms/widgets/kexidbcombobox.cpp | 248 |
1 files changed, 124 insertions, 124 deletions
diff --git a/kexi/plugins/forms/widgets/kexidbcombobox.cpp b/kexi/plugins/forms/widgets/kexidbcombobox.cpp index 19366a15..a908c2fd 100644 --- a/kexi/plugins/forms/widgets/kexidbcombobox.cpp +++ b/kexi/plugins/forms/widgets/kexidbcombobox.cpp @@ -25,12 +25,12 @@ #include <kdebug.h> #include <kapplication.h> -#include <qmetaobject.h> -#include <qpainter.h> -#include <qstyle.h> -#include <qdrawutil.h> -#include <qptrdict.h> -#include <qcursor.h> +#include <tqmetaobject.h> +#include <tqpainter.h> +#include <tqstyle.h> +#include <tqdrawutil.h> +#include <tqptrdict.h> +#include <tqcursor.h> #include <kexidb/queryschema.h> #include <widget/tableview/kexicomboboxpopup.h> @@ -58,11 +58,11 @@ class KexiDBComboBox::Private } KexiComboBoxPopup *popup; - KComboBox *paintedCombo; //!< fake combo used only to pass it as 'this' for QStyle (because styles use <static_cast>) - QSize sizeHint; //!< A cache for KexiDBComboBox::sizeHint(), + KComboBox *paintedCombo; //!< fake combo used only to pass it as 'this' for TQStyle (because styles use <static_cast>) + TQSize tqsizeHint; //!< A cache for KexiDBComboBox::tqsizeHint(), //!< rebuilt by KexiDBComboBox::fontChange() and KexiDBComboBox::styleChange() KexiDB::QueryColumnInfo* visibleColumnInfo; - QPtrDict<char> *subWidgetsWithDisabledEvents; //! used to collect subwidget and its children (if isEditable is false) + TQPtrDict<char> *subWidgetsWithDisabledEvents; //! used to collect subwidget and its tqchildren (if isEditable is false) bool isEditable : 1; //!< true is the combo box is editable bool buttonPressed : 1; bool mouseOver : 1; @@ -72,13 +72,13 @@ class KexiDBComboBox::Private //------------------------------------- -KexiDBComboBox::KexiDBComboBox(QWidget *parent, const char *name, bool designMode) - : KexiDBAutoField(parent, name, designMode, NoLabel) +KexiDBComboBox::KexiDBComboBox(TQWidget *tqparent, const char *name, bool designMode) + : KexiDBAutoField(tqparent, name, designMode, NoLabel) , KexiComboBoxBase() , d(new Private()) { setMouseTracking(true); - setFocusPolicy(WheelFocus); + setFocusPolicy(TQ_WheelFocus); installEventFilter(this); d->designMode = designMode; d->paintedCombo = new KComboBox(this); @@ -121,58 +121,58 @@ bool KexiDBComboBox::isEditable() const return d->isEditable; } -void KexiDBComboBox::paintEvent( QPaintEvent * ) +void KexiDBComboBox::paintEvent( TQPaintEvent * ) { - QPainter p( this ); - QColorGroup cg( palette().active() ); + TQPainter p( this ); + TQColorGroup cg( tqpalette().active() ); // if ( hasFocus() ) -// cg.setColor(QColorGroup::Base, cg.highlight()); +// cg.setColor(TQColorGroup::Base, cg.highlight()); // else - cg.setColor(QColorGroup::Base, paletteBackgroundColor()); //update base color using (reimplemented) bg color + cg.setColor(TQColorGroup::Base, paletteBackgroundColor()); //update base color using (reimplemented) bg color p.setPen(cg.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 (d->mouseOver) - flags |= QStyle::Style_MouseOver; + flags |= TQStyle::Style_MouseOver; if ( width() < 5 || height() < 5 ) { - qDrawShadePanel( &p, rect(), cg, FALSE, 2, &cg.brush( QColorGroup::Button ) ); + qDrawShadePanel( &p, rect(), cg, FALSE, 2, &cg.brush( TQColorGroup::Button ) ); return; } -//! @todo support reverse layout -//bool reverse = QApplication::reverseLayout(); - style().drawComplexControl( QStyle::CC_ComboBox, &p, d->paintedCombo /*this*/, rect(), cg, - flags, (uint)QStyle::SC_All, - (d->buttonPressed ? QStyle::SC_ComboBoxArrow : QStyle::SC_None ) +//! @todo support reverse tqlayout +//bool reverse = TQApplication::reverseLayout(); + tqstyle().tqdrawComplexControl( TQStyle::CC_ComboBox, &p, d->paintedCombo /*this*/, rect(), cg, + flags, (uint)TQStyle::SC_All, + (d->buttonPressed ? TQStyle::SC_ComboBoxArrow : TQStyle::SC_None ) ); if (d->isEditable) { //if editable, editor paints itself, nothing to do } else { //not editable: we need to paint the current item - QRect editorGeometry( this->editorGeometry() ); + TQRect editorGeometry( this->editorGeometry() ); if ( hasFocus() ) { - if (0==qstrcmp(style().name(), "windows")) //a hack - p.fillRect( editorGeometry, cg.brush( QColorGroup::Highlight ) ); - QRect r( QStyle::visualRect( style().subRect( QStyle::SR_ComboBoxFocusRect, d->paintedCombo ), this ) ); - r = QRect(r.left()-1, r.top()-1, r.width()+2, r.height()+2); //enlare by 1 pixel each side to avoid covering by the subwidget - style().drawPrimitive( QStyle::PE_FocusRect, &p, - r, cg, flags | QStyle::Style_FocusAtBorder, QStyleOption(cg.highlight())); + if (0==qstrcmp(tqstyle().name(), "windows")) //a hack + p.fillRect( editorGeometry, cg.brush( TQColorGroup::Highlight ) ); + TQRect r( TQStyle::tqvisualRect( tqstyle().subRect( TQStyle::SR_ComboBoxFocusRect, d->paintedCombo ), this ) ); + r = TQRect(r.left()-1, r.top()-1, r.width()+2, r.height()+2); //enlare by 1 pixel each side to avoid covering by the subwidget + tqstyle().tqdrawPrimitive( TQStyle::PE_FocusRect, &p, + r, cg, flags | TQStyle::Style_FocusAtBorder, TQStyleOption(cg.highlight())); } //todo } } -QRect KexiDBComboBox::editorGeometry() const +TQRect KexiDBComboBox::editorGeometry() const { - QRect r( QStyle::visualRect( - style().querySubControlMetrics(QStyle::CC_ComboBox, d->paintedCombo, - QStyle::SC_ComboBoxEditField), d->paintedCombo ) ); + TQRect r( TQStyle::tqvisualRect( + tqstyle().querySubControlMetrics(TQStyle::CC_ComboBox, d->paintedCombo, + TQStyle::SC_ComboBoxEditField), d->paintedCombo ) ); //if ((height()-r.bottom())<6) // r.setBottom(height()-6); @@ -185,20 +185,20 @@ void KexiDBComboBox::createEditor() if (m_subwidget) { m_subwidget->setGeometry( editorGeometry() ); if (!d->isEditable) { - m_subwidget->setCursor(QCursor(Qt::ArrowCursor)); // widgets like listedit have IbeamCursor, we don't want that -//! @todo Qt4: set transparent background, for now we're setting button color - QPalette subwidgetPalette( m_subwidget->palette() ); - subwidgetPalette.setColor(QPalette::Active, QColorGroup::Base, - subwidgetPalette.color(QPalette::Active, QColorGroup::Button)); + m_subwidget->setCursor(TQCursor(TQt::ArrowCursor)); // widgets like listedit have IbeamCursor, we don't want that +//! @todo TQt4: set transparent background, for now we're setting button color + TQPalette subwidgetPalette( m_subwidget->palette() ); + subwidgetPalette.setColor(TQPalette::Active, TQColorGroup::Base, + subwidgetPalette.color(TQPalette::Active, TQColorGroup::Button)); m_subwidget->setPalette( subwidgetPalette ); if (d->subWidgetsWithDisabledEvents) d->subWidgetsWithDisabledEvents->clear(); else - d->subWidgetsWithDisabledEvents = new QPtrDict<char>(); + d->subWidgetsWithDisabledEvents = new TQPtrDict<char>(); d->subWidgetsWithDisabledEvents->insert(m_subwidget, (char*)1); m_subwidget->installEventFilter(this); - QObjectList *l = m_subwidget->queryList( "QWidget" ); - for ( QObjectListIt it( *l ); it.current(); ++it ) { + TQObjectList *l = m_subwidget->queryList( TQWIDGET_OBJECT_NAME_STRING ); + for ( TQObjectListIt it( *l ); it.current(); ++it ) { d->subWidgetsWithDisabledEvents->insert(it.current(), (char*)1); it.current()->installEventFilter(this); } @@ -211,34 +211,34 @@ void KexiDBComboBox::createEditor() void KexiDBComboBox::setLabelPosition(LabelPosition position) { if(m_subwidget) { - if (-1 != m_subwidget->metaObject()->findProperty("frameShape", true)) - m_subwidget->setProperty("frameShape", QVariant((int)QFrame::NoFrame)); + if (-1 != m_subwidget->tqmetaObject()->tqfindProperty("frameShape", true)) + m_subwidget->setProperty("frameShape", TQVariant((int)TQFrame::NoFrame)); m_subwidget->setGeometry( editorGeometry() ); } -// KexiSubwidgetInterface *subwidgetInterface = dynamic_cast<KexiSubwidgetInterface*>((QWidget*)m_subwidget); +// KexiSubwidgetInterface *subwidgetInterface = dynamic_cast<KexiSubwidgetInterface*>((TQWidget*)m_subwidget); // update size policy // if (subwidgetInterface && subwidgetInterface->subwidgetStretchRequired(this)) { - QSizePolicy sizePolicy( this->sizePolicy() ); + TQSizePolicy sizePolicy( this->tqsizePolicy() ); if(position == Left) - sizePolicy.setHorData( QSizePolicy::Minimum ); + sizePolicy.setHorData( TQSizePolicy::Minimum ); else - sizePolicy.setVerData( QSizePolicy::Minimum ); - //m_subwidget->setSizePolicy(sizePolicy); - setSizePolicy(sizePolicy); + sizePolicy.setVerData( TQSizePolicy::Minimum ); + //m_subwidget->tqsetSizePolicy(sizePolicy); + tqsetSizePolicy(sizePolicy); //} // } } -QRect KexiDBComboBox::buttonGeometry() const +TQRect KexiDBComboBox::buttonGeometry() const { - QRect arrowRect( - style().querySubControlMetrics( QStyle::CC_ComboBox, d->paintedCombo, QStyle::SC_ComboBoxArrow) ); - arrowRect = QStyle::visualRect(arrowRect, d->paintedCombo); - arrowRect.setHeight( QMAX( height() - (2 * arrowRect.y()), arrowRect.height() ) ); // a fix for Motif style + TQRect arrowRect( + tqstyle().querySubControlMetrics( TQStyle::CC_ComboBox, d->paintedCombo, TQStyle::SC_ComboBoxArrow) ); + arrowRect = TQStyle::tqvisualRect(arrowRect, d->paintedCombo); + arrowRect.setHeight( TQMAX( height() - (2 * arrowRect.y()), arrowRect.height() ) ); // a fix for Motif style return arrowRect; } -bool KexiDBComboBox::handleMousePressEvent(QMouseEvent *e) +bool KexiDBComboBox::handleMousePressEvent(TQMouseEvent *e) { if ( e->button() != Qt::LeftButton || d->designMode ) return true; @@ -247,19 +247,19 @@ bool KexiDBComboBox::handleMousePressEvent(QMouseEvent *e) return; }*/ - if ( /*count() &&*/ ( !isEditable() || buttonGeometry().contains( e->pos() ) ) ) { + if ( /*count() &&*/ ( !isEditable() || buttonGeometry().tqcontains( e->pos() ) ) ) { d->buttonPressed = false; /* if ( d->usingListBox() ) { listBox()->blockSignals( TRUE ); - qApp->sendEvent( listBox(), e ); // trigger the listbox's autoscroll + tqApp->sendEvent( listBox(), e ); // trigger the listbox's autoscroll listBox()->setCurrentItem(d->current); listBox()->blockSignals( FALSE ); popup(); - if ( arrowRect.contains( e->pos() ) ) { + if ( arrowRect.tqcontains( e->pos() ) ) { d->arrowPressed = TRUE; d->arrowDown = TRUE; - repaint( FALSE ); + tqrepaint( FALSE ); } } else {*/ showPopup(); @@ -268,12 +268,12 @@ bool KexiDBComboBox::handleMousePressEvent(QMouseEvent *e) return false; } -bool KexiDBComboBox::handleKeyPressEvent(QKeyEvent *ke) +bool KexiDBComboBox::handleKeyPressEvent(TQKeyEvent *ke) { const int k = ke->key(); - const bool dropDown = (ke->state() == Qt::NoButton && ((k==Qt::Key_F2 && !d->isEditable) || k==Qt::Key_F4)) - || (ke->state() == Qt::AltButton && k==Qt::Key_Down); - const bool escPressed = ke->state() == Qt::NoButton && k==Qt::Key_Escape; + const bool dropDown = (ke->state() == Qt::NoButton && ((k==TQt::Key_F2 && !d->isEditable) || k==TQt::Key_F4)) + || (ke->state() == TQt::AltButton && k==TQt::Key_Down); + const bool escPressed = ke->state() == Qt::NoButton && k==TQt::Key_Escape; const bool popupVisible = popup() && popup()->isVisible(); if ((dropDown || escPressed) && popupVisible) { popup()->hide(); @@ -285,7 +285,7 @@ bool KexiDBComboBox::handleKeyPressEvent(QKeyEvent *ke) return true; } else if (popupVisible) { - const bool enterPressed = k==Qt::Key_Enter || k==Qt::Key_Return; + const bool enterPressed = k==TQt::Key_Enter || k==TQt::Key_Return; if (enterPressed/* && m_internalEditorValueChanged*/) { acceptPopupSelection(); return true; @@ -296,91 +296,91 @@ bool KexiDBComboBox::handleKeyPressEvent(QKeyEvent *ke) return false; } -bool KexiDBComboBox::keyPressed(QKeyEvent *ke) +bool KexiDBComboBox::keyPressed(TQKeyEvent *ke) { if (KexiDBAutoField::keyPressed(ke)) return true; const int k = ke->key(); const bool popupVisible = popup() && popup()->isVisible(); - const bool escPressed = ke->state() == Qt::NoButton && k==Qt::Key_Escape; + const bool escPressed = ke->state() == Qt::NoButton && k==TQt::Key_Escape; if (escPressed && popupVisible) { popup()->hide(); return true; } - if (ke->state() == Qt::NoButton && (k==Qt::Key_PageDown || k==Qt::Key_PageUp) && popupVisible) + if (ke->state() == Qt::NoButton && (k==TQt::Key_PageDown || k==TQt::Key_PageUp) && popupVisible) return true; return false; } -void KexiDBComboBox::mousePressEvent( QMouseEvent *e ) +void KexiDBComboBox::mousePressEvent( TQMouseEvent *e ) { if (handleMousePressEvent(e)) return; -// QTimer::singleShot( 200, this, SLOT(internalClickTimeout())); +// TQTimer::singleShot( 200, this, TQT_SLOT(internalClickTimeout())); // d->shortClick = TRUE; // } KexiDBAutoField::mousePressEvent( e ); } -void KexiDBComboBox::mouseDoubleClickEvent( QMouseEvent *e ) +void KexiDBComboBox::mouseDoubleClickEvent( TQMouseEvent *e ) { mousePressEvent( e ); } -bool KexiDBComboBox::eventFilter( QObject *o, QEvent *e ) +bool KexiDBComboBox::eventFilter( TQObject *o, TQEvent *e ) { - if (o==this) { - if (e->type()==QEvent::Resize) { + if (TQT_BASE_OBJECT(o)==TQT_BASE_OBJECT(this)) { + if (e->type()==TQEvent::Resize) { d->paintedCombo->resize(size()); if (m_subwidget) m_subwidget->setGeometry( editorGeometry() ); } - else if (e->type()==QEvent::Enter) { + else if (e->type()==TQEvent::Enter) { if (!d->isEditable - || /*over button if editable combo*/buttonGeometry().contains( static_cast<QMouseEvent*>(e)->pos() )) + || /*over button if editable combo*/buttonGeometry().tqcontains( TQT_TQMOUSEEVENT(e)->pos() )) { d->mouseOver = true; update(); } } - else if (e->type()==QEvent::MouseMove) { + else if (e->type()==TQEvent::MouseMove) { if (d->isEditable) { - const bool overButton = buttonGeometry().contains( static_cast<QMouseEvent*>(e)->pos() ); + const bool overButton = buttonGeometry().tqcontains( TQT_TQMOUSEEVENT(e)->pos() ); if (overButton != d->mouseOver) { d->mouseOver = overButton; update(); } } } - else if (e->type()==QEvent::Leave) { + else if (e->type()==TQEvent::Leave) { d->mouseOver = false; update(); } - else if (e->type()==QEvent::KeyPress) { + else if (e->type()==TQEvent::KeyPress) { // handle F2/F4 - if (handleKeyPressEvent(static_cast<QKeyEvent*>(e))) + if (handleKeyPressEvent(TQT_TQKEYEVENT(e))) return true; } - else if (e->type()==QEvent::FocusOut) { + else if (e->type()==TQEvent::FocusOut) { if (popup() && popup()->isVisible()) { popup()->hide(); undoChanges(); } } } - else if (!d->isEditable && d->subWidgetsWithDisabledEvents && d->subWidgetsWithDisabledEvents->find(o)) { - if (e->type()==QEvent::MouseButtonPress) { + else if (!d->isEditable && d->subWidgetsWithDisabledEvents && d->subWidgetsWithDisabledEvents->tqfind(o)) { + if (e->type()==TQEvent::MouseButtonPress) { // clicking the subwidget should mean the same as clicking the combo box (i.e. show the popup) - if (handleMousePressEvent(static_cast<QMouseEvent*>(e))) + if (handleMousePressEvent(TQT_TQMOUSEEVENT(e))) return true; } - else if (e->type()==QEvent::KeyPress) { - if (handleKeyPressEvent(static_cast<QKeyEvent*>(e))) + else if (e->type()==TQEvent::KeyPress) { + if (handleKeyPressEvent(TQT_TQKEYEVENT(e))) return true; } - return e->type()!=QEvent::Paint; + return e->type()!=TQEvent::Paint; } return KexiDBAutoField::eventFilter( o, e ); } @@ -391,15 +391,15 @@ bool KexiDBComboBox::subwidgetStretchRequired(KexiDBAutoField* autoField) const return true; } -void KexiDBComboBox::setPaletteBackgroundColor( const QColor & color ) +void KexiDBComboBox::setPaletteBackgroundColor( const TQColor & color ) { KexiDBAutoField::setPaletteBackgroundColor(color); - QPalette pal(palette()); - QColorGroup cg(pal.active()); - pal.setColor(QColorGroup::Base, red); - pal.setColor(QColorGroup::Background, red); + TQPalette pal(palette()); + TQColorGroup cg(pal.active()); + pal.setColor(TQColorGroup::Base, red); + pal.setColor(TQColorGroup::Background, red); pal.setActive(cg); - QWidget::setPalette(pal); + TQWidget::setPalette(pal); update(); } @@ -439,7 +439,7 @@ void KexiDBComboBox::selectAllInInternalEditor() selectAll(); } -void KexiDBComboBox::setValueInternal(const QVariant& add, bool removeOld) +void KexiDBComboBox::setValueInternal(const TQVariant& add, bool removeOld) { //// use KexiDBAutoField instead of KexiComboBoxBase::setValueInternal //// expects existing popup(), but we want to have delayed creation @@ -448,38 +448,38 @@ void KexiDBComboBox::setValueInternal(const QVariant& add, bool removeOld) KexiComboBoxBase::setValueInternal(add, removeOld); } -void KexiDBComboBox::setVisibleValueInternal(const QVariant& value) +void KexiDBComboBox::setVisibleValueInternal(const TQVariant& value) { - KexiFormDataItemInterface *iface = dynamic_cast<KexiFormDataItemInterface*>((QWidget*)m_subwidget); + KexiFormDataItemInterface *iface = dynamic_cast<KexiFormDataItemInterface*>((TQWidget*)m_subwidget); if(iface) - iface->setValue(value, QVariant(), false /*!removeOld*/); + iface->setValue(value, TQVariant(), false /*!removeOld*/); } -QVariant KexiDBComboBox::visibleValue() +TQVariant KexiDBComboBox::visibleValue() { return KexiComboBoxBase::visibleValue(); } -void KexiDBComboBox::setValueInInternalEditor(const QVariant& value) +void KexiDBComboBox::setValueInInternalEditor(const TQVariant& value) { if (!m_setValueInInternalEditor_enabled) return; - KexiFormDataItemInterface *iface = dynamic_cast<KexiFormDataItemInterface*>((QWidget*)m_subwidget); + KexiFormDataItemInterface *iface = dynamic_cast<KexiFormDataItemInterface*>((TQWidget*)m_subwidget); if(iface) - iface->setValue(value, QVariant(), false/*!removeOld*/); + iface->setValue(value, TQVariant(), false/*!removeOld*/); } -QVariant KexiDBComboBox::valueFromInternalEditor() +TQVariant KexiDBComboBox::valueFromInternalEditor() { return KexiDBAutoField::value(); } -QPoint KexiDBComboBox::mapFromParentToGlobal(const QPoint& pos) const +TQPoint KexiDBComboBox::mapFromParentToGlobal(const TQPoint& pos) const { // const KexiFormScrollView* view = KexiUtils::findParentConst<const KexiFormScrollView>(this, "KexiFormScrollView"); - if (!parentWidget()) - return QPoint(-1,-1); - return parentWidget()->mapToGlobal(pos); + if (!tqparentWidget()) + return TQPoint(-1,-1); + return tqparentWidget()->mapToGlobal(pos); // return view->viewport()->mapToGlobal(pos); } @@ -488,31 +488,31 @@ int KexiDBComboBox::popupWidthHint() const return width(); //popup() ? popup()->width() : 0; } -void KexiDBComboBox::fontChange( const QFont & oldFont ) +void KexiDBComboBox::fontChange( const TQFont & oldFont ) { - d->sizeHint = QSize(); //force rebuild the cache + d->tqsizeHint = TQSize(); //force rebuild the cache KexiDBAutoField::fontChange(oldFont); } -void KexiDBComboBox::styleChange( QStyle& oldStyle ) +void KexiDBComboBox::styleChange( TQStyle& oldStyle ) { KexiDBAutoField::styleChange( oldStyle ); - d->sizeHint = QSize(); //force rebuild the cache + d->tqsizeHint = TQSize(); //force rebuild the cache if (m_subwidget) m_subwidget->setGeometry( editorGeometry() ); } -QSize KexiDBComboBox::sizeHint() const +TQSize KexiDBComboBox::tqsizeHint() const { - if ( isVisible() && d->sizeHint.isValid() ) - return d->sizeHint; + if ( isVisible() && d->tqsizeHint.isValid() ) + return d->tqsizeHint; - const int maxWidth = 7 * fontMetrics().width(QChar('x')) + 18; - const int maxHeight = QMAX( fontMetrics().lineSpacing(), 14 ) + 2; - d->sizeHint = (style().sizeFromContents(QStyle::CT_ComboBox, d->paintedCombo, - QSize(maxWidth, maxHeight)).expandedTo(QApplication::globalStrut())); + const int maxWidth = 7 * fontMetrics().width(TQChar('x')) + 18; + const int maxHeight = TQMAX( fontMetrics().lineSpacing(), 14 ) + 2; + d->tqsizeHint = (tqstyle().tqsizeFromContents(TQStyle::CT_ComboBox, d->paintedCombo, + TQSize(maxWidth, maxHeight)).expandedTo(TQApplication::globalStrut())); - return d->sizeHint; + return d->tqsizeHint; } void KexiDBComboBox::editRequested() @@ -534,7 +534,7 @@ void KexiDBComboBox::slotRowAccepted(KexiTableItem *item, int row) void KexiDBComboBox::beforeSignalValueChanged() { if (d->dataEnteredByHand) { - KexiFormDataItemInterface *iface = dynamic_cast<KexiFormDataItemInterface*>((QWidget*)m_subwidget); + KexiFormDataItemInterface *iface = dynamic_cast<KexiFormDataItemInterface*>((TQWidget*)m_subwidget); if (iface) { slotInternalEditorValueChanged( iface->value() ); } |