当前位置: 首页>>代码示例>>C++>>正文


C++ QDictIterator::toFirst方法代码示例

本文整理汇总了C++中QDictIterator::toFirst方法的典型用法代码示例。如果您正苦于以下问题:C++ QDictIterator::toFirst方法的具体用法?C++ QDictIterator::toFirst怎么用?C++ QDictIterator::toFirst使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QDictIterator的用法示例。


在下文中一共展示了QDictIterator::toFirst方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: setKeyDict

bool KAccel::setKeyDict( QDict<KKeyEntry> nKeyDict )
{

	kdebug(KDEBUG_INFO, 125, "Disconenct and remove");
	// Disconnect and remove all items in pAccel
	QDictIterator<KKeyEntry> *aKeyIt = new QDictIterator<KKeyEntry>( aKeyDict );
	aKeyIt->toFirst();
#define pE aKeyIt->current()
	while( pE ) {
		QString s;
		if ( pE->aAccelId && pE->aCurrentKeyCode ) {
			pAccel->disconnectItem( pE->aAccelId, pE->receiver,
						pE->member );
			pAccel->removeItem( pE->aAccelId );
		}
		++*aKeyIt;
	}
#undef pE
	
	kdebug(KDEBUG_INFO, 125, "Clear the dictionary");
	
	// Clear the dictionary
	aKeyDict.clear();
	
	kdebug(KDEBUG_INFO, 125, "Insert new items");
	
	// Insert the new items into the dictionary and reconnect if neccessary
	// Note also swap config and current key codes !!!!!!
	delete aKeyIt; // tanghus
	aKeyIt = new QDictIterator<KKeyEntry>( nKeyDict );
	aKeyIt->toFirst();
#define pE aKeyIt->current()
	KKeyEntry *pEntry;
	while( pE ) {
		pEntry = new KKeyEntry;
		aKeyDict.insert( aKeyIt->currentKey(), pEntry );
		pEntry->aDefaultKeyCode = pE->aDefaultKeyCode;
		// Note we write config key code to current key code !!
		pEntry->aCurrentKeyCode = pE->aConfigKeyCode;
		pEntry->aConfigKeyCode = pE->aConfigKeyCode;
		pEntry->bConfigurable = pE->bConfigurable;
		pEntry->aAccelId = pE->aAccelId;
		pEntry->receiver = pE->receiver;
		pEntry->member = pE->member;
		pEntry->descr = pE->descr; // tanghus
		
		if ( pEntry->aAccelId && pEntry->aCurrentKeyCode ) {
			pAccel->insertItem( pEntry->aCurrentKeyCode, pEntry->aAccelId );
			pAccel->connectItem( pEntry->aAccelId, pEntry->receiver,
					     pEntry->member);
		}
		++*aKeyIt;
	}
#undef pE
		
	delete aKeyIt; // tanghus
	return true;
}
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:58,代码来源:kaccel.cpp

示例2: setKeyDict

bool KGlobalAccel::setKeyDict( QDict<KKeyEntry> nKeyDict )
{
	// ungrab all connected and enabled keys
	QDictIterator<KKeyEntry> *aKeyIt = new QDictIterator<KKeyEntry>( aKeyDict );
	aKeyIt->toFirst();
#define pE aKeyIt->current()
	while( pE ) {
		QString s;
		if ( pE->bEnabled ) {
			uint keysym = keyToXSym( pE->aCurrentKeyCode );
			uint mod = keyToXMod( pE->aCurrentKeyCode );
			ungrabKey( keysym, mod );
		}
		++*aKeyIt;
	}
#undef pE
	
	// Clear the dictionary
	aKeyDict.clear();
	
	// Insert the new items into the dictionary and reconnect if neccessary
	// Note also swap config and current key codes !!!!!!
	aKeyIt = new QDictIterator<KKeyEntry>( nKeyDict );
	aKeyIt->toFirst();
#define pE aKeyIt->current()
	KKeyEntry *pEntry;
	while( pE ) {
		pEntry = new KKeyEntry;
		aKeyDict.insert( aKeyIt->currentKey(), pEntry );

		pEntry->aDefaultKeyCode = pE->aDefaultKeyCode;
		// Not we write config key code to current key code !!
		pEntry->aCurrentKeyCode = pE->aConfigKeyCode;
		pEntry->aConfigKeyCode = pE->aConfigKeyCode;
		pEntry->bConfigurable = pE->bConfigurable;
		pEntry->aAccelId = pE->aAccelId;
		pEntry->receiver = pE->receiver;
		pEntry->member = new QString( pE->member->data() );
		pEntry->bEnabled = pE->bEnabled;
		
		if ( pEntry->bEnabled ) {
			uint keysym = keyToXSym( pEntry->aCurrentKeyCode );
			uint mod = keyToXMod( pEntry->aCurrentKeyCode );
			grabKey( keysym, mod );
		}
		
		++*aKeyIt;
	}
#undef pE
		
	return true;
}
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:52,代码来源:kglobalaccel.cpp

示例3: activated

bool KGlobalAccel::x11EventFilter( const XEvent *event_ ) {
	if ( aKeyDict.isEmpty() ) return false;
	if ( event_->type != KeyPress ) return false;
	
	uint mod=event_->xkey.state & (ControlMask | ShiftMask | Mod1Mask);
	uint keysym= XKeycodeToKeysym(qt_xdisplay(), event_->xkey.keycode, 0);
	
	debug("Key press event :: mod = %d, sym =%d", mod, keysym );
   
   KKeyEntry *pEntry =0;
   const char *action;
   
	QDictIterator<KKeyEntry> *aKeyIt = new QDictIterator<KKeyEntry>( aKeyDict );
	aKeyIt->toFirst();
#define pE aKeyIt->current()
	while( pE ) { //&& 
		//( mod != keyToXMod( pE->aCurrentKeyCode ) 
		//	|| keysym != keyToXSym( pE->aCurrentKeyCode ) ) ) {
		int kc = pE->aCurrentKeyCode;
		if( mod == keyToXMod( kc ) ) debug("That's the right modifier");
		if( keysym == keyToXSym( kc ) ) debug("That's the right symbol");
		if ( mod == keyToXMod( kc ) && keysym == keyToXSym( kc ) ) {
		//pEntry = pE;
		//action = aKeyIt->currentKey();
		//break;
		debug("Found key in dictionary for action %s", aKeyIt->currentKey());
		break;
		}
		++*aKeyIt;
	}
	
	if ( !pE ) {
		debug("Null KeyEntry object");
		return false; 
	}
	
	if ( !pE ) {
		debug("KeyEntry object not enabled");
		return false; 
	}

	debug("KGlobalAccel:: event action %s", aKeyIt->currentKey() );

	XAllowEvents(qt_xdisplay(), AsyncKeyboard, CurrentTime);
	
	connect( this, SIGNAL( activated() ), pE->receiver, pE->member->data() );
	emit activated();
	disconnect( this, SIGNAL( activated() ), pE->receiver, pE->member->data() );

//    warning("Signal has been sent!");
	return true;
}
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:52,代码来源:kglobalaccel.cpp

示例4: exportData


//.........这里部分代码省略.........
			if ( mImport ) {
				//====================================
				// pick up card profile data
				//------------------------------------
				QString driver = saxCard.getCardDriver();
				QDict<QString> profileDriverOptions;
				SaXManipulateCard saxProfileCard ( mImport );
				profileDriverOptions = saxProfileCard.getOptions();
				QDictIterator<QString> it ( profileDriverOptions );

				//====================================
				// delete profile data keys
				//------------------------------------
				for (; it.current(); ++it) {
					saxCard.removeCardOption (it.currentKey());
				}
				#if 1 // to be removed as soon as possible
				//====================================               
				// fix broken cards                                     
				//------------------------------------
				fixBrokenCards (saxCard);
				#endif
				//====================================
				// init special modelines
				//------------------------------------
				//mSection["Desktop"] -> removeEntry ("SpecialModeline");
				saxDesktop.setExtraModelineString (
					monitorData->getExtraModeline()
				);
				//====================================
				// setup profile data
				//------------------------------------
				if (display->isDualModeEnabled()) {
					it.toFirst();
					SCCMonitorDual* dualData;
					SCCMonitorDualModel* dualModel;
					dualData  = display->getDualData();
					dualModel = dualData->getDualModelData();
					//====================================
					// call ok slot from dualhead setup
					//------------------------------------
					dualData->slotOk();
					//====================================
					// setup dualhead options
					//------------------------------------
					saxCard.addCardOption ("SaXDualHead",0);
					for (; it.current(); ++it) {
						QString key = it.currentKey();
						QString val = *it.current();
						//====================================
						// setup profile "off"-line data
						//------------------------------------
						if (val == "off") {
							saxCard.addCardOption ( key,val );
							continue;
						}
						//====================================
						// setup profile meta data
						//------------------------------------
						if (key == "SaXDualMonitorVendor") {
							QString vendor = dualModel ->getVendorName();
							saxCard.addCardOption ( key,vendor );
						}
						if (key == "SaXDualMonitorModel") {
							QString model = dualModel ->getModelName();
							saxCard.addCardOption ( key,model );
开发者ID:BackupTheBerlios,项目名称:sax-svn,代码行数:67,代码来源:monitor.cpp


注:本文中的QDictIterator::toFirst方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。