summaryrefslogtreecommitdiffstats
path: root/src/gui/itemselector.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/itemselector.cpp')
-rw-r--r--src/gui/itemselector.cpp154
1 files changed, 77 insertions, 77 deletions
diff --git a/src/gui/itemselector.cpp b/src/gui/itemselector.cpp
index f85756e..c02fffd 100644
--- a/src/gui/itemselector.cpp
+++ b/src/gui/itemselector.cpp
@@ -23,23 +23,23 @@
#include <kdebug.h>
#include <klocale.h>
-#include <qdragobject.h>
-#include <qlayout.h>
-#include <qpopupmenu.h>
-#include <qwhatsthis.h>
+#include <tqdragobject.h>
+#include <tqlayout.h>
+#include <tqpopupmenu.h>
+#include <tqwhatsthis.h>
#include <assert.h>
-ILVItem::ILVItem( QListView* parent, const QString &id )
- : KListViewItem( parent, 0 )
+ILVItem::ILVItem( TQListView* tqparent, const TQString &id )
+ : KListViewItem( tqparent, 0 )
{
m_id = id;
b_isRemovable = false;
m_pProjectItem = 0l;
}
-ILVItem::ILVItem( QListViewItem* parent, const QString &id )
- : KListViewItem( parent, 0 )
+ILVItem::ILVItem( TQListViewItem* tqparent, const TQString &id )
+ : KListViewItem( tqparent, 0 )
{
m_id = id;
b_isRemovable = false;
@@ -47,8 +47,8 @@ ILVItem::ILVItem( QListViewItem* parent, const QString &id )
}
-ItemSelector::ItemSelector( QWidget *parent, const char *name )
- : KListView( parent, name )
+ItemSelector::ItemSelector( TQWidget *tqparent, const char *name )
+ : KListView( tqparent, name )
{
addColumn( i18n( "Component" ) );
setFullWidth(true);
@@ -56,10 +56,10 @@ ItemSelector::ItemSelector( QWidget *parent, const char *name )
setRootIsDecorated(true);
setDragEnabled(true);
-// connect( this, SIGNAL(executed(QListViewItem*) ), this, SLOT(slotItemExecuted(QListViewItem*)) );
- connect( this, SIGNAL(clicked(QListViewItem*)), this, SLOT(slotItemClicked(QListViewItem*)) );
- connect( this, SIGNAL(doubleClicked(QListViewItem*)), this, SLOT(slotItemDoubleClicked(QListViewItem*)) );
- connect( this, SIGNAL(contextMenuRequested(QListViewItem*, const QPoint&, int )), this, SLOT(slotContextMenuRequested(QListViewItem*, const QPoint&, int )) );
+// connect( this, TQT_SIGNAL(executed(TQListViewItem*) ), this, TQT_SLOT(slotItemExecuted(TQListViewItem*)) );
+ connect( this, TQT_SIGNAL(clicked(TQListViewItem*)), this, TQT_SLOT(slotItemClicked(TQListViewItem*)) );
+ connect( this, TQT_SIGNAL(doubleClicked(TQListViewItem*)), this, TQT_SLOT(slotItemDoubleClicked(TQListViewItem*)) );
+ connect( this, TQT_SIGNAL(contextMenuRequested(TQListViewItem*, const TQPoint&, int )), this, TQT_SLOT(slotContextMenuRequested(TQListViewItem*, const TQPoint&, int )) );
}
ItemSelector::~ItemSelector()
@@ -75,11 +75,11 @@ void ItemSelector::clear()
}
-void ItemSelector::addItem( const QString & caption, const QString & id, const QString & _category, const QPixmap & icon, bool removable )
+void ItemSelector::addItem( const TQString & caption, const TQString & id, const TQString & _category, const TQPixmap & icon, bool removable )
{
- ILVItem *parentItem = 0L;
+ ILVItem *tqparentItem = 0L;
- QString category = _category;
+ TQString category = _category;
if ( !category.startsWith("/") ) {
category.prepend('/');
}
@@ -87,44 +87,44 @@ void ItemSelector::addItem( const QString & caption, const QString & id, const Q
do
{
category.remove(0,1);
- QString cat;
- category.replace( "\\/", "|" );
- int pos = category.find('/');
+ TQString cat;
+ category.tqreplace( "\\/", "|" );
+ int pos = category.tqfind('/');
if ( pos == -1 ) cat = category;
else cat = category.left( pos );
- cat.replace( "|", "/" );
+ cat.tqreplace( "|", "/" );
- if ( m_categories.findIndex(cat) == -1 )
+ if ( m_categories.tqfindIndex(cat) == -1 )
{
m_categories.append(cat);
- if (parentItem) {
- parentItem = new ILVItem( parentItem, "" );
+ if (tqparentItem) {
+ tqparentItem = new ILVItem( tqparentItem, "" );
}
else {
- parentItem = new ILVItem( this, "" );
+ tqparentItem = new ILVItem( this, "" );
}
- parentItem->setOpen( readOpenState(cat) );
+ tqparentItem->setOpen( readOpenState(cat) );
- parentItem->setExpandable(true);
- parentItem->setText( 0, cat );
+ tqparentItem->setExpandable(true);
+ tqparentItem->setText( 0, cat );
}
else
{
- parentItem = (ILVItem*)findItem( cat, 0 );
+ tqparentItem = (ILVItem*)tqfindItem( cat, 0 );
}
category.remove( 0, pos );
- } while ( category.contains('/') );
+ } while ( category.tqcontains('/') );
- if ( !parentItem )
+ if ( !tqparentItem )
{
- kdError() << "Unexpected error in finding parent item for category list"<<endl;
+ kdError() << "Unexpected error in finding tqparent item for category list"<<endl;
return;
}
- ILVItem *item = new ILVItem( parentItem, id );
+ ILVItem *item = new ILVItem( tqparentItem, id );
item->setPixmap( 0, icon );
item->setText( 0, caption );
item->setRemovable(removable);
@@ -136,10 +136,10 @@ void ItemSelector::writeOpenStates()
KConfig *config = kapp->config();
config->setGroup( name() );
- const QStringList::iterator end = m_categories.end();
- for ( QStringList::iterator it = m_categories.begin(); it != end; ++it )
+ const TQStringList::iterator end = m_categories.end();
+ for ( TQStringList::iterator it = m_categories.begin(); it != end; ++it )
{
- QListViewItem *item = findItem( *it, 0 );
+ TQListViewItem *item = tqfindItem( *it, 0 );
if (item) {
config->writeEntry( *it+"IsOpen", item->isOpen() );
}
@@ -147,7 +147,7 @@ void ItemSelector::writeOpenStates()
}
-bool ItemSelector::readOpenState( const QString &id )
+bool ItemSelector::readOpenState( const TQString &id )
{
KConfig *config = kapp->config();
config->setGroup( name() );
@@ -156,14 +156,14 @@ bool ItemSelector::readOpenState( const QString &id )
}
-void ItemSelector::slotContextMenuRequested( QListViewItem* item, const QPoint& pos, int /*col*/ )
+void ItemSelector::slotContextMenuRequested( TQListViewItem* item, const TQPoint& pos, int /*col*/ )
{
if ( !item || !(static_cast<ILVItem*>(item))->isRemovable() ) {
return;
}
- QPopupMenu *menu = new QPopupMenu(this);
- menu->insertItem( i18n("Remove %1").arg(item->text(0)), this, SLOT(slotRemoveSelectedItem()), Qt::Key_Delete );
+ TQPopupMenu *menu = new TQPopupMenu(this);
+ menu->insertItem( i18n("Remove %1").tqarg(item->text(0)), this, TQT_SLOT(slotRemoveSelectedItem()), TQt::Key_Delete );
menu->popup(pos);
}
@@ -175,25 +175,25 @@ void ItemSelector::slotRemoveSelectedItem()
return;
emit itemRemoved( item->key( 0, 0 ) );
- ILVItem *parent = dynamic_cast<ILVItem*>(item->QListViewItem::parent());
+ ILVItem *tqparent = dynamic_cast<ILVItem*>(item->TQListViewItem::tqparent());
delete item;
- // Get rid of the category as well if it has no children
- if ( parent && !parent->firstChild() )
+ // Get rid of the category as well if it has no tqchildren
+ if ( tqparent && !tqparent->firstChild() )
{
- m_categories.remove(parent->text(0));
- delete parent;
+ m_categories.remove(tqparent->text(0));
+ delete tqparent;
}
}
-void ItemSelector::setListCaption( const QString &caption )
+void ItemSelector::setListCaption( const TQString &caption )
{
setColumnText( 0, caption );
}
-void ItemSelector::slotItemClicked( QListViewItem *item )
+void ItemSelector::slotItemClicked( TQListViewItem *item )
{
if (!item)
return;
@@ -205,12 +205,12 @@ void ItemSelector::slotItemClicked( QListViewItem *item )
}
-void ItemSelector::slotItemDoubleClicked( QListViewItem *item )
+void ItemSelector::slotItemDoubleClicked( TQListViewItem *item )
{
if (!item)
return;
- QString id = item->key( 0, 0 );
+ TQString id = item->key( 0, 0 );
if ( Document * doc = DocManager::self()->getFocusedDocument() )
{
@@ -228,34 +228,34 @@ void ItemSelector::slotItemDoubleClicked( QListViewItem *item )
}
-QDragObject* ItemSelector::dragObject()
+TQDragObject* ItemSelector::dragObject()
{
- const QString id = currentItem()->key(0,0);
+ const TQString id = currentItem()->key(0,0);
- QStoredDrag * d = 0l;
+ TQStoredDrag * d = 0l;
if ( id.startsWith("flow/") )
- d = new QStoredDrag( "ktechlab/flowpart", this );
+ d = new TQStoredDrag( "ktechlab/flowpart", this );
else if ( id.startsWith("ec/") )
- d = new QStoredDrag( "ktechlab/component", this );
+ d = new TQStoredDrag( "ktechlab/component", this );
else if ( id.startsWith("sc/") )
- d = new QStoredDrag( "ktechlab/subcircuit", this );
+ d = new TQStoredDrag( "ktechlab/subcircuit", this );
else if ( id.startsWith("mech/") )
- d = new QStoredDrag( "ktechlab/mechanical", this );
+ d = new TQStoredDrag( "ktechlab/mechanical", this );
if (d)
{
- QByteArray data;
- QDataStream stream( data, IO_WriteOnly );
+ TQByteArray data;
+ TQDataStream stream( data, IO_WriteOnly );
stream << id;
d->setEncodedData(data);
}
// A pixmap cursor is often hard to make out
-// QPixmap *pixmap = const_cast<QPixmap*>(currentItem()->pixmap(0));
+// TQPixmap *pixmap = const_cast<TQPixmap*>(currentItem()->pixmap(0));
// if (pixmap) d->setPixmap(*pixmap);
return d;
@@ -267,21 +267,21 @@ QDragObject* ItemSelector::dragObject()
ComponentSelector * ComponentSelector::m_pSelf = 0l;
-ComponentSelector * ComponentSelector::self( KateMDI::ToolView * parent )
+ComponentSelector * ComponentSelector::self( KateMDI::ToolView * tqparent )
{
if (!m_pSelf)
{
- assert(parent);
- m_pSelf = new ComponentSelector(parent);
+ assert(tqparent);
+ m_pSelf = new ComponentSelector(tqparent);
}
return m_pSelf;
}
-ComponentSelector::ComponentSelector( KateMDI::ToolView * parent )
- : ItemSelector( (QWidget*)parent, "Component Selector" )
+ComponentSelector::ComponentSelector( KateMDI::ToolView * tqparent )
+ : ItemSelector( (TQWidget*)tqparent, "Component Selector" )
{
- QWhatsThis::add( this, i18n(
+ TQWhatsThis::add( this, i18n(
"Add components to the circuit diagram by dragging them into the circuit.<br><br>"
"To add more than one component of the same type, doubleclick on a component, and click repeatedly in the circuit to place the component. Right click to stop placement.<br><br>"
@@ -307,21 +307,21 @@ ComponentSelector::ComponentSelector( KateMDI::ToolView * parent )
FlowPartSelector * FlowPartSelector::m_pSelf = 0l;
-FlowPartSelector * FlowPartSelector::self( KateMDI::ToolView * parent )
+FlowPartSelector * FlowPartSelector::self( KateMDI::ToolView * tqparent )
{
if (!m_pSelf)
{
- assert(parent);
- m_pSelf = new FlowPartSelector(parent);
+ assert(tqparent);
+ m_pSelf = new FlowPartSelector(tqparent);
}
return m_pSelf;
}
-FlowPartSelector::FlowPartSelector( KateMDI::ToolView * parent )
- : ItemSelector( (QWidget*)parent, "Part Selector" )
+FlowPartSelector::FlowPartSelector( KateMDI::ToolView * tqparent )
+ : ItemSelector( (TQWidget*)tqparent, "Part Selector" )
{
- QWhatsThis::add( this, i18n("Add FlowPart to the FlowCode document by dragging them there.<br><br>To add more than one FlowPart of the same type, doubleclick on a FlowPart, and click repeatedly in the FlowChart to place the component. Right click to stop placement.") );
+ TQWhatsThis::add( this, i18n("Add FlowPart to the FlowCode document by dragging them there.<br><br>To add more than one FlowPart of the same type, doubleclick on a FlowPart, and click repeatedly in the FlowChart to place the component. Right click to stop placement.") );
setListCaption( i18n("Flow Part") );
@@ -340,21 +340,21 @@ FlowPartSelector::FlowPartSelector( KateMDI::ToolView * parent )
MechanicsSelector * MechanicsSelector::m_pSelf = 0l;
-MechanicsSelector * MechanicsSelector::self( KateMDI::ToolView * parent )
+MechanicsSelector * MechanicsSelector::self( KateMDI::ToolView * tqparent )
{
if (!m_pSelf)
{
- assert(parent);
- m_pSelf = new MechanicsSelector( (QWidget*)parent );
+ assert(tqparent);
+ m_pSelf = new MechanicsSelector( (TQWidget*)tqparent );
}
return m_pSelf;
}
-MechanicsSelector::MechanicsSelector( QWidget *parent )
- : ItemSelector( (QWidget*)parent, "Mechanics Selector" )
+MechanicsSelector::MechanicsSelector( TQWidget *tqparent )
+ : ItemSelector( (TQWidget*)tqparent, "Mechanics Selector" )
{
- QWhatsThis::add( this, i18n("Add mechanical parts to the mechanics work area by dragging them there.") );
+ TQWhatsThis::add( this, i18n("Add mechanical parts to the mechanics work area by dragging them there.") );
LibraryItemList *items = itemLibrary()->items();
const LibraryItemList::iterator end = items->end();