⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 editfunctionsimpl.cpp

📁 Linux下的基于X11的图形开发环境。
💻 CPP
📖 第 1 页 / 共 2 页
字号:
    i->setText( 1, "void" );    i->setText( 2, "virtual" );    if ( access.isEmpty() )	i->setText( 3, "public" );    else	i->setText( 3, access );    if( type.isEmpty() ) {	if ( showOnlySlots->isChecked() )	    i->setText( 4, "slot" );	else {	    i->setText( 4, lastType );	}    } else {	i->setText( 4, type );    }    if ( i->text( 4 ) == "slot" ) {	i->setText( 0, "newSlot()" );	if ( MetaDataBase::isSlotUsed( formWindow, "newSlot()" ) )	    i->setText( 5, tr( "Yes" ) );	else	    i->setText( 5, tr( "No" ) );    } else {	i->setText( 0, "newFunction()" );	i->setText( 5, "---" );    }        functionListView->setCurrentItem( i );    functionListView->setSelected( i, TRUE );    functionName->setFocus();    functionName->selectAll();    FunctItem fui;    fui.id = id;    fui.oldName = i->text( 0 );    fui.newName = fui.oldName;    fui.oldRetTyp = i->text( 1 );    fui.retTyp = fui.oldRetTyp;    fui.oldSpec = i->text ( 2 );    fui.spec = fui.oldSpec;    fui.oldAccess = i->text( 3 );    fui.access = fui.oldAccess;    fui.oldType = i->text( 4 );    fui.type = fui.oldType;    lastType = fui.oldType;    functList.append( fui );    functionIds.insert( i, id );    id++;}void EditFunctions::functionRemove(){    if ( !functionListView->currentItem() )	return;    functionListView->blockSignals( TRUE );    removedFunctions << MetaDataBase::normalizeFunction( functionListView->currentItem()->text( 0 ) );    int delId = functionIds[ functionListView->currentItem() ];    QValueList<FunctItem>::Iterator it = functList.begin();    while ( it != functList.end() ) {	if ( (*it).id == delId ) {	    functList.remove( it );	    break;	}	++it;    }    functionIds.remove( functionListView->currentItem() );    delete functionListView->currentItem();    if ( functionListView->currentItem() )	functionListView->setSelected( functionListView->currentItem(), TRUE );    functionListView->blockSignals( FALSE );    currentItemChanged( functionListView->currentItem() );}void EditFunctions::currentItemChanged( QListViewItem *i ){    functionName->blockSignals( TRUE );    functionName->setText( "" );    functionAccess->setCurrentItem( 0 );    functionName->blockSignals( FALSE );    if ( !i ) {	boxProperties->setEnabled( FALSE );	return;    }    functionName->blockSignals( TRUE );    functionName->setText( i->text( 0 ) );    editType->setText( i->text( 1 ) );    QString specifier = i->text( 2 );    QString access = i->text( 3 );    QString type = i->text( 4 );    if ( specifier == "pure virtual" )	functionSpecifier->setCurrentItem( 2 );    else if ( specifier == "non virtual" )	functionSpecifier->setCurrentItem( 0 );    else	functionSpecifier->setCurrentItem( 1 );    if ( access == "private" )	functionAccess->setCurrentItem( 2 );    else if ( access == "protected" )	functionAccess->setCurrentItem( 1 );    else	functionAccess->setCurrentItem( 0 );    if ( type == "slot" )	functionType->setCurrentItem( 0 );    else	functionType->setCurrentItem( 1 );    functionName->blockSignals( FALSE );    boxProperties->setEnabled( TRUE );}void EditFunctions::currentTextChanged( const QString &txt ){    if ( !functionListView->currentItem() )	return;    changeItem( functionListView->currentItem(), Name, txt );    functionListView->currentItem()->setText( 0, txt );    if ( functionListView->currentItem()->text( 4 ) == "slot" ) {	if ( MetaDataBase::isSlotUsed( formWindow, MetaDataBase::normalizeFunction( txt.latin1() ).latin1() ) )	    functionListView->currentItem()->setText( 5, tr( "Yes" ) );	else	    functionListView->currentItem()->setText( 5, tr( "No" ) );    } else {	functionListView->currentItem()->setText( 5, "---" );    }}void EditFunctions::currentSpecifierChanged( const QString& s ){    if ( !functionListView->currentItem() )	return;    changeItem( functionListView->currentItem(), Specifier, s );    functionListView->currentItem()->setText( 2, s );}void EditFunctions::currentAccessChanged( const QString& a ){    if ( !functionListView->currentItem() )	return;    changeItem( functionListView->currentItem(), Access, a );    functionListView->currentItem()->setText( 3, a );}void EditFunctions::currentReturnTypeChanged( const QString &type ){    if ( !functionListView->currentItem() )	return;    changeItem( functionListView->currentItem(), ReturnType, type );    functionListView->currentItem()->setText( 1, type );}void EditFunctions::currentTypeChanged( const QString &type ){    if ( !functionListView->currentItem() )	return;    changeItem( functionListView->currentItem(), Type,  type );    lastType = type;    functionListView->currentItem()->setText( 4, type );    if ( type == "slot" ) {	if ( MetaDataBase::isSlotUsed( formWindow,		MetaDataBase::normalizeFunction( functionListView->currentItem()->text( 0 ).latin1() ).latin1() ) )	    functionListView->currentItem()->setText( 5, tr( "Yes" ) );	else	    functionListView->currentItem()->setText( 5, tr( "No" ) );    } else {	functionListView->currentItem()->setText( 5, "---" );    }}void EditFunctions::changeItem( QListViewItem *item, Attribute a, const QString &nV ){    int itemId;    QMap<QListViewItem*, int>::Iterator fit = functionIds.find( item );    if ( fit != functionIds.end() )	itemId = *fit;    else	return;    QValueList<FunctItem>::Iterator it = functList.begin();    for ( ; it != functList.end(); ++it ) {	if ( (*it).id == itemId ) {	    switch( a ) {		case Name:		    (*it).newName = nV;		    break;		case Specifier:		    (*it).spec = nV;		    break;		case Access:		    (*it).access = nV;		    break;		case ReturnType:		    (*it).retTyp = nV;		    break;		case Type:		    (*it).type = nV;		    break;	    }	}    }}void EditFunctions::setCurrentFunction( const QString &function ){    QListViewItemIterator it( functionListView );    while ( it.current() ) {	if ( MetaDataBase::normalizeFunction( it.current()->text( 0 ) ) == function ) {	    functionListView->setCurrentItem( it.current() );	    functionListView->setSelected( it.current(), TRUE );	    currentItemChanged( it.current() );	    return;	}	++it;    }}void EditFunctions::displaySlots( bool justSlots ){    functionIds.clear();    functionListView->clear();    for ( QValueList<FunctItem>::Iterator it = functList.begin(); it != functList.end(); ++it ) {	if ( (*it).type == "function" && justSlots )	    continue;	QListViewItem *i = new QListViewItem( functionListView );	functionIds.insert( i, (*it).id );	i->setPixmap( 0, QPixmap::fromMimeSource( "editslots.png" ) );	i->setText( 0, (*it).newName );	i->setText( 1, (*it).retTyp );	i->setText( 2, (*it).spec );	i->setText( 3, (*it).access  );	i->setText( 4, (*it).type );	if ( (*it).type == "slot" ) {	    if ( MetaDataBase::isSlotUsed( formWindow, MetaDataBase::normalizeFunction( (*it).newName ).latin1() ) )		i->setText( 5, tr( "Yes" ) );	    else		i->setText( 5, tr( "No" ) );	} else {	    i->setText( 5, "---" );	}    }    if ( functionListView->firstChild() )	functionListView->setSelected( functionListView->firstChild(), TRUE );}void EditFunctions::emitItemRenamed( QListViewItem *, int, const QString & text ){    emit itemRenamed( text ); // Relay signal ( to QLineEdit )}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -