-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "QDS_ComboBox.h"
#include <QtxComboBox.h>
bool changed = false;
QMap<int, int> aMap;
- for ( uint i = 0; i < ids.count(); i++ )
+ for ( int i = 0; i < ids.count(); i++ )
aMap.insert( ids.at( i ), 0 );
for ( IdStateMap::Iterator it = myState.begin(); it != myState.end(); ++it )
myUserIds = ids;
myUserNames = names;
- unitSystemChanged( "" );
+ //unitSystemChanged( "" );
}
/*!
*/
void QDS_ComboBox::reset()
{
- int id = -1;
QString aDefValue = defaultValue();
if ( !aDefValue.isEmpty() )
setString( aDefValue );
else if ( txt.isEmpty() )
{
if ( !cb->isEditable() )
- cb->setItemText( cb->currentIndex(), txt );
+ cb->setCleared( true );
else
cb->lineEdit()->setText( txt );
}
- if ( isClear != txt.isEmpty() || ( !isClear && old != cb->currentIndex() ) )
+ if ( isClear != txt.isEmpty() || ( !isClear && old != cb->currentIndex() ) || isClear != cb->isCleared() )
{
onParamChanged();
QString str = getString();
{
QtxComboBox* cb = new QtxComboBox( parent );
cb->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Fixed ) );
- connect( cb, SIGNAL( textChanged( const QString& ) ), this,
+ connect( cb, SIGNAL( editTextChanged( const QString& ) ), this,
SLOT( onTextChanged( const QString& ) ) );
connect( cb, SIGNAL( activated( int ) ), this, SLOT( onActivated( int ) ) );
return cb;
void QDS_ComboBox::onActivated( int idx )
{
if ( comboBox() )
- comboBox()->setCurrentIndex( comboBox()->currentIndex() );
+ {
+ int ind = comboBox()->currentIndex();
+ comboBox()->setCurrentIndex( -1 );
+ comboBox()->setCurrentIndex( ind );
+ }
int id = getId( idx );
if ( id != -1 )