From a95de329cdcb02d57eb88413f05da457437d1b80 Mon Sep 17 00:00:00 2001 From: dmacvicar Date: Fri, 30 Nov 2007 11:03:22 +0000 Subject: [PATCH] YQComboBox git-svn-id: http://svn.opensuse.org/svn/yast/branches/tmp/coolo/qt4-port@42539 e0cc52ee-31ee-0310-8b87-e83c4596d67c --- src/YQCheckBoxFrame.cc | 6 ++---- src/YQComboBox.cc | 19 ++++++++++--------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/YQCheckBoxFrame.cc b/src/YQCheckBoxFrame.cc index 3cb329c..f507add 100644 --- a/src/YQCheckBoxFrame.cc +++ b/src/YQCheckBoxFrame.cc @@ -103,10 +103,8 @@ void YQCheckBoxFrame::preventQGroupBoxAutoEnablement() */ // Find the check box in the child hierarchy (as a direct child) - - _checkBox = dynamic_cast( QObject::child( 0, // objName - "QCheckBox", // inheritsClass - false ) ); // recursive + // NOTE findChild search recursively by default + _checkBox = QObject::findChild(); if ( ! _checkBox ) { diff --git a/src/YQComboBox.cc b/src/YQComboBox.cc index 827ed35..d26bb89 100644 --- a/src/YQComboBox.cc +++ b/src/YQComboBox.cc @@ -55,7 +55,8 @@ YQComboBox::YQComboBox( YWidget * parent, YUI_CHECK_NEW( _caption ); layout->addWidget( _caption ); - _qt_comboBox = new QComboBox( editable, this ); + _qt_comboBox = new QComboBox(this); + _qt_comboBox->setEditable(editable); YUI_CHECK_NEW( _caption ); layout->addWidget( _qt_comboBox ); @@ -93,7 +94,7 @@ void YQComboBox::setText( const string & newValue ) if ( isValidText( text ) ) { YQSignalBlocker sigBlocker( _qt_comboBox ); - _qt_comboBox->setCurrentText( text ); + _qt_comboBox->setItemText(_qt_comboBox->currentIndex(), text ); } else { @@ -106,21 +107,21 @@ void YQComboBox::setText( const string & newValue ) void YQComboBox::addItem( YItem * item ) { YComboBox::addItem( item ); - QPixmap icon; + QIcon icon; if ( item->hasIconName() ) { string iconName = iconFullPath( item ); - icon = QPixmap( iconName.c_str() ); + icon = QIcon( iconName.c_str() ); if ( icon.isNull() ) y2warning( "Can't load icon %s", iconName.c_str() ); } if ( icon.isNull() ) - _qt_comboBox->insertItem( fromUTF8( item->label() ) ); + _qt_comboBox->insertItem( -1, fromUTF8( item->label() ) ); else - _qt_comboBox->insertItem( icon, fromUTF8( item->label() ) ); + _qt_comboBox->insertItem( -1, icon, fromUTF8( item->label() ) ); if ( item->selected() ) { @@ -148,7 +149,7 @@ void YQComboBox::setLabel( const string & label ) void YQComboBox::setValidChars( const string & newValidChars ) { - if ( ! _qt_comboBox->editable() ) + if ( ! _qt_comboBox->isEditable() ) { y2warning( "Setting ValidChars is useless on a combo box that isn't editable! (%s)", debugLabel().c_str() ); @@ -171,10 +172,10 @@ void YQComboBox::setValidChars( const string & newValidChars ) if ( ! isValidText( _qt_comboBox->currentText() ) ) { y2error( "Old value \"%s\" of %s \"%s\" invalid according to ValidChars \"%s\" - deleting", - (const char *) _qt_comboBox->currentText(), + qPrintable(_qt_comboBox->currentText()), widgetClass(), debugLabel().c_str(), newValidChars.c_str() ); - _qt_comboBox->setCurrentText( "" ); + _qt_comboBox->setItemText(_qt_comboBox->currentIndex(), ""); } YComboBox::setValidChars( newValidChars ); -- 2.39.2