--- /dev/null
+TEMPLATE = lib
+TARGET = DDS
+DESTDIR = ../../lib
+MOC_DIR = ../../moc
+OBJECTS_DIR = ../../obj/$$TARGET
+
+CASROOT = $$(CASROOT)
+CAS_CPPFLAGS = $${CASROOT}/inc
+
+CAS_KERNEL = -L$${CASROOT}/Linux/lib -lTKernel
+
+CAS_OCAF = -L$${CASROOT}/Linux/lib -lPTKernel -lTKernel -lTKCDF -lTKLCAF -lTKPCAF -lTKStdSchema
+
+INCLUDEPATH += ../../include $${CAS_CPPFLAGS}
+LIBS += $${CAS_KERNEL} $${CAS_OCAF}
+
+CONFIG -= debug release debug_and_release
+CONFIG += qt thread debug dll shared
+
+win32:DEFINES += WIN32
+DEFINES += DDS_EXPORTS OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS
+
+HEADERS = DDS.h
+HEADERS += DDS_DicGroup.h
+HEADERS += DDS_DicItem.h
+HEADERS += DDS_Dictionary.h
+HEADERS += DDS_KeyWords.h
+
+SOURCES = DDS_DicGroup.cxx
+SOURCES += DDS_DicItem.cxx
+SOURCES += DDS_Dictionary.cxx
+SOURCES += DDS_KeyWords.cxx
+
+includes.files = $$HEADERS
+includes.path = ../../include
+
+INSTALLS += includes
# VSR: this is the original packages list
#SUBDIRS = Qtx Style DDS QDS SUIT STD CAF SUITApp LogWindow ObjBrowser Prs
# VSR: already migrated to Qt4 packages
-SUBDIRS = Qtx SUIT SUITApp STD CAF CAM LogWindow Prs
+SUBDIRS = Qtx DDS QDS SUIT SUITApp STD CAF CAM LogWindow Prs
if ENABLE_SALOMEOBJECT
# VSR: this is the original packages list
lib_LTLIBRARIES = libQDS.la
# header files
-salomeinclude_HEADERS= QDS.h \
- QDS_CheckBox.h \
- QDS_ComboBox.h \
- QDS_Datum.h \
- QDS_LineEdit.h \
- QDS_SpinBox.h \
- QDS_SpinBoxDbl.h \
- QDS_TextEdit.h \
- QDS_Validator.h
-dist_libQDS_la_SOURCES= \
- QDS.cxx \
- QDS_CheckBox.cxx \
- QDS_ComboBox.cxx \
- QDS_Datum.cxx \
- QDS_LineEdit.cxx \
- QDS_SpinBox.cxx \
- QDS_SpinBoxDbl.cxx \
- QDS_TextEdit.cxx \
- QDS_Validator.cxx
-
+#MKR: already migrated to Qt4 files
+salomeinclude_HEADERS= \
+ QDS.h \
+ QDS_CheckBox.h \
+ QDS_ComboBox.h \
+ QDS_Datum.h \
+ QDS_LineEdit.h \
+ QDS_SpinBox.h \
+ QDS_SpinBoxDbl.h \
+ QDS_TextEdit.h \
+ QDS_Validator.h \
+ QDS_RadioBox.h
+
+#MKR: not yet migrated to Qt4 files
+# \
+ QDS_Table.h
+
+#MKR: already migrated to Qt4 files
+dist_libQDS_la_SOURCES= \
+ QDS.cxx \
+ QDS_CheckBox.cxx \
+ QDS_ComboBox.cxx \
+ QDS_Datum.cxx \
+ QDS_LineEdit.cxx \
+ QDS_SpinBox.cxx \
+ QDS_SpinBoxDbl.cxx \
+ QDS_TextEdit.cxx \
+ QDS_Validator.cxx \
+ QDS_RadioBox.cxx
+
+#MKR: not yet migrated to Qt4 files
+# \
+ QDS_Table.cxx
+
+#MKR: already migrated to Qt4 files
MOC_FILES= \
QDS_CheckBox_moc.cxx \
QDS_ComboBox_moc.cxx \
QDS_LineEdit_moc.cxx \
QDS_SpinBox_moc.cxx \
QDS_SpinBoxDbl_moc.cxx \
- QDS_TextEdit_moc.cxx
+ QDS_TextEdit_moc.cxx \
+ QDS_RadioBox_moc.cxx
+
+#MKR: not yet migrated to Qt4 files
+# \
+ QDS_Table_moc.cxx
+
nodist_libQDS_la_SOURCES= $(MOC_FILES)
# may be neccessary for the external projects or future improvements
#include "QDS_Datum.h"
-#include <qtextcodec.h>
+#include <QTextCodec>
#include <DDS_DicItem.h>
#include <DDS_Dictionary.h>
#include <TCollection_HAsciiString.hxx>
#include <TCollection_HExtendedString.hxx>
-QValueList<QDS_Datum*> QDS::_datumList;
+QList<QDS_Datum*> QDS::_datumList;
/*!
Convert the OpenCascade ascii string to Qt string.
TCollection_AsciiString QDS::toAsciiString( const QString& src )
{
TCollection_AsciiString res;
- if ( src.latin1() )
+ if ( src.toLatin1().constData() )
{
QTextCodec* codec = QTextCodec::codecForLocale();
if ( codec )
{
- int len = -1;
- QCString str = codec->fromUnicode( src, len );
- res = TCollection_AsciiString( (Standard_CString)(const char*)str, len );
+ QByteArray str = codec->fromUnicode( src );
+ res = TCollection_AsciiString( (Standard_CString)(const char*)str, str.size() );
}
else
- res = TCollection_AsciiString( (char*)src.latin1() );
+ res = TCollection_AsciiString( (char*)src.toLatin1().constData() );
}
return res;
}
return;
TCollection_AsciiString aComp = toAsciiString( comp );
- for ( QValueList<QDS_Datum*>::iterator it = _datumList.begin(); it != _datumList.end(); ++it )
+ for ( QList<QDS_Datum*>::iterator it = _datumList.begin(); it != _datumList.end(); ++it )
{
QDS_Datum* datum = *it;
if ( !datum )
if ( !datum )
return;
- _datumList.remove( datum );
+ _datumList.removeAt( _datumList.indexOf(datum) );
}
#pragma warning ( disable:4786 )
#endif
-#include <qstring.h>
-#include <qvaluelist.h>
-
-#include <TCollection_AsciiString.hxx>
+#include <QString>
+#include <QList>
#include <TCollection_ExtendedString.hxx>
static void removeDatum( QDS_Datum* );
private:
- static QValueList<QDS_Datum*> _datumList;
+ static QList<QDS_Datum*> _datumList;
};
#endif
--- /dev/null
+TEMPLATE = lib
+TARGET = QDS
+DESTDIR = ../../lib
+MOC_DIR = ../../moc
+OBJECTS_DIR = ../../obj/$$TARGET
+
+CASROOT = $$(CASROOT)
+CAS_CPPFLAGS = $${CASROOT}/inc
+
+CAS_KERNEL = -L$${CASROOT}/Linux/lib -lTKernel
+
+INCLUDEPATH += ../../include $${CAS_CPPFLAGS} ../Qtx ../DDS
+LIBS += -L../../lib -lqtx -lDDS $${CAS_KERNEL}
+
+CONFIG -= debug release debug_and_release
+CONFIG += qt thread debug dll shared
+
+win32:DEFINES += WIN32
+DEFINES += QDS_EXPORTS OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS
+
+HEADERS = QDS.h
+HEADERS += QDS_CheckBox.h
+HEADERS += QDS_ComboBox.h
+HEADERS += QDS_Datum.h
+HEADERS += QDS_LineEdit.h
+HEADERS += QDS_SpinBox.h
+HEADERS += QDS_SpinBoxDbl.h
+HEADERS += QDS_TextEdit.h
+HEADERS += QDS_Validator.h
+HEADERS += QDS_RadioBox.h
+#HEADERS += QDS_Table.h
+
+SOURCES = QDS.cxx
+SOURCES += QDS_CheckBox.cxx
+SOURCES += QDS_ComboBox.cxx
+SOURCES += QDS_Datum.cxx
+SOURCES += QDS_LineEdit.cxx
+SOURCES += QDS_SpinBox.cxx
+SOURCES += QDS_SpinBoxDbl.cxx
+SOURCES += QDS_TextEdit.cxx
+SOURCES += QDS_Validator.cxx
+SOURCES += QDS_RadioBox.cxx
+#SOURCES += QDS_Table.cxx
+
+TRANSLATIONS = resources/QDS_msg_en.ts
+
+ICONS = resources/*.png
+
+includes.files = $$HEADERS
+includes.path = ../../include
+
+resources.files = $$ICONS resources/*.qm
+resources.path = ../../resources
+
+INSTALLS += includes resources
//
#include "QDS_CheckBox.h"
-#include <qcheckbox.h>
+#include <QCheckBox>
/*
\class QDS_CheckBox
QString QDS_CheckBox::getString() const
{
QString val;
- if ( checkBox() && checkBox()->state() != QButton::NoChange )
+ if ( checkBox() && checkBox()->checkState() != Qt::PartiallyChecked )
val = checkBox()->isChecked() ? "1" : "0";
return val;
}
if ( isOk && val < 0 )
{
checkBox()->setTristate();
- checkBox()->setNoChange();
+ checkBox()->setCheckState(Qt::PartiallyChecked);
}
else
checkBox()->setChecked( isOk && val != 0 );
*/
QCheckBox* QDS_CheckBox::checkBox() const
{
- return ::qt_cast<QCheckBox*>( controlWidget() );
+ return ::qobject_cast<QCheckBox*>( controlWidget() );
}
/*!
*/
void QDS_CheckBox::onStateChanged( int state )
{
- if ( state != QButton::NoChange && checkBox() )
+ if ( state != Qt::PartiallyChecked && checkBox() )
checkBox()->setTristate( false );
}
#include <DDS_Dictionary.h>
-#include <TCollection_AsciiString.hxx>
#include <TColStd_HArray1OfInteger.hxx>
#include <TColStd_HArray1OfExtendedString.hxx>
-#include <qlineedit.h>
+#include <QLineEdit>
/*
\class QDS_ComboBox
if ( aCombo && aCombo->lineEdit() )
{
aCombo->lineEdit()->setReadOnly( !on );
- aCombo->clearValidator();
+ aCombo->setValidator(0);
if ( on )
aCombo->setValidator( validator() );
}
Returns list of list item identifiers \aids. If \atotal is 'false' then only visible items
are taken into account otherwise all items.
*/
-void QDS_ComboBox::values( QValueList<int>& ids, bool total ) const
+void QDS_ComboBox::values( QList<int>& ids, bool total ) const
{
ids.clear();
for ( QIntList::const_iterator it = myDataIds.begin(); it != myDataIds.end(); ++it )
{
QComboBox* cb = comboBox();
QString cur = getString();
- if ( cb && cb->count() > 0 && cb->currentItem() >= 0 )
- cur = cb->text( cb->currentItem() );
+ if ( cb && cb->count() > 0 && cb->currentIndex() >= 0 )
+ cur = cb->itemText( cb->currentIndex() );
if ( cb && cur == getString() )
- return getId( cb->currentItem() );
+ return getId( cb->currentIndex() );
else
return getId( getString() );
}
QComboBox* cb = comboBox();
QString cur = getString();
- if ( cb && cb->count() > 0 && cb->currentItem() >= 0 )
- cur = cb->text( cb->currentItem() );
+ if ( cb && cb->count() > 0 && cb->currentIndex() >= 0 )
+ cur = cb->itemText( cb->currentIndex() );
if ( cb && cur == getString() )
- return getId( cb->currentItem() );
+ return getId( cb->currentIndex() );
else
return getId( getString() );
}
*/
void QDS_ComboBox::setState( const bool on, const int id, const bool append )
{
- QValueList<int> lst;
+ QList<int> lst;
if ( id < 0 )
{
for ( IdStateMap::Iterator it = myState.begin(); it != myState.end(); ++it )
If \aappend is set then keep status for other items otherwise status of other
items will be cleared.
*/
-void QDS_ComboBox::setState( const bool on, const QValueList<int>& ids, const bool append )
+void QDS_ComboBox::setState( const bool on, const QList<int>& ids, const bool append )
{
initDatum();
QMap<int, int> aMap;
for ( uint i = 0; i < ids.count(); i++ )
- aMap.insert( *ids.at( i ), 0 );
+ aMap.insert( ids.at( i ), 0 );
for ( IdStateMap::Iterator it = myState.begin(); it != myState.end(); ++it )
{
if ( aMap.contains( it.key() ) )
{
- if ( it.data() != on )
+ if ( it.value() != on )
{
- it.data() = on;
+ it.value() = on;
changed = true;
}
}
- else if ( !append && it.data() == on )
+ else if ( !append && it.value() == on )
{
- it.data() = !on;
+ it.value() = !on;
changed = true;
}
}
list items will be added into the combobox. This functionality allow to user override
items.
*/
-void QDS_ComboBox::setValues( const QValueList<int>& ids, const QStringList& names )
+void QDS_ComboBox::setValues( const QList<int>& ids, const QStringList& names )
{
initDatum();
/*!
This is an overloaded member function, provided for convenience.
It behaves essentially like the above function. It creates
- QValueList (0, 1, 2 ... ) and call previous method.
+ QList (0, 1, 2 ... ) and call previous method.
*/
void QDS_ComboBox::setValues( const QStringList& names )
{
initDatum();
- QValueList< int > ids;
+ QList< int > ids;
for ( int i = 0, n = names.count(); i < n; i++ )
ids.append( i );
setValues( ids, names );
QtxComboBox* cb = comboBox();
if ( cb )
{
- if ( !cb->editable() )
+ if ( !cb->isEditable() )
{
if ( !cb->isCleared() )
res = cb->currentText();
int idx = -1;
for ( int i = 0; i < cb->count() && idx == -1; i++ )
- if ( cb->text( i ) == txt )
+ if ( cb->itemText( i ) == txt )
idx = i;
- int old = cb->currentItem();
+ int old = cb->currentIndex();
if ( idx != -1 )
- cb->setCurrentItem( idx );
+ cb->setCurrentIndex( idx );
else if ( txt.isEmpty() )
{
- if ( !cb->editable() )
- cb->setCurrentText( txt );
+ if ( !cb->isEditable() )
+ cb->setItemText( cb->currentIndex(), txt );
else
cb->lineEdit()->setText( txt );
}
- if ( isClear != txt.isEmpty() || ( !isClear && old != cb->currentItem() ) )
+ if ( isClear != txt.isEmpty() || ( !isClear && old != cb->currentIndex() ) )
{
onParamChanged();
QString str = getString();
*/
QtxComboBox* QDS_ComboBox::comboBox() const
{
- return ::qt_cast<QtxComboBox*>( controlWidget() );
+ return ::qobject_cast<QtxComboBox*>( controlWidget() );
}
/*!
void QDS_ComboBox::onActivated( int idx )
{
if ( comboBox() )
- comboBox()->setCurrentItem( comboBox()->currentItem() );
+ comboBox()->setCurrentIndex( comboBox()->currentIndex() );
int id = getId( idx );
if ( id != -1 )
{
isClear = cb->isCleared();
- curId = getId( cb->currentItem() );
+ curId = getId( cb->currentIndex() );
cb->clear();
}
if ( cb )
{
if ( myIcons.contains( id ) )
- cb->insertItem( myIcons[id], myValue[id] );
+ cb->insertItem( -1, QIcon(myIcons[id]), myValue[id] );
else
- cb->insertItem( myValue[id] );
+ cb->insertItem( -1, myValue[id] );
}
}
cb->updateGeometry();
if ( isClear )
- cb->setCurrentText( "" );
+ cb->setItemText( cb->currentIndex(), "" );
else
{
if ( getIndex( curId ) != -1 )
- cb->setCurrentItem( getIndex( curId ) );
- if ( curId != getId( cb->currentItem() ) )
- onActivated( cb->currentItem() );
+ cb->setCurrentIndex( getIndex( curId ) );
+ if ( curId != getId( cb->currentIndex() ) )
+ onActivated( cb->currentIndex() );
}
}
}
if ( cb )
{
for ( int i = 0; i < cb->count() && idx == -1; i++ )
- if ( cb->text( i ) == str )
+ if ( cb->itemText( i ) == str )
idx = i;
}
return idx;
int id = -1;
IdIndexMap::ConstIterator it = myIndex.begin();
for (; it != myIndex.end() && id == -1; ++it )
- if ( it.data() == idx )
+ if ( it.value() == idx )
id = it.key();
return id;
}
IdValueMap::ConstIterator it = myValue.begin();
for (; it != myValue.end() && id == -1; ++it )
{
- if ( it.data() == str )
+ if ( it.value() == str )
{
if ( state( it.key() ) )
id = it.key();
#include "QDS_Datum.h"
-#include <qmap.h>
-#include <qpixmap.h>
-#include <qstringlist.h>
+#include <QMap>
+#include <QPixmap>
+#include <QStringList>
#include <QtxComboBox.h>
void setEditable( const bool );
int count( bool = false ) const;
- void values( QValueList<int>&, bool = false ) const;
+ void values( QList<int>&, bool = false ) const;
virtual int integerValue() const;
virtual double doubleValue() const;
bool state( const int ) const;
void setState( const bool, const int, const bool = true );
- void setState( const bool, const QValueList<int>&, const bool = true );
- void setValues( const QValueList<int>&, const QStringList& );
+ void setState( const bool, const QList<int>&, const bool = true );
+ void setValues( const QList<int>&, const QStringList& );
void setValues( const QStringList& );
virtual void reset();
#include <DDS_Dictionary.h>
-#include <qtimer.h>
-#include <qlabel.h>
-#include <qwidget.h>
-#include <qlayout.h>
-#include <qtooltip.h>
-#include <qwhatsthis.h>
-#include <qvalidator.h>
-#include <qmessagebox.h>
+#include <QTimer>
+#include <QLabel>
+#include <QWidget>
+#include <QLayout>
+#include <QToolTip>
+#include <QWhatsThis>
+#include <QValidator>
+#include <QMessageBox>
+#include <QEvent>
#include <TColStd_SequenceOfAsciiString.hxx>
private:
QWidget* myWid;
+ QHBoxLayout* myBase;
};
QDS_Datum::Wrapper::Wrapper( QWidget* parent )
: QWidget( parent ),
myWid( 0 )
{
- QHBoxLayout* base = new QHBoxLayout( this );
- base->setAutoAdd( true );
- setFocusPolicy( StrongFocus );
+ //QHBoxLayout* base = new QHBoxLayout( this );
+ //base->setAutoAdd( true );
+ myBase = new QHBoxLayout( this );
+ setFocusPolicy( Qt::StrongFocus );
}
QDS_Datum::Wrapper::~Wrapper()
if ( !myWid )
return;
- if ( myWid->parent() != this )
- myWid->reparent( this, QPoint( 0, 0 ) );
+ if ( myWid->parent() != this ) {
+ myWid->setParent( this );
+ myWid->move( QPoint( 0, 0 ) );
+ myWid->hide();
+ myBase->addWidget( myWid );
+ }
setTabOrder( this, myWid );
setFocusProxy( myWid );
myWrapper.insert( Units, new Wrapper( parent ) );
for ( QMap<int, Wrapper*>::Iterator it = myWrapper.begin(); it != myWrapper.end(); ++it )
- connect( it.data(), SIGNAL( destroyed( QObject* ) ), this, SLOT( onDestroyed( QObject* ) ) );
+ connect( it.value(), SIGNAL( destroyed( QObject* ) ), this, SLOT( onDestroyed( QObject* ) ) );
Handle(DDS_Dictionary) aDict = DDS_Dictionary::Get();
if ( aDict.IsNull() )
if ( !myDicItem.IsNull() )
def = toQString( myDicItem->GetDefaultValue() );
- QString aDef = def.stripWhiteSpace();
+ QString aDef = def.trimmed();
if ( !pref.isEmpty() && aDef.left( pref.length() ) == pref )
aDef = aDef.mid( pref.length() );
{
double res = 0;
QVariant opt = option( name );
- if ( opt.isValid() && opt.canCast( QVariant::Double ) )
+ if ( opt.isValid() && opt.canConvert( QVariant::Double ) )
res = opt.toDouble();
return res;
}
{
int res = 0;
QVariant opt = option( name );
- if ( opt.isValid() && opt.canCast( QVariant::Int ) )
+ if ( opt.isValid() && opt.canConvert( QVariant::Int ) )
res = opt.toInt();
return res;
}
*/
void QDS_Datum::setValue( const QVariant& val )
{
- if ( val.isValid() && val.canCast( QVariant::String ) )
+ if ( val.isValid() && val.canConvert( QVariant::String ) )
setStringValue( val.toString() );
else
clear();
initDatum();
if ( ( type & Label ) && labelWidget() )
- labelWidget()->setAlignment( align );
+ labelWidget()->setAlignment( Qt::Alignment(align) );
if ( ( type & Units ) && unitsWidget() )
- unitsWidget()->setAlignment( align );
+ unitsWidget()->setAlignment( Qt::Alignment(align) );
}
/*!
if ( o == parent() )
{
if ( e->type() == QEvent::Show || e->type() == QEvent::ShowToParent ||
- ( e->type() == QEvent::ChildInserted && ((QChildEvent*)e)->child() == this ) )
+ ( e->type() == QEvent::ChildAdded && ((QChildEvent*)e)->child() == this ) )
initDatum();
}
return QObject::eventFilter( o, e );
QString aFormat = canonicalFormat( format(), aFlags );
int len = -1;
- int pos = aFormat.find( "." );
+ int pos = aFormat.indexOf( "." );
if ( pos != -1 )
{
QString numStr = aFormat.mid( pos + 1, aFormat.length() - pos - 2 );
QString lDescr = longDescription();
QString sDescr = shortDescription();
if ( !sDescr.isEmpty() )
- QToolTip::add( ctrl, sDescr );
+ ctrl->setToolTip( sDescr );
if ( !lDescr.isEmpty() )
- QWhatsThis::add( ctrl, lDescr );
+ ctrl->setWhatsThis( lDescr );
}
if ( labelWidget() && ctrl && !( flags() & NotAccel ) )
{
int pos = -1;
QString aUnits = uni;
- while ( ( pos = aUnits.find( "**" ) ) != -1 )
+ while ( ( pos = aUnits.indexOf( "**" ) ) != -1 )
{
aUnits = aUnits.mid( 0, pos ) + QString( "<tt><font size=+2><sup>" ) +
aUnits.mid( pos + 2, 1 ) + QString( "</sup></font></tt>" ) +
{
int pos = -1;
QString aUnits = txt;
- while ( ( pos = aUnits.find( "<sup>" ) ) != -1 )
+ while ( ( pos = aUnits.indexOf( "<sup>" ) ) != -1 )
{
aUnits.remove( pos, 5 );
aUnits.insert( pos, "**" );
}
- while ( ( pos = aUnits.find( "</sup>" ) ) != -1 )
+ while ( ( pos = aUnits.indexOf( "</sup>" ) ) != -1 )
aUnits.remove( pos, 6 );
return aUnits;
}
{
case DDS_DicItem::Float:
txt = sprintf( aFormat, (double)aValue );
- txt = txt.stripWhiteSpace();
+ txt = txt.trimmed();
break;
case DDS_DicItem::Integer:
txt = sprintf( aFormat, aValue );
- txt = txt.stripWhiteSpace();
+ txt = txt.trimmed();
break;
case DDS_DicItem::String:
default:
switch ( aType )
{
case DDS_DicItem::Float:
- txt = QString().sprintf( aFormat, aValue );
- txt = txt.stripWhiteSpace();
+ txt = QString().sprintf( aFormat.toLatin1().constData(), aValue );
+ txt = txt.trimmed();
break;
case DDS_DicItem::Integer:
- txt = QString().sprintf( aFormat, (int)aValue );
- txt = txt.stripWhiteSpace();
+ txt = QString().sprintf( aFormat.toLatin1().constData(), (int)aValue );
+ txt = txt.trimmed();
break;
case DDS_DicItem::String:
default:
- txt = QString().sprintf( aFormat, aValue );
+ txt = QString().sprintf( aFormat.toLatin1().constData(), aValue );
break;
}
}
QString txt = aValue;
if ( aType != DDS_DicItem::String )
- txt = txt.stripWhiteSpace();
+ txt = txt.trimmed();
if ( aFormat.isEmpty() || txt.isEmpty() )
return txt;
case DDS_DicItem::Float:
txt = txt.replace( 'd', 'e' ).replace( 'D', 'E' );
txt = sprintf( aFormat, txt.toDouble() );
- txt = txt.stripWhiteSpace();
+ txt = txt.trimmed();
break;
case DDS_DicItem::Integer:
txt = sprintf( aFormat, txt.toInt() );
- txt = txt.stripWhiteSpace();
+ txt = txt.trimmed();
break;
case DDS_DicItem::String:
txt = sprintf( aFormat, txt );
*/
QString QDS_Datum::sprintf( const QString& fmt, const int val )
{
- return QString().sprintf( canonicalFormat( fmt ), val );
+ return QString().sprintf( canonicalFormat( fmt ).toLatin1().constData(), val );
}
/*!
*/
QString QDS_Datum::sprintf( const QString& fmt, const double val )
{
- return QString().sprintf( canonicalFormat( fmt ), val );
+ return QString().sprintf( canonicalFormat( fmt ).toLatin1().constData(), val );
}
/*!
QString txt = val;
QRegExp rx( "^(%[0-9]*.?[0-9]*s)$" );
- if ( aFormat.find( rx ) != -1 )
+ if ( aFormat.indexOf( rx ) != -1 )
{
// QString().sprintf() always expects string in UTF8 encoding, so we cannot use it here
char* buf = new char[txt.length() + 1];
- ::sprintf( buf, aFormat.latin1(), (const char*)(txt.local8Bit()) );
+ ::sprintf( buf, aFormat.toLatin1().constData(), (const char*)(txt.toLocal8Bit()) );
txt = QString::fromLocal8Bit( buf );
delete[] buf;
}*/
}
- if ( aFlags.contains( "u", false ) )
- txt = txt.upper();
- if ( aFlags.contains( "l", false ) )
- txt = txt.lower();
+ if ( aFlags.contains( "u", Qt::CaseInsensitive ) )
+ txt = txt.toUpper();
+ if ( aFlags.contains( "l", Qt::CaseInsensitive ) )
+ txt = txt.toLower();
return txt;
}
flags = QString::null;
QRegExp rx( "^(%[0-9]*.?[0-9]*)([a-z,A-Z]+)[g|c|d|i|o|u|x|e|f|n|p|s|X|E|G]$" );
- if ( rx.search( newFmt ) >= 0 )
+ if ( rx.indexIn( newFmt ) >= 0 )
{
flags = rx.cap( 2 );
newFmt.remove( rx.pos( 2 ), flags.length() );
QString pref = prefix();
QString suff = suffix();
- QString aMin = minimumValue().stripWhiteSpace();
+ QString aMin = minimumValue().trimmed();
if ( !pref.isEmpty() && aMin.left( pref.length() ) == pref )
aMin = aMin.mid( pref.length() );
QString pref = prefix();
QString suff = suffix();
- QString aMax = maximumValue().stripWhiteSpace();
+ QString aMax = maximumValue().trimmed();
if ( !pref.isEmpty() && aMax.left( pref.length() ) == pref )
aMax = aMax.mid( pref.length() );
that->initialize();
if ( parent() )
- parent()->removeEventFilter( this );
+ parent()->removeEventFilter( (QObject*)this );
}
/*!
Wrapper* wrap = 0;
for ( QMap<int, Wrapper*>::ConstIterator it = myWrapper.begin(); it != myWrapper.end() && !wrap; ++it )
{
- if ( it.data() && it.data()->widget() == wid )
- wrap = it.data();
+ if ( it.value() && it.value()->widget() == wid )
+ wrap = it.value();
}
return wrap;
}
int id = -1;
for ( QMap<int, Wrapper*>::ConstIterator it = myWrapper.begin(); it != myWrapper.end() && id == -1; ++it )
{
- if ( it.data() == wrap )
+ if ( it.value() == wrap )
id = it.key();
}
return id;
#include "QDS.h"
-#include <qwidget.h>
-#include <qstring.h>
-#include <qvariant.h>
-#include <qguardedptr.h>
+#include <QWidget>
+#include <QString>
+#include <QVariant>
+#include <QPointer>
#include <DDS_DicItem.h>
static QString canonicalFormat( const QString&, QString& );
private:
- typedef QGuardedPtr<QLabel> GuardedLabel;
- typedef QGuardedPtr<QWidget> GuardedWidget;
+ typedef QPointer<QLabel> GuardedLabel;
+ typedef QPointer<QWidget> GuardedWidget;
private:
QString myId;
//
#include "QDS_LineEdit.h"
-#include <qlineedit.h>
-#include <qvalidator.h>
+#include <QLineEdit>
+#include <QValidator>
/*
class: QDS_LineEdit::Editor
return;
delete le->validator();
- le->clearValidator();
+ le->setValidator(0);
QValidator* valid = validator();
if ( valid )
le->setValidator( valid );
QString aFormat = format();
int num = 0;
- int pos = aFormat.find( '%' );
+ int pos = aFormat.indexOf( '%' );
if ( pos != -1 )
{
pos++;
int minLen = format( format(), type(), minValue() ).length();
int maxLen = format( format(), type(), maxValue() ).length();
- num = QMAX( QMAX( num, zeroLen ), QMAX( minLen, maxLen ) );
+ num = qMax( qMax( num, zeroLen ), qMax( minLen, maxLen ) );
((Editor*)le)->setNumber( num );
}
void QDS_LineEdit::setAlignment( const int align, const int type )
{
if ( ( type & Control ) && lineEdit() )
- lineEdit()->setAlignment( align );
+ lineEdit()->setAlignment( Qt::Alignment(align) );
QDS_Datum::setAlignment( align, type );
}
*/
QLineEdit* QDS_LineEdit::lineEdit() const
{
- return ::qt_cast<QLineEdit*>( controlWidget() );
+ return ::qobject_cast<QLineEdit*>( controlWidget() );
}
/*!
QPalette aPal = anEdit->palette();
if ( !aValid )
- aPal.setColor( QPalette::Active, QColorGroup::Text, QColor( 255, 0, 0 ) );
+ aPal.setColor( QPalette::Active, QPalette::Text, QColor( 255, 0, 0 ) );
else
- aPal.setColor( QPalette::Active, QColorGroup::Text, QColor( 0, 0, 0 ) );
+ aPal.setColor( QPalette::Active, QPalette::Text, QColor( 0, 0, 0 ) );
anEdit->setPalette( aPal );
}
#include <DDS_Dictionary.h>
-#include <TCollection_AsciiString.hxx>
#include <TColStd_HArray1OfInteger.hxx>
#include <TColStd_HArray1OfExtendedString.hxx>
-#include <qobjectlist.h>
-#include <qbuttongroup.h>
-#include <qradiobutton.h>
+#include <QButtonGroup>
+#include <QGroupBox>
+#include <QVBoxLayout>
+#include <QRadioButton>
/*
\class QDS_RadioBox
search of dictionary item.
*/
QDS_RadioBox::QDS_RadioBox( const QString& id, QWidget* parent, const int flags, const QString& comp )
-: QDS_Datum( id, parent, flags & ~( Label | Units ), comp )
+ : QDS_Datum( id, parent, flags & ~( Label | Units ), comp ),
+ myButtonGroup( 0 )
{
}
return myValue.count();
else
{
- QPtrList<QRadioButton> bList;
+ QList<QRadioButton*> bList;
buttons( bList );
return bList.count();
}
Returns list of button identifiers \aids. If \atotal is 'false' then only visible
buttons are taken into account otherwise all buttons.
*/
-void QDS_RadioBox::values( QValueList<int>& ids, bool total ) const
+void QDS_RadioBox::values( QList<int>& ids, bool total ) const
{
ids.clear();
for ( QIntList::const_iterator it = myDataIds.begin(); it != myDataIds.end(); ++it )
*/
void QDS_RadioBox::setState( const bool on, const int id, const bool append )
{
- QValueList<int> lst;
+ QList<int> lst;
if ( id < 0 )
{
for ( IdStateMap::Iterator it = myState.begin(); it != myState.end(); ++it )
If \aappend is set then keep status for other buttons otherwise status of other
buttons will be cleared.
*/
-void QDS_RadioBox::setState( const bool on, const QValueList<int>& ids, const bool append )
+void QDS_RadioBox::setState( const bool on, const QList<int>& ids, const bool append )
{
if ( ids.isEmpty() && append )
return;
QMap<int, int> aMap;
for ( uint i = 0; i < ids.count(); i++ )
- aMap.insert( *ids.at( i ), 0 );
+ aMap.insert( ids.at( i ), 0 );
for ( IdStateMap::Iterator it = myState.begin(); it != myState.end(); ++it )
{
if ( aMap.contains( it.key() ) )
{
- if ( it.data() != on )
+ if ( it.value() != on )
{
- it.data() = on;
+ it.value() = on;
changed = true;
}
}
- else if ( !append && it.data() == on )
+ else if ( !append && it.value() == on )
{
- it.data() = !on;
+ it.value() = !on;
changed = true;
}
}
button from list will be added into the radio box. This functionality allow to user override
buttons.
*/
-void QDS_RadioBox::setValues( const QValueList<int>& ids, const QStringList& names )
+void QDS_RadioBox::setValues( const QList<int>& ids, const QStringList& names )
{
if ( ids.count() != names.count() )
return;
*/
void QDS_RadioBox::setValues( const QStringList& names )
{
- QValueList< int > ids;
+ QList< int > ids;
for ( int i = 0, n = names.count(); i < n; i++ )
ids.append( i );
setValues( ids, names );
QButtonGroup* bg = buttonGroup();
if ( bg )
{
- int id = bg->selectedId();
+ int id = bg->checkedId();
if ( id != -1 )
res = QString::number( id );
}
if ( !bg )
return;
- int oldId = bg->selectedId();
+ int oldId = bg->checkedId();
if ( txt.isEmpty() )
{
- QPtrList<QRadioButton> bList;
+ QList<QRadioButton*> bList;
buttons( bList );
- for ( QPtrListIterator<QRadioButton> it( bList ); it.current(); ++it )
- it.current()->setChecked( false );
+ QListIterator<QRadioButton*> it( bList );
+ while ( it.hasNext() )
+ it.next()->setChecked( false );
}
else
{
bool block = signalsBlocked();
blockSignals( true );
- bg->setButton( id );
+ bg->button(id)->setChecked(true);
blockSignals( block );
}
- int newId = bg->selectedId();
+ int newId = bg->checkedId();
if ( oldId != newId )
{
*/
QButtonGroup* QDS_RadioBox::buttonGroup() const
{
- return ::qt_cast<QButtonGroup*>( controlWidget() );
+ return myButtonGroup;
+}
+
+/*!
+ Returns pointer to QGroupBox widget.
+*/
+QGroupBox* QDS_RadioBox::groupBox() const
+{
+ return ::qobject_cast<QGroupBox*>( controlWidget() );
}
/*!
*/
QWidget* QDS_RadioBox::createControl( QWidget* parent )
{
- QButtonGroup* bg = new QButtonGroup( 1, Qt::Vertical, "", parent );
- bg->setExclusive( true );
- bg->setRadioButtonExclusive( true );
- return bg;
+ myButtonGroup = new QButtonGroup( parent );
+ myButtonGroup->setExclusive( true );
+
+ QGroupBox *gb = new QGroupBox( "", parent );
+ QVBoxLayout *vbox = new QVBoxLayout;
+ vbox->addStretch(1);
+ gb->setLayout(vbox);
+ return gb;
}
/*!
for ( QIntList::iterator iter2 = add.begin(); iter2 != add.end(); ++iter2 )
myState.insert( *iter2, true );
- QButtonGroup* bg = buttonGroup();
- if ( bg )
- bg->setTitle( label() );
+ QGroupBox* gb = groupBox();
+ if ( gb ) gb->setTitle( label() );
updateRadioBox();
}
if ( !bg )
return;
- int curId = bg->selectedId();
+ QGroupBox* gb = groupBox();
+ if ( !gb )
+ return;
+
+ int curId = bg->checkedId();
- QPtrList<QRadioButton> bList;
+ QList<QRadioButton*> bList;
buttons( bList );
- for ( QPtrListIterator<QRadioButton> itr( bList ); itr.current(); ++itr )
- delete itr.current();
+ QListIterator<QRadioButton*> itr( bList );
+ while ( itr.hasNext() ) {
+ QRadioButton* aButton = itr.next();
+ if ( gb->layout() ) gb->layout()->removeWidget(aButton);
+ delete aButton;
+ }
for ( QIntList::const_iterator it = myDataIds.begin(); it != myDataIds.end(); ++it )
{
if ( !myValue.contains( id ) || !myState.contains( id ) || !myState[id] )
continue;
- QRadioButton* rb = new QRadioButton( myValue[id], bg );
- bg->insert( rb, id );
+ QRadioButton* rb = new QRadioButton( myValue[id] );
+ ((QObject*)rb)->setParent( bg );
+ bg->addButton( rb, id );
+ if ( gb->layout() ) gb->layout()->addWidget(rb);
connect( rb, SIGNAL( toggled( bool ) ), this, SLOT( onToggled( bool ) ) );
}
if ( curId != -1 )
{
int id = curId;
- if ( !bg->find( id ) )
+ if ( !bg->button( id ) )
{
- QPtrList<QRadioButton> bList;
+ QList<QRadioButton*> bList;
buttons( bList );
if ( !bList.isEmpty() )
- id = bg->id( bList.getFirst() );
+ id = bg->id( bList.empty() ? 0 : bList.first() );
}
bool block = signalsBlocked();
blockSignals( true );
- bg->setButton( id );
+ bg->button(id)->setChecked(true);
blockSignals( block );
}
- if ( curId != bg->selectedId() )
+ if ( curId != bg->checkedId() )
{
onParamChanged();
emit paramChanged();
- emit paramChanged( getString() );
+ QString str = getString();
+ emit paramChanged( str );
}
}
/*!
Returns the list of the radio buttons from the button group.
*/
-void QDS_RadioBox::buttons( QPtrList<QRadioButton>& lst ) const
+void QDS_RadioBox::buttons( QList<QRadioButton*>& lst ) const
{
- lst.setAutoDelete( false );
lst.clear();
QButtonGroup* bg = buttonGroup();
if ( !bg )
return;
- QObjectList* objs = bg->queryList( "QRadioButton" );
- if ( objs )
- {
- for ( QObjectListIt it( *objs ); it.current(); ++it )
- {
- QRadioButton* rb = ::qt_cast<QRadioButton*>( it.current() );
- if ( rb )
- lst.append( rb );
- }
- }
- delete objs;
+ QList<QRadioButton*> objs = bg->findChildren<QRadioButton*>();
+ QListIterator<QRadioButton*> it( objs );
+ while ( it.hasNext() )
+ lst.append( it.next() );
}
#include <Qtx.h>
-#include <qmap.h>
-#include <qpixmap.h>
-#include <qstringlist.h>
+#include <QMap>
+#include <QStringList>
#ifdef WIN32
#pragma warning( disable:4251 )
#endif
class QButtonGroup;
+class QGroupBox;
class QRadioButton;
class QDS_EXPORT QDS_RadioBox : public QDS_Datum
virtual ~QDS_RadioBox();
int count( bool = false ) const;
- void values( QValueList<int>&, bool = false ) const;
+ void values( QList<int>&, bool = false ) const;
int columns() const;
void setColumns( const int );
bool state( const int ) const;
void setState( const bool, const int, const bool = true );
- void setState( const bool, const QValueList<int>&, const bool = true );
- void setValues( const QValueList<int>&, const QStringList& );
+ void setState( const bool, const QList<int>&, const bool = true );
+ void setValues( const QList<int>&, const QStringList& );
void setValues( const QStringList& );
signals:
protected:
QButtonGroup* buttonGroup() const;
+ QGroupBox* groupBox() const;
virtual QWidget* createControl( QWidget* );
- void buttons( QPtrList<QRadioButton>& ) const;
+ void buttons( QList<QRadioButton*>& ) const;
virtual QString getString() const;
virtual void setString( const QString& );
QIntList myDataIds;
QIntList myUserIds;
QStringList myUserNames;
+
+ QButtonGroup* myButtonGroup;
};
#ifdef WIN32
#include <QtxIntSpinBox.h>
-#include <qvalidator.h>
+//#include <QValidator>
/*
\class QDS_SpinBox
{
res = aSpinBox->text();
if ( !aSpinBox->suffix().isEmpty() )
- res.remove( res.find( aSpinBox->suffix() ), aSpinBox->suffix().length() );
+ res.remove( res.indexOf( aSpinBox->suffix() ), aSpinBox->suffix().length() );
if ( !aSpinBox->prefix().isEmpty() )
- res.remove( res.find( aSpinBox->prefix() ), aSpinBox->prefix().length() );
+ res.remove( res.indexOf( aSpinBox->prefix() ), aSpinBox->prefix().length() );
}
return res;
}
*/
QtxIntSpinBox* QDS_SpinBox::spinBox() const
{
- return ::qt_cast<QtxIntSpinBox*>( controlWidget() );
+ return ::qobject_cast<QtxIntSpinBox*>( controlWidget() );
}
/*!
void QDS_SpinBox::setStep( const int step )
{
if ( spinBox() )
- spinBox()->setLineStep( step );
+ spinBox()->setSingleStep( step );
}
/*!
{
int s = 0;
if ( spinBox() )
- s = spinBox()->lineStep();
+ s = spinBox()->singleStep();
return s;
}
QSpinBox* sb = spinBox();
if ( sb )
{
- delete sb->validator();
- QValidator* valid = validator();
- sb->setValidator( valid );
+ // not porting this code to qt4, only commented, since from the task context
+ // the new setted validator accepts all integers
+ //delete sb->validator();
+ //QValidator* valid = validator();
+ //sb->setValidator( valid );
sb->setSuffix( suffix() );
sb->setPrefix( prefix() );
- sb->setMinValue( minValue().toInt() );
- sb->setMaxValue( maxValue().toInt() );
+ sb->setMinimum( minValue().toInt() );
+ sb->setMaximum( maxValue().toInt() );
}
}
#include <DDS_Dictionary.h>
-#include <qvalidator.h>
+//#include <QValidator>
#include <QtxDblSpinBox.h>
res = sb->text();
if ( !sb->suffix().isEmpty() )
- res.remove( res.find( sb->suffix() ), sb->suffix().length() );
+ res.remove( res.indexOf( sb->suffix() ), sb->suffix().length() );
if ( !sb->prefix().isEmpty() )
- res.remove( res.find( sb->prefix() ), sb->prefix().length() );
+ res.remove( res.indexOf( sb->prefix() ), sb->prefix().length() );
if ( hasFocus )
sb->setFocus();
*/
QtxDblSpinBox* QDS_SpinBoxDbl::spinBox() const
{
- return ::qt_cast<QtxDblSpinBox*>( controlWidget() );
+ return ::qobject_cast<QtxDblSpinBox*>( controlWidget() );
}
/*!
if ( !sb )
return;
- delete sb->validator();
- QValidator* valid = validator();
- sb->setValidator( valid );
+ // not porting this code to qt4, only commented, since from the task context
+ // the new setted validator accepts any double
+ //delete sb->validator();
+ //QValidator* valid = validator();
+ //sb->setValidator( valid );
sb->setSuffix( suffix() );
sb->setPrefix( prefix() );
#include <QtxTable.h>
-#include <qmap.h>
-#include <qptrvector.h>
+#include <QMap>
+#include <QPtrVector>
class QDS_EXPORT QDS_Table : public QtxTable
{
//
#include "QDS_TextEdit.h"
-#include <qtextedit.h>
+#include <QTextEdit>
/*
\class QDS_TextEdit
{
QString res;
if ( textEdit() )
- res = textEdit()->text();
+ res = textEdit()->toPlainText();
return res;
}
*/
QTextEdit* QDS_TextEdit::textEdit() const
{
- return ::qt_cast<QTextEdit*>( controlWidget() );
+ return ::qobject_cast<QTextEdit*>( controlWidget() );
}
/*!
if ( ivState != Invalid && !myFilter.isEmpty() )
rgState = QRegExpValidator( QRegExp( myFilter ), 0 ).validate( input, pos );
- ivState = QMIN( ivState, rgState );
+ ivState = qMin( ivState, rgState );
return ivState;
}
if ( dvState != Invalid && !myFilter.isEmpty() )
rgState = QRegExpValidator( QRegExp( myFilter ), 0 ).validate( input, pos );
- dvState = QMIN( dvState, rgState );
+ dvState = qMin( dvState, rgState );
return dvState;
}
return Acceptable;
QString orig = input;
- if ( myFlags.contains( 'u', false ) )
- input = input.upper();
- if ( myFlags.contains( 'l', false ) )
- input = input.lower();
+ if ( myFlags.contains( 'u', Qt::CaseInsensitive ) )
+ input = input.toUpper();
+ if ( myFlags.contains( 'l', Qt::CaseInsensitive ) )
+ input = input.toLower();
State rgState = Acceptable;
State svState = orig == input ? Acceptable : Intermediate;
if ( !myFilter.isEmpty() )
rgState = QRegExpValidator( QRegExp( myFilter ), 0 ).validate( input, pos );
- svState = QMIN( svState, rgState );
+ svState = qMin( svState, rgState );
return svState;
}
#include "QDS.h"
-#include <qvalidator.h>
+#include <QValidator>
/*!
class QDS_IntegerValidator
CONFIG += ordered
SUBDIRS = Qtx
+SUBDIRS += DDS
+SUBDIRS += QDS
SUBDIRS += SUIT
SUBDIRS += SUITApp
SUBDIRS += STD