//! Enum describes bit flags of the Qt datum view and behaviour
typedef enum
{
- None = 0x00, //!< Non specified any flags (Default behaviour)
- Label = 0x01, //!< Create subwidget for datum label
- Control = 0x02, //!< Create subwidget for datum input control
- Units = 0x04, //!< Create subwidget for datum units of measure
- NotFormat = 0x08, //!< Don't format initial value
- NotAccel = 0x10, //!< Not support accelerators in datum label
- UnitsWithLabel = 0x20, //!< Display units of measure in label like "<label_text> (<units_text>) instead separate text"
+ None = 0x00, //!< Non specified any flags (Default behaviour)
+ Label = 0x01, //!< Create subwidget for datum label
+ Control = 0x02, //!< Create subwidget for datum input control
+ Units = 0x04, //!< Create subwidget for datum units of measure
+ NotFormat = 0x08, //!< Don't format initial value
+ NotAccel = 0x10, //!< Not support accelerators in datum label
+ NotConvert = 0x20, //!< Don't convert numeric value
+ UnitsWithLabel = 0x40, //!< Display units of measure in label like "<label_text> (<units_text>) instead separate text"
All = Label | Control | Units //!< Create all subwidgets
} DatumFlags;
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();
else
{
res = getString().toDouble();
- if ( !myDicItem.IsNull() )
+ if ( !myDicItem.IsNull() && !( flags() & NotConvert ) )
res = myDicItem->ToSI( res );
}
else
{
double val = getString().toDouble();
- if ( !myDicItem.IsNull() )
+ if ( !myDicItem.IsNull() && !( flags() & NotConvert ) )
res = (int)myDicItem->ToSI( val );
}
mySourceValue = QString().setNum( num, 'g', 16 );
double val = num;
- if ( !myDicItem.IsNull() )
+ if ( !myDicItem.IsNull() && !( flags() & NotConvert ) )
val = myDicItem->FromSI( val );
QString aStr = format( ( flags() & NotFormat ) ? (QString) "" : format(), type(), val );
mySourceValue = QString().setNum( num );
double val = num;
- if ( !myDicItem.IsNull() )
+ if ( !myDicItem.IsNull() && !( flags() & NotConvert ) )
val = myDicItem->FromSI( val );
QString aStr = format( ( flags() & NotFormat ) ? (QString) "" : format(), type(), val );
if ( key ) {
SUIT_ViewWindow* vw = ::getParentViewWindow( obj );
if ( vw ) {
- QString type = vw->getViewManager()->getViewModel()->getType();
- if ( myMap.contains( type ) ) {
- IdActionMap idActionMap = myMap[type];
- if ( idActionMap.contains( key ) ) {
- return vw->onAccelAction( idActionMap[key] );
+ if ( vw->getViewManager() && vw->getViewManager()->getViewModel() )
+ {
+ QString type = vw->getViewManager()->getViewModel()->getType();
+ if ( myMap.contains( type ) ) {
+ IdActionMap idActionMap = myMap[type];
+ if ( idActionMap.contains( key ) ) {
+ return vw->onAccelAction( idActionMap[key] );
+ }
}
}
}
/*! Constructor.*/
SUIT_ViewWindow::SUIT_ViewWindow( SUIT_Desktop* theDesktop )
- : QMainWindow( theDesktop ), myIsDropDown( true )
+ : QMainWindow( theDesktop ), myManager( 0 ), myIsDropDown( true )
{
myDesktop = theDesktop;