From 42957a3f812a1db64a9ae452baa2d3fbc35f2466 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Mon, 12 Aug 2024 22:02:11 +0900 Subject: Rename more widget nt* related files to equivalent tq* Signed-off-by: Michele Calgaro --- doc/html/dirview-example.html | 156 +++++++++++++++++++++--------------------- 1 file changed, 78 insertions(+), 78 deletions(-) (limited to 'doc/html/dirview-example.html') diff --git a/doc/html/dirview-example.html b/doc/html/dirview-example.html index a896745ae..06227af62 100644 --- a/doc/html/dirview-example.html +++ b/doc/html/dirview-example.html @@ -52,7 +52,7 @@ Drag&Drop in a listview. #ifndef DIRVIEW_H #define DIRVIEW_H -#include <ntqlistview.h> +#include <tqlistview.h> #include <tqstring.h> #include <tqfile.h> #include <tqfileinfo.h> @@ -64,11 +64,11 @@ class TQDragMoveEvent; class TQDragLeaveEvent; class TQDropEvent; -class FileItem : public TQListViewItem +class FileItem : public TQListViewItem { public: - FileItem( TQListViewItem *parent, const TQString &s1, const TQString &s2 ) - : TQListViewItem( parent, s1, s2 ), pix( 0 ) {} + FileItem( TQListViewItem *parent, const TQString &s1, const TQString &s2 ) + : TQListViewItem( parent, s1, s2 ), pix( 0 ) {} const TQPixmap *pixmap( int i ) const; #if !defined(Q_NO_USING_KEYWORD) @@ -81,12 +81,12 @@ private: }; -class Directory : public TQListViewItem +class Directory : public TQListViewItem { public: - Directory( TQListView * parent, const TQString& filename ); + Directory( TQListView * parent, const TQString& filename ); Directory( Directory * parent, const TQString& filename, const TQString &col2 ) - : TQListViewItem( parent, filename, col2 ), pix( 0 ) {} + : TQListViewItem( parent, filename, col2 ), pix( 0 ) {} Directory( Directory * parent, const TQString& filename ); TQString text( int column ) const; @@ -111,7 +111,7 @@ private: }; -class DirectoryView : public TQListView +class DirectoryView : public TQListView { TQ_OBJECT @@ -126,7 +126,7 @@ signals: void folderSelected( const TQString & ); protected slots: - void slotFolderSelected( TQListViewItem * ); + void slotFolderSelected( TQListViewItem * ); void openFolder(); protected: @@ -141,8 +141,8 @@ protected: private: TQString fullPath(TQListViewItem* item); bool dirsOnly; - TQListViewItem *oldCurrent; - TQListViewItem *dropItem; + TQListViewItem *oldCurrent; + TQListViewItem *dropItem; TQTimer* autoopen_timer; TQPoint presspos; bool mousePressed; @@ -181,7 +181,7 @@ can be used in any other trees. #include <tqstrlist.h> #include <tqstringlist.h> #include <ntqapplication.h> -#include <ntqheader.h> +#include <tqheader.h> static const char* folder_closed_xpm[]={ "16 16 9 1", @@ -308,7 +308,7 @@ TQPixmap *fileNormal = 0; *****************************************************************************/ Directory::Directory( Directory * parent, const TQString& filename ) - : TQListViewItem( parent ), f(filename), + : TQListViewItem( parent ), f(filename), showDirsOnly( parent->showDirsOnly ), pix( 0 ) { @@ -316,14 +316,14 @@ TQPixmap *fileNormal = 0; readable = TQDir( fullName() ).isReadable(); if ( !readable ) - setPixmap( folderLocked ); + setPixmap( folderLocked ); else - setPixmap( folderClosed ); + setPixmap( folderClosed ); } -Directory::Directory( TQListView * parent, const TQString& filename ) - : TQListViewItem( parent ), f(filename), +Directory::Directory( TQListView * parent, const TQString& filename ) + : TQListViewItem( parent ), f(filename), showDirsOnly( ( (DirectoryView*)parent )->showDirsOnly() ), pix( 0 ) { @@ -332,52 +332,52 @@ Directory::Directory( TQListView * parent, const } -void Directory::setPixmap( TQPixmap *px ) +void Directory::setPixmap( TQPixmap *px ) { pix = px; - setup(); - widthChanged( 0 ); - invalidateHeight(); - repaint(); + setup(); + widthChanged( 0 ); + invalidateHeight(); + repaint(); } -const TQPixmap *Directory::pixmap( int i ) const +const TQPixmap *Directory::pixmap( int i ) const { if ( i ) return 0; return pix; } -void Directory::setOpen( bool o ) +void Directory::setOpen( bool o ) { if ( o ) - setPixmap( folderOpen ); + setPixmap( folderOpen ); else - setPixmap( folderClosed ); + setPixmap( folderClosed ); if ( o && !childCount() ) { TQString s( fullName() ); TQDir thisDir( s ); if ( !thisDir.isReadable() ) { readable = FALSE; - setExpandable( FALSE ); + setExpandable( FALSE ); return; } - listView()->setUpdatesEnabled( FALSE ); + listView()->setUpdatesEnabled( FALSE ); const TQFileInfoList * files = thisDir.entryInfoList(); if ( files ) { TQFileInfoListIterator it( *files ); TQFileInfo * fi; - while( (fi=it.current()) != 0 ) { + while( (fi=it.current()) != 0 ) { ++it; if ( fi->fileName() == "." || fi->fileName() == ".." ) ; // nothing else if ( fi->isSymLink() && !showDirsOnly ) { FileItem *item = new FileItem( this, fi->fileName(), "Symbolic Link" ); - item->setPixmap( fileNormal ); + item->setPixmap( fileNormal ); } else if ( fi->isDir() ) (void)new Directory( this, fi->fileName() ); @@ -385,20 +385,20 @@ Directory::Directory( TQListView * parent, const FileItem *item = new FileItem( this, fi->fileName(), fi->isFile()?"File":"Special" ); - item->setPixmap( fileNormal ); + item->setPixmap( fileNormal ); } } } listView()->setUpdatesEnabled( TRUE ); } - TQListViewItem::setOpen( o ); + TQListViewItem::setOpen( o ); } -void Directory::setup() +void Directory::setup() { setExpandable( TRUE ); - TQListViewItem::setup(); + TQListViewItem::setup(); } @@ -416,7 +416,7 @@ TQString Directory::fullName() } -TQString Directory::text( int column ) const +TQString Directory::text( int column ) const { if ( column == 0 ) return f.name(); @@ -433,7 +433,7 @@ TQString Directory::fullName() *****************************************************************************/ DirectoryView::DirectoryView( TQWidget *parent, const char *name, bool sdo ) - : TQListView( parent, name ), dirsOnly( sdo ), oldCurrent( 0 ), + : TQListView( parent, name ), dirsOnly( sdo ), oldCurrent( 0 ), dropItem( 0 ), mousePressed( FALSE ) { autoopen_timer = new TQTimer( this ); @@ -444,10 +444,10 @@ TQString Directory::fullName() fileNormal = new TQPixmap( pix_file ); } - connect( this, TQ_SIGNAL( doubleClicked( TQListViewItem * ) ), - this, TQ_SLOT( slotFolderSelected( TQListViewItem * ) ) ); - connect( this, TQ_SIGNAL( returnPressed( TQListViewItem * ) ), - this, TQ_SLOT( slotFolderSelected( TQListViewItem * ) ) ); + connect( this, TQ_SIGNAL( doubleClicked( TQListViewItem * ) ), + this, TQ_SLOT( slotFolderSelected( TQListViewItem * ) ) ); + connect( this, TQ_SIGNAL( returnPressed( TQListViewItem * ) ), + this, TQ_SLOT( slotFolderSelected( TQListViewItem * ) ) ); setAcceptDrops( TRUE ); viewport()->setAcceptDrops( TRUE ); @@ -456,7 +456,7 @@ TQString Directory::fullName() this, TQ_SLOT( openFolder() ) ); } -void DirectoryView::slotFolderSelected( TQListViewItem *i ) +void DirectoryView::slotFolderSelected( TQListViewItem *i ) { if ( !i || !showDirsOnly() ) return; @@ -484,9 +484,9 @@ static const int autoopenTime = 750; return; } - oldCurrent = currentItem(); + oldCurrent = currentItem(); - TQListViewItem *i = itemAt( contentsToViewport(e->pos()) ); + TQListViewItem *i = itemAt( contentsToViewport(e->pos()) ); if ( i ) { dropItem = i; autoopen_timer->start( autoopenTime ); @@ -502,9 +502,9 @@ static const int autoopenTime = 750; } TQPoint vp = contentsToViewport( ( (TQDragMoveEvent*)e )->pos() ); - TQListViewItem *i = itemAt( vp ); + TQListViewItem *i = itemAt( vp ); if ( i ) { - setSelected( i, TRUE ); + setSelected( i, TRUE ); e->accept(); if ( i != dropItem ) { autoopen_timer->stop(); @@ -535,8 +535,8 @@ static const int autoopenTime = 750; autoopen_timer->stop(); dropItem = 0; - setCurrentItem( oldCurrent ); - setSelected( oldCurrent, TRUE ); + setCurrentItem( oldCurrent ); + setSelected( oldCurrent, TRUE ); } void DirectoryView::contentsDropEvent( TQDropEvent *e ) @@ -548,7 +548,7 @@ static const int autoopenTime = 750; return; } - TQListViewItem *item = itemAt( contentsToViewport(e->pos()) ); + TQListViewItem *item = itemAt( contentsToViewport(e->pos()) ); if ( item ) { TQStrList lst; @@ -593,12 +593,12 @@ static const int autoopenTime = 750; TQString DirectoryView::fullPath(TQListViewItem* item) { - TQString fullpath = item->text(0); - while ( (item=item->parent()) ) { - if ( item->parent() ) - fullpath = item->text(0) + "/" + fullpath; + TQString fullpath = item->text(0); + while ( (item=item->parent()) ) { + if ( item->parent() ) + fullpath = item->text(0) + "/" + fullpath; else - fullpath = item->text(0) + fullpath; + fullpath = item->text(0) + fullpath; } #ifdef TQ_WS_WIN if (fullpath.length() > 2 && fullpath[1] != ':') { @@ -610,15 +610,15 @@ TQString DirectoryView::fullPath(TQListViewItem* item) return fullpath; } -void DirectoryView::contentsMousePressEvent( TQMouseEvent* e ) +void DirectoryView::contentsMousePressEvent( TQMouseEvent* e ) { - TQListView::contentsMousePressEvent(e); + TQListView::contentsMousePressEvent(e); TQPoint p( contentsToViewport( e->pos() ) ); - TQListViewItem *i = itemAt( p ); + TQListViewItem *i = itemAt( p ); if ( i ) { // if the user clicked into the root decoration of the item, don't try to start a drag! if ( p.x() > header()->cellPos( header()->mapToActual( 0 ) ) + - treeStepSize() * ( i->depth() + ( rootIsDecorated() ? 1 : 0) ) + itemMargin() || + treeStepSize() * ( i->depth() + ( rootIsDecorated() ? 1 : 0) ) + itemMargin() || p.x() < header()->cellPos( header()->mapToActual( 0 ) ) ) { presspos = e->pos(); mousePressed = TRUE; @@ -626,11 +626,11 @@ TQString DirectoryView::fullPath(TQListViewItem* item) } } -void DirectoryView::contentsMouseMoveEvent( TQMouseEvent* e ) +void DirectoryView::contentsMouseMoveEvent( TQMouseEvent* e ) { if ( mousePressed && ( presspos - e->pos() ).manhattanLength() > TQApplication::startDragDistance() ) { mousePressed = FALSE; - TQListViewItem *item = itemAt( contentsToViewport(presspos) ); + TQListViewItem *item = itemAt( contentsToViewport(presspos) ); if ( item ) { TQString source = fullPath(item); if ( TQFile::exists(source) ) { @@ -644,29 +644,29 @@ TQString DirectoryView::fullPath(TQListViewItem* item) } } -void DirectoryView::contentsMouseReleaseEvent( TQMouseEvent * ) +void DirectoryView::contentsMouseReleaseEvent( TQMouseEvent * ) { mousePressed = FALSE; } void DirectoryView::setDir( const TQString &s ) { - TQListViewItemIterator it( this ); + TQListViewItemIterator it( this ); ++it; - for ( ; it.current(); ++it ) { - it.current()->setOpen( FALSE ); + for ( ; it.current(); ++it ) { + it.current()->setOpen( FALSE ); } TQStringList lst( TQStringList::split( "/", s ) ); - TQListViewItem *item = firstChild(); + TQListViewItem *item = firstChild(); TQStringList::Iterator it2 = lst.begin(); for ( ; it2 != lst.end(); ++it2 ) { while ( item ) { - if ( item->text( 0 ) == *it2 ) { - item->setOpen( TRUE ); + if ( item->text( 0 ) == *it2 ) { + item->setOpen( TRUE ); break; } - item = item->itemBelow(); + item = item->itemBelow(); } } @@ -674,17 +674,17 @@ void DirectoryView::setDir( const TQS setCurrentItem( item ); } -void FileItem::setPixmap( TQPixmap *p ) +void FileItem::setPixmap( TQPixmap *p ) { pix = p; - setup(); - widthChanged( 0 ); - invalidateHeight(); - repaint(); + setup(); + widthChanged( 0 ); + invalidateHeight(); + repaint(); } -const TQPixmap *FileItem::pixmap( int i ) const +const TQPixmap *FileItem::pixmap( int i ) const { if ( i ) return 0; @@ -715,9 +715,9 @@ int main( int argc, char ** argv ) DirectoryView mw; - mw.addColumn( "Name" ); - mw.addColumn( "Type" ); - mw.setTreeStepSize( 20 ); + mw.addColumn( "Name" ); + mw.addColumn( "Type" ); + mw.setTreeStepSize( 20 ); const TQFileInfoList* roots = TQDir::drives(); TQPtrListIterator<TQFileInfo> i(*roots); @@ -726,12 +726,12 @@ int main( int argc, char ** argv ) ++i; Directory * root = new Directory( &mw, fi->filePath() ); if ( roots->count() <= 1 ) - root->setOpen( TRUE ); // be interesting + root->setOpen( TRUE ); // be interesting } mw.resize( 400, 400 ); mw.setCaption( "TQt Example - Directory Browser" ); - mw.setAllColumnsShowFocus( TRUE ); + mw.setAllColumnsShowFocus( TRUE ); a.setMainWidget( &mw ); mw.show(); -- cgit v1.2.3