diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-29 16:05:55 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-29 16:05:55 +0000 |
commit | 87a016680e3677da3993f333561e79eb0cead7d5 (patch) | |
tree | cbda2b4df8b8ee0d8d1617e6c75bec1e3ee0ccba /src/iteminterface.cpp | |
parent | 6ce3d1ad09c1096b5ed3db334e02859e45d5c32b (diff) | |
download | ktechlab-87a016680e3677da3993f333561e79eb0cead7d5.tar.gz ktechlab-87a016680e3677da3993f333561e79eb0cead7d5.zip |
TQt4 port ktechlab
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/ktechlab@1238801 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/iteminterface.cpp')
-rw-r--r-- | src/iteminterface.cpp | 112 |
1 files changed, 56 insertions, 56 deletions
diff --git a/src/iteminterface.cpp b/src/iteminterface.cpp index 6b9c1af..c1b3521 100644 --- a/src/iteminterface.cpp +++ b/src/iteminterface.cpp @@ -26,9 +26,9 @@ #include <knuminput.h> #include <kurlrequester.h> #include <ktoolbar.h> -#include <qapplication.h> -#include <qlabel.h> -#include <qcheckbox.h> +#include <tqapplication.h> +#include <tqlabel.h> +#include <tqcheckbox.h> #include <assert.h> @@ -46,7 +46,7 @@ ItemInterface * ItemInterface::self( KTechlab * ktechlab ) ItemInterface::ItemInterface( KTechlab * ktechlab ) - : QObject(ktechlab), + : TQObject(ktechlab), p_ktechlab(ktechlab) { m_pActiveItemEditorToolBar = 0; @@ -74,8 +74,8 @@ void ItemInterface::slotItemDocumentChanged( ItemDocument * doc ) slotClearAll(); if ( ItemDocument * itemDocument = dynamic_cast<ItemDocument*>((Document*)p_cvb) ) { - disconnect( itemDocument, SIGNAL(itemSelected(Item*)), this, SLOT(slotUpdateItemInterface()) ); - disconnect( itemDocument, SIGNAL(itemUnselected(Item*)), this, SLOT(slotUpdateItemInterface()) ); + disconnect( itemDocument, TQT_SIGNAL(itemSelected(Item*)), this, TQT_SLOT(slotUpdateItemInterface()) ); + disconnect( itemDocument, TQT_SIGNAL(itemUnselected(Item*)), this, TQT_SLOT(slotUpdateItemInterface()) ); } p_itemGroup = 0l; @@ -86,8 +86,8 @@ void ItemInterface::slotItemDocumentChanged( ItemDocument * doc ) if (!p_cvb) return; - connect( p_cvb, SIGNAL(itemSelected(Item*)), this, SLOT(slotUpdateItemInterface()) ); - connect( p_cvb, SIGNAL(itemUnselected(Item*)), this, SLOT(slotUpdateItemInterface()) ); + connect( p_cvb, TQT_SIGNAL(itemSelected(Item*)), this, TQT_SLOT(slotUpdateItemInterface()) ); + connect( p_cvb, TQT_SIGNAL(itemUnselected(Item*)), this, TQT_SLOT(slotUpdateItemInterface()) ); p_itemGroup = p_cvb->selectList(); @@ -159,7 +159,7 @@ void ItemInterface::slotUpdateItemInterface() if ( m_pActiveItemEditorToolBar = dynamic_cast<KToolBar*>(p_ktechlab->factory()->container("itemEditorTB",itemView)) ) { m_pActiveItemEditorToolBar->setFullSize( true ); - QWidget * widget = configWidget(); + TQWidget * widget = configWidget(); m_toolBarWidgetID = 1; m_pActiveItemEditorToolBar->insertWidget( m_toolBarWidgetID, 0, widget ); } @@ -226,24 +226,24 @@ void ItemInterface::itemEditTBCleared() // The bool specifies whether advanced data should be shown -QWidget * ItemInterface::configWidget() +TQWidget * ItemInterface::configWidget() { if ( !p_itemGroup || !p_itemGroup->activeItem() || !m_pActiveItemEditorToolBar ) return 0l; VariantDataMap *variantMap = p_itemGroup->activeItem()->variantMap(); - QWidget * parent = m_pActiveItemEditorToolBar; + TQWidget * tqparent = m_pActiveItemEditorToolBar; - // Create new widget with the toolbar or dialog as the parent - QWidget * configWidget = new QWidget( parent, "tbConfigWidget" ); - configWidget->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding, 1, 1 ) ); + // Create new widget with the toolbar or dialog as the tqparent + TQWidget * configWidget = new TQWidget( tqparent, "tbConfigWidget" ); + configWidget->tqsetSizePolicy( TQSizePolicy( TQSizePolicy::MinimumExpanding, TQSizePolicy::MinimumExpanding, 1, 1 ) ); - QHBoxLayout * configLayout = new QHBoxLayout( configWidget ); + TQHBoxLayout * configLayout = new TQHBoxLayout( configWidget ); // configLayout->setAutoAdd( true ); configLayout->setSpacing( 6 ); -// configLayout->addItem( new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Fixed ) ); +// configLayout->addItem( new TQSpacerItem( 0, 0, TQSizePolicy::Expanding, TQSizePolicy::Fixed ) ); const VariantDataMap::iterator vaEnd = variantMap->end(); for ( VariantDataMap::iterator vait = variantMap->begin(); vait != vaEnd; ++vait ) @@ -254,11 +254,11 @@ QWidget * ItemInterface::configWidget() const Variant::Type::Value type = vait.data()->type(); // common to all types apart from bool - QString toolbarCaption = vait.data()->toolbarCaption(); + TQString toolbarCaption = vait.data()->toolbarCaption(); if ( type != Variant::Type::Bool && !toolbarCaption.isEmpty() ) - configLayout->addWidget( new QLabel( toolbarCaption, configWidget ) ); + configLayout->addWidget( new TQLabel( toolbarCaption, configWidget ) ); - QWidget * editWidget = 0l; // Should be set to the created widget + TQWidget * editWidget = 0l; // Should be set to the created widget switch( type ) { @@ -270,11 +270,11 @@ QWidget * ItemInterface::configWidget() case Variant::Type::KeyPad: case Variant::Type::SevenSegment: { - QString value = vait.data()->value().toString(); - if ( !value.isEmpty() && !vait.data()->allowed().contains(value) ) + TQString value = vait.data()->value().toString(); + if ( !value.isEmpty() && !vait.data()->allowed().tqcontains(value) ) vait.data()->appendAllowed(value); - const QStringList allowed = vait.data()->allowed(); + const TQStringList allowed = vait.data()->allowed(); KComboBox * box = new KComboBox(configWidget); @@ -285,23 +285,23 @@ QWidget * ItemInterface::configWidget() box->setEditable( true ); m_stringComboBoxMap[vait.key()] = box; - connectMapWidget( box, SIGNAL(textChanged(const QString &))); - connectMapWidget( box, SIGNAL(activated(const QString &))); + connectMapWidget( box, TQT_SIGNAL(textChanged(const TQString &))); + connectMapWidget( box, TQT_SIGNAL(activated(const TQString &))); editWidget = box; break; } case Variant::Type::FileName: { - QString value = vait.data()->value().toString(); - if ( !vait.data()->allowed().contains(value) ) + TQString value = vait.data()->value().toString(); + if ( !vait.data()->allowed().tqcontains(value) ) vait.data()->appendAllowed(value); - const QStringList allowed = vait.data()->allowed(); + const TQStringList allowed = vait.data()->allowed(); KURLComboRequester * urlreq = new KURLComboRequester( configWidget ); urlreq->setFilter( vait.data()->filter() ); - connectMapWidget( urlreq, SIGNAL(urlSelected(const QString &)) ); + connectMapWidget( urlreq, TQT_SIGNAL(urlSelected(const TQString &)) ); m_stringURLReqMap[vait.key()] = urlreq; KComboBox * box = urlreq->comboBox(); @@ -312,8 +312,8 @@ QWidget * ItemInterface::configWidget() urlreq->setURL( vait.data()->value().toString() ); // Generally we only want a file name once the user has finished typing out the full file name. - connectMapWidget( box, SIGNAL(returnPressed(const QString &))); - connectMapWidget( box, SIGNAL(activated(const QString &))); + connectMapWidget( box, TQT_SIGNAL(returnPressed(const TQString &))); + connectMapWidget( box, TQT_SIGNAL(activated(const TQString &))); editWidget = urlreq; break; @@ -323,7 +323,7 @@ QWidget * ItemInterface::configWidget() KLineEdit * edit = new KLineEdit( configWidget ); edit->setText( vait.data()->value().toString() ); - connectMapWidget(edit,SIGNAL(textChanged(const QString &))); + connectMapWidget(edit,TQT_SIGNAL(textChanged(const TQString &))); m_stringLineEditMap[vait.key()] = edit; editWidget = edit; break; @@ -332,7 +332,7 @@ QWidget * ItemInterface::configWidget() { KIntSpinBox *spin = new KIntSpinBox( (int)vait.data()->minValue(), (int)vait.data()->maxValue(), 1, vait.data()->value().toInt(), 10, configWidget ); - connectMapWidget( spin, SIGNAL(valueChanged(int)) ); + connectMapWidget( spin, TQT_SIGNAL(valueChanged(int)) ); m_intSpinBoxMap[vait.key()] = spin; editWidget = spin; break; @@ -341,19 +341,19 @@ QWidget * ItemInterface::configWidget() { DoubleSpinBox *spin = new DoubleSpinBox( vait.data()->minValue(), vait.data()->maxValue(), vait.data()->minAbsValue(), vait.data()->value().toDouble(), vait.data()->unit(), configWidget ); - connectMapWidget( spin, SIGNAL(valueChanged(double))); + connectMapWidget( spin, TQT_SIGNAL(valueChanged(double))); m_doubleSpinBoxMap[vait.key()] = spin; editWidget = spin; break; } case Variant::Type::Color: { - QColor value = vait.data()->value().toColor(); + TQColor value = vait.data()->value().toColor(); ColorCombo * colorBox = new ColorCombo( (ColorCombo::ColorScheme)vait.data()->colorScheme(), configWidget ); colorBox->setColor( value ); - connectMapWidget( colorBox, SIGNAL(activated(const QColor &))); + connectMapWidget( colorBox, TQT_SIGNAL(activated(const TQColor &))); m_colorComboMap[vait.key()] = colorBox; editWidget = colorBox; @@ -362,10 +362,10 @@ QWidget * ItemInterface::configWidget() case Variant::Type::Bool: { const bool value = vait.data()->value().toBool(); - QCheckBox * box = new QCheckBox( vait.data()->toolbarCaption(), configWidget ); + TQCheckBox * box = new TQCheckBox( vait.data()->toolbarCaption(), configWidget ); box->setChecked(value); - connectMapWidget( box, SIGNAL(toggled(bool))); + connectMapWidget( box, TQT_SIGNAL(toggled(bool))); m_boolCheckMap[vait.key()] = box; editWidget = box; break; @@ -385,8 +385,8 @@ QWidget * ItemInterface::configWidget() continue; // In the case of the toolbar, we don't want it too high - if ( editWidget->height() > parent->height()-2 ) - editWidget->setMaximumHeight( parent->height()-2 ); + if ( editWidget->height() > tqparent->height()-2 ) + editWidget->setMaximumHeight( tqparent->height()-2 ); switch ( type ) { @@ -394,9 +394,9 @@ QWidget * ItemInterface::configWidget() case Variant::Type::Combo: case Variant::Type::String: { - QSizePolicy p( QSizePolicy::MinimumExpanding, QSizePolicy::Fixed, 1, 1 ); + TQSizePolicy p( TQSizePolicy::MinimumExpanding, TQSizePolicy::Fixed, 1, 1 ); - editWidget->setSizePolicy( p ); + editWidget->tqsetSizePolicy( p ); editWidget->setMaximumWidth( 250 ); break; } @@ -422,15 +422,15 @@ QWidget * ItemInterface::configWidget() configLayout->addWidget( editWidget ); } - configLayout->addItem( new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + configLayout->addItem( new TQSpacerItem( 0, 0, TQSizePolicy::Expanding, TQSizePolicy::Fixed ) ); return configWidget; } -void ItemInterface::connectMapWidget( QWidget *widget, const char *_signal ) +void ItemInterface::connectMapWidget( TQWidget *widget, const char *_signal ) { - connect( widget, _signal, this, SLOT(tbDataChanged()) ); + connect( widget, _signal, this, TQT_SLOT(tbDataChanged()) ); } @@ -458,8 +458,8 @@ void ItemInterface::tbDataChanged() } // Bool values from checkboxes - const QCheckBoxMap::iterator m_boolCheckMapEnd = m_boolCheckMap.end(); - for ( QCheckBoxMap::iterator chit = m_boolCheckMap.begin(); chit != m_boolCheckMapEnd; ++chit ) + const TQCheckBoxMap::iterator m_boolCheckMapEnd = m_boolCheckMap.end(); + for ( TQCheckBoxMap::iterator chit = m_boolCheckMap.begin(); chit != m_boolCheckMapEnd; ++chit ) { slotSetData( chit.key(), chit.data()->isChecked() ); } @@ -476,7 +476,7 @@ void ItemInterface::tbDataChanged() const DoubleSpinBoxMap::iterator m_doubleSpinBoxMapEnd = m_doubleSpinBoxMap.end(); for ( DoubleSpinBoxMap::iterator sbit = m_doubleSpinBoxMap.begin(); sbit != m_doubleSpinBoxMapEnd; ++sbit ) { -// VariantDataMap::iterator vait = variantData.find(sbit.key()); +// VariantDataMap::iterator vait = variantData.tqfind(sbit.key()); slotSetData( sbit.key(), sbit.data()->value() ); } @@ -494,7 +494,7 @@ void ItemInterface::tbDataChanged() -void ItemInterface::slotSetData( const QString &id, QVariant value ) +void ItemInterface::slotSetData( const TQString &id, TQVariant value ) { if ( !p_itemGroup || (p_itemGroup->itemCount() == 0) ) return; @@ -517,7 +517,7 @@ void ItemInterface::slotSetData( const QString &id, QVariant value ) VariantDataMap * variantMap = (*itemList.begin())->variantMap(); - VariantDataMap::iterator it = variantMap->find(id); + VariantDataMap::iterator it = variantMap->tqfind(id); if ( it == variantMap->end() ) return; @@ -529,13 +529,13 @@ void ItemInterface::slotSetData( const QString &id, QVariant value ) { case Variant::Type::String: { - KLineEditMap::iterator mit = m_stringLineEditMap.find(id); + KLineEditMap::iterator mit = m_stringLineEditMap.tqfind(id); if ( mit != m_stringLineEditMap.end() ) mit.data()->setText( it.data()->value().toString() ); break; } case Variant::Type::FileName: { - KURLReqMap::iterator mit = m_stringURLReqMap.find(id); + KURLReqMap::iterator mit = m_stringURLReqMap.tqfind(id); if ( mit != m_stringURLReqMap.end() ) mit.data()->setURL( it.data()->value().toString() ); break; } @@ -549,13 +549,13 @@ void ItemInterface::slotSetData( const QString &id, QVariant value ) case Variant::Type::SevenSegment: case Variant::Type::KeyPad: { - KComboBoxMap::iterator mit = m_stringComboBoxMap.find(id); + KComboBoxMap::iterator mit = m_stringComboBoxMap.tqfind(id); if ( mit != m_stringComboBoxMap.end() ) mit.data()->setCurrentItem( it.data()->value().toString() ); break; } case Variant::Type::Int: { - IntSpinBoxMap::iterator mit = m_intSpinBoxMap.find(id); + IntSpinBoxMap::iterator mit = m_intSpinBoxMap.tqfind(id); if ( mit != m_intSpinBoxMap.end() ) { KIntSpinBox *sb = mit.data(); sb->setValue( it.data()->value().toInt() ); @@ -564,7 +564,7 @@ void ItemInterface::slotSetData( const QString &id, QVariant value ) } case Variant::Type::Double: { - DoubleSpinBoxMap::iterator mit = m_doubleSpinBoxMap.find(id); + DoubleSpinBoxMap::iterator mit = m_doubleSpinBoxMap.tqfind(id); if ( mit != m_doubleSpinBoxMap.end() ) { DoubleSpinBox *sb = mit.data(); sb->setValue( it.data()->value().toDouble() ); @@ -573,13 +573,13 @@ void ItemInterface::slotSetData( const QString &id, QVariant value ) } case Variant::Type::Color: { - ColorComboMap::iterator mit = m_colorComboMap.find(id); + ColorComboMap::iterator mit = m_colorComboMap.tqfind(id); if ( mit != m_colorComboMap.end() ) mit.data()->setColor( it.data()->value().toColor() ); break; } case Variant::Type::Bool: { - QCheckBoxMap::iterator mit = m_boolCheckMap.find(id); + TQCheckBoxMap::iterator mit = m_boolCheckMap.tqfind(id); if ( mit != m_boolCheckMap.end() ) mit.data()->setChecked( it.data()->value().toBool() ); break; } |