Пример #1
0
bool QtFileIconView::qt_invoke( int _id, QUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: setDirectory((const QString&)static_QUType_QString.get(_o+1)); break;
    case 1: setDirectory((const QDir&)*((const QDir*)static_QUType_ptr.get(_o+1))); break;
    case 2: newDirectory(); break;
    case 3: currentDir(); break;
    case 4: itemDoubleClicked((QIconViewItem*)static_QUType_ptr.get(_o+1)); break;
    case 5: slotDropped((QDropEvent*)static_QUType_ptr.get(_o+1),(const QValueList<QIconDragItem>&)*((const QValueList<QIconDragItem>*)static_QUType_ptr.get(_o+2))); break;
    case 6: viewLarge(); break;
    case 7: viewSmall(); break;
    case 8: viewBottom(); break;
    case 9: viewRight(); break;
    case 10: flowEast(); break;
    case 11: flowSouth(); break;
    case 12: itemTextTruncate(); break;
    case 13: itemTextWordWrap(); break;
    case 14: sortAscending(); break;
    case 15: sortDescending(); break;
    case 16: arrangeItemsInGrid(); break;
    case 17: slotRightPressed((QIconViewItem*)static_QUType_ptr.get(_o+1)); break;
    case 18: openFolder(); break;
    default:
	return QIconView::qt_invoke( _id, _o );
    }
    return TRUE;
}
Пример #2
0
void QtFileIconView::slotRightPressed( QIconViewItem *item )
{
    if ( !item ) { // right pressed on viewport
        QPopupMenu menu( this );

        menu.insertItem( "&Large view", this, SLOT( viewLarge() ) );
        menu.insertItem( "&Small view", this, SLOT( viewSmall() ) );
        menu.insertSeparator();
        menu.insertItem( "Text at the &bottom", this, SLOT( viewBottom() ) );
        menu.insertItem( "Text at the &right", this, SLOT( viewRight() ) );
        menu.insertSeparator();
        menu.insertItem( "Arrange l&eft to right", this, SLOT( flowEast() ) );
        menu.insertItem( "Arrange t&op to bottom", this, SLOT( flowSouth() ) );
        menu.insertSeparator();
        menu.insertItem( "&Truncate item text", this, SLOT( itemTextTruncate() ) );
        menu.insertItem( "&Wordwrap item text", this, SLOT( itemTextWordWrap() ) );
        menu.insertSeparator();
        menu.insertItem( "Arrange items in &grid", this, SLOT( arrangeItemsInGrid() ) );
        menu.insertSeparator();
        menu.insertItem( "Sort &ascending", this, SLOT( sortAscending() ) );
        menu.insertItem( "Sort &descending", this, SLOT( sortDescending() ) );

        menu.setMouseTracking( TRUE );
        menu.exec( QCursor::pos() );
    } else { // on item
        QPopupMenu menu( this );

        int RENAME_ITEM = menu.insertItem( "Rename Item" );
        int REMOVE_ITEM = menu.insertItem( "Remove Item" );

        menu.setMouseTracking( TRUE );
        int id = menu.exec( QCursor::pos() );

        if ( id == -1 )
            return;

        if ( id == RENAME_ITEM && item->renameEnabled() ) {
            item->rename();
        } else if ( id == REMOVE_ITEM ) {
            delete item;
            QMessageBox::information( this, "Not implemented!", "Deleting files not implemented yet,\n"
                                      "The item has only been removed from the view! " );
        }
    }
}