本文整理汇总了C++中QDictIterator::currentKey方法的典型用法代码示例。如果您正苦于以下问题:C++ QDictIterator::currentKey方法的具体用法?C++ QDictIterator::currentKey怎么用?C++ QDictIterator::currentKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDictIterator
的用法示例。
在下文中一共展示了QDictIterator::currentKey方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: validateLayout
//=====================================
// XKeyboard::Layout/Model check
//-------------------------------------
void XKeyboard::validateLayout ( void ) {
// log(L_INFO,"XKeyboard::validateLayout() called\n");
// ...
// this function check if the currently used combination
// of layout and model is valid according to the Keyboard.map
// if not we will provide a warning
// ---
QString XkbModel;
QString XkbLayout;
QDictIterator<char> itModel (mModelHash);
for (; itModel.current(); ++itModel) {
if (QString::fromLocal8Bit(itModel.current()) == mType->currentText()) {
XkbModel = itModel.currentKey();
}
}
// 2) primary XKB layout
QDictIterator<char> itLayout (mLayoutHash);
for (; itLayout.current(); ++itLayout) {
if (QString::fromLocal8Bit(itLayout.current()) == mLayout->currentText()) {
XkbLayout = itLayout.currentKey();
}
}
QString isValid = qx ( VALIDATELAYOUT,STDOUT,2,"%s %s",
XkbModel.ascii(),XkbLayout.ascii()
);
if (! isValid.toInt()) {
setMessage ("noValidLayout");
}
}
示例2: splitImport
//====================================
// splitImport...
//------------------------------------
void SaXImportProfile::splitImport (void) {
// .../
//! Split the data from the profile into the appropriate
//! ISAX sections. If the section does not exist a new one
//! will be created. Each section can be obtained using the
//! getImport() method. For the profile to take effect it is
//! normally needed to merge this SaXImport objects into the
//! basic imports which are the base for the configuration
//! export: For example
//! \code
//! SaXImport* profile = this->getImport (SAX_CARD);
//! baseImport->merge (profile->getTablePointerDATA());
//! \endcode
// ----
for (int n=0;n < getCount();n++) {
QDict<QString>* table = getTablePointer ( n );
QDictIterator<QString> it (*table);
for (; it.current(); ++it) {
QStringList tokens = QStringList::split ( ":", *it.current() );
QString section = tokens.last();
tokens.pop_back();
QString value = tokens.join(":");
if (section == "Layout") {
if (! mLayout) {
mLayout = new SaXImport (SAX_LAYOUT);
}
mLayout -> addID (n);
mLayout -> setItem (it.currentKey(),value);
}
if (section == "Desktop") {
if (! mDesktop) {
mDesktop = new SaXImport (SAX_DESKTOP);
}
mDesktop -> addID (n);
mDesktop -> setItem (it.currentKey(),value);
}
if (section == "Card") {
if (! mCard) {
mCard = new SaXImport (SAX_CARD);
}
mCard -> addID (n);
mCard -> setItem (it.currentKey(),value);
}
if (section == "Mouse") {
if (! mPointers) {
mPointers = new SaXImport (SAX_POINTERS);
}
mPointers -> addID (n);
mPointers -> setItem (it.currentKey(),value);
}
}
}
}
示例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;
}
示例4: fetchPropertyValuesRecursive
void RKComponentBase::fetchPropertyValuesRecursive (QMap<QString, QString> *list, bool include_top_level, const QString &prefix) {
RK_TRACE (PLUGIN);
for (QDictIterator<RKComponentBase> it (child_map); it.current (); ++it) {
if (it.currentKey () != "#noid#") {
if (it.current ()->isProperty ()) {
if (include_top_level) {
list->insert (prefix + it.currentKey (), it.current ()->value ());
}
} else {
it.current ()->fetchPropertyValuesRecursive (list, true, prefix + it.currentKey () + '.');
}
}
}
}
示例5: resetPage
//=====================================
// XAccessX reset and switch to Intro
//-------------------------------------
void XAccessX::resetPage (int reload) {
// ...
// this function is called if the xaccess dialog is finished or canceled
// AccessX is an X11 extension which need a seperate configuration file
// which is outside of the normal configuration create via ISaX. Therefore
// we don`t need to serialize any data here
// ---
if (reload == PAGE_RELOAD) {
if (mEnable -> isChecked()) {
QFile* mHandle = new QFile (
"/usr/X11R6/lib/X11/xkb/X0-config.keyboard"
);
if (! mHandle -> open(IO_WriteOnly)) {
log (L_ERROR,
"XAccessX::open failed on: %s -> %s\n",
mHandle->name().ascii(),strerror(errno)
);
}
QString* speed = new QString();
speed -> sprintf (
"%d",mLCD -> intValue()
);
QDict<char> data;
data.insert ("MouseKeysMaxSpeed=" ,
speed->ascii()
);
data.insert ("MouseKeysDelay=" , "40");
data.insert ("MouseKeysInterval=" , "10" );
data.insert ("MouseKeysTimeToMax=", "1000" );
data.insert ("MouseKeysCurve=" , "0" );
data.insert ("Controls+=","MouseKeysAccel");
#if 0
data.insert ("Controls+=",
"MouseKeysAccel + AccessxKeys"
);
data.insert ("Feedback+=",
"SlowKeysPress + SlowKeysAccept + StickyKeys + LatchToLock"
);
#endif
QDictIterator<char> it (data);
for (; it.current(); ++it) {
QString line;
line.sprintf ("%s %s\n",
it.currentKey().ascii(),it.current()
);
mHandle -> writeBlock (
line.ascii(),line.length()
);
}
mHandle -> close();
}
}
if (reload == PAGE_RELOAD) {
slotApply();
}
mStatus -> clear();
slotIntro (mIndex);
XTemplate::resetPage ();
mStack -> raiseWidget (Intro);
}
示例6: slotName
//=====================================
// slotName
//-------------------------------------
void SCCMonitorDualModel::slotName ( QListBoxItem* item ) {
//=====================================
// check manipulator access
//-------------------------------------
if (! mSaxDesktop ) {
return;
}
//=====================================
// include frequencies
//-------------------------------------
mCDBMonitorData = mSaxDesktop->getCDBMonitorData (
mVendorList->selectedItem()->text(),item->text()
);
mHSpinMin -> setValue ( 30 );
mHSpinMax -> setValue ( 50 );
mVSpinMin -> setValue ( 50 );
mVSpinMax -> setValue ( 60 );
QDictIterator<QString> it (mCDBMonitorData);
for (; it.current(); ++it) {
QString key = it.currentKey();
QString val = *it.current();
if (key == "VertRefresh") {
QStringList tokens = QStringList::split ( "-", val );
mVSpinMin -> setValue ( tokens.first().toInt() );
mVSpinMax -> setValue ( tokens.last().toInt() );
}
if (key == "HorizSync") {
QStringList tokens = QStringList::split ( "-", val );
mHSpinMin -> setValue ( tokens.first().toInt() );
mHSpinMax -> setValue ( tokens.last().toInt() );
}
}
}
示例7: 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;
}
示例8: 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;
}
示例9: updateVariants
//=====================================
// XKeyboard::update all variant lists
//-------------------------------------
void XKeyboard::updateVariants ( void ) {
// log(L_INFO,"XKeyboard::updateVariants() called\n");
// ...
// this function will update the variant lists for the
// primary variant combobox and the additional variant
// combobox. Currently set variants will be resetted
// after the list update
// ---
// 1) Additional Variants...
// ---
mAddVariant -> clear();
QListViewItem* item = mAddView -> selectedItem();
if (item) {
QStringList list = mRules.getVariants (item->text (2));
if (! list.empty()) {
mAddVariant -> insertStringList ( list );
} else {
mAddVariant -> insertItem ("basic");
}
mAddVariant->setCurrentText ("basic");
if ((item->text(3)) && (! item->text(3).isEmpty())) {
mAddVariant -> setCurrentText (item->text(3));
}
}
// 2) Primary Variant...
// ---
int curItem = mVariant -> currentItem();
QString curText = mVariant -> currentText();
mVariant -> clear();
QDictIterator<char> it (mRules.getLayouts());
bool emptyVariantList = true;
for (; it.current(); ++it) {
if (QString::fromLocal8Bit (it.current()) == mLayout->currentText()) {
QStringList list = mRules.getVariants (it.currentKey());
if (! list.empty()) {
mVariant -> insertStringList ( list );
emptyVariantList = false;
} else {
mVariant -> insertItem ("basic");
}
break;
}
}
mVariant->setCurrentText ("basic");
if (! emptyVariantList) {
if (mVariant->text (curItem) == curText) {
mVariant->setCurrentItem (curItem);
}
}
}
示例10: removeFromParent
void RKComponent::removeFromParent () {
RK_TRACE (PLUGIN);
if (!parentComponent ()) return;
for (QDictIterator<RKComponentBase> it (parentComponent ()->child_map); it.current (); ++it) {
if (it.current () == this) {
QString key = it.currentKey ();
// unfortunately, several items might hvae the same key, and there seems to be no way to selectively remove the current item only.
// however, this function should only ever be called in cases of emergency and to prevent crashes. So we make extra sure to remove the child,
// even if we remove a little more than necessary along the way.
while (parentComponent ()->child_map.remove (key));
return;
}
}
RK_ASSERT (false);
}
示例11: SaXProcess
//====================================
// getTabletDrivers
//------------------------------------
QList<QString> SaXManipulateTablets::getTabletDrivers (void) {
// .../
//! retrieve a list of supported tablet modules from the
//! TabletModules file
// ----
mCDBTabletDrivers.clear();
if ( ! mCDBTabletModules ) {
mCDBTabletModules = new SaXProcess ();
mCDBTabletModules -> start (CDB_TABLETMODULES);
}
QDict< QDict<QString> > CDBModules=mCDBTabletModules->getTablePointerCDB();
QDictIterator< QDict<QString> > it (CDBModules);
for (; it.current(); ++it) {
mCDBTabletDrivers.append (new QString(it.currentKey()));
}
return mCDBTabletDrivers;
}
示例12: SaXProcess
//====================================
// getCardDrivers
//------------------------------------
QList<QString> SaXManipulateCard::getCardDrivers ( void ) {
// .../
//! retrieve a list of X11 card driver names. The items
//! if the list can be used to retrieve the coresponding
//! option list using the getCardOptions() method
// ----
mCDBCardDrivers.clear();
if ( ! mCDBCardModules ) {
mCDBCardModules = new SaXProcess ();
mCDBCardModules -> start (CDB_CARDMODULES);
}
QDict< QDict<QString> > CDBModules = mCDBCardModules->getTablePointerCDB();
QDictIterator< QDict<QString> > it (CDBModules);
for (; it.current(); ++it) {
mCDBCardDrivers.append (new QString(it.currentKey()));
}
return mCDBCardDrivers;
}
示例13: merge
//====================================
// merge data into object...
//------------------------------------
void SaXStorage::merge (QList< QDict<QString> > data) {
// .../
//! merge the data records from the list (data) into
//! the corresponding data records of the object. If
//! a record does not exist it will be created
// ----
for (unsigned int n=0;n<data.count();n++) {
QDict<QString>* table = data.at(n);
QDictIterator<QString> it (*table);
if (! table) {
continue;
}
addID (n);
setID (n);
for (; it.current(); ++it) {
setItem (it.currentKey(),*it.current());
}
}
}
示例14: initPage
//=====================================
// XKeyboard init page with infos...
//-------------------------------------
void XKeyboard::initPage (void) {
// log (L_INFO,"XKeyboard::initPage() called\n");
// ...
// this function is called after the page was created.
// It must only be used to init the widgets contents
// with the data available for selections and other stuff
// like that
// ---
XWrapPointer< QDict<char> > mText (mTextPtr);
mLayoutHash = mRules.getLayouts();
mModelHash = mRules.getModels();
mOptionHash = mRules.getOptions();
//================================================
// include available layouts
//------------------------------------------------
QDictIterator<char> itLayout (mLayoutHash);
QListBox* layoutBox = new QListBox();
for (; itLayout.current(); ++itLayout) {
layoutBox -> insertItem ( QString::fromLocal8Bit (itLayout.current()) );
QCheckListItem* item = new QCheckListItem (
mAddView,"",QCheckListItem::CheckBox
);
item->setText ( 1, QString::fromLocal8Bit (itLayout.current()) );
item->setText ( 2, itLayout.currentKey() );
}
layoutBox -> sort ( true );
mLayout -> setListBox ( layoutBox );
//================================================
// include available models
//------------------------------------------------
QDictIterator<char> itModel (mModelHash);
QListBox* typeBox = new QListBox();
for (; itModel.current(); ++itModel) {
typeBox -> insertItem ( QString::fromLocal8Bit (itModel.current()) );
}
typeBox -> sort ( true );
mType -> setListBox ( typeBox );
mAddView -> setSorting (1);
//================================================
// include available options
//------------------------------------------------
QString* xkbDefault = new QString (
mText["Default"]
);
mXkbOption[0]->insertItem (*xkbDefault);
mXkbOption[1]->insertItem (*xkbDefault);
mXkbOption[6]->insertItem (*xkbDefault);
QDictIterator<char> itOption (mOptionHash);
for (; itOption.current(); ++itOption) {
XStringList completeOption (itOption.currentKey());
completeOption.setSeperator (":");
QString optkey = completeOption.getList().getFirst();
if (optkey == "grp") {
mXkbOption[0] -> insertItem (
QString::fromLocal8Bit (itOption.current())
);
}
else if (optkey == "ctrl") {
mXkbOption[1] -> insertItem (
QString::fromLocal8Bit (itOption.current())
);
}
else {
mXkbOption[6] -> insertItem (
QString::fromLocal8Bit (itOption.current())
);
}
}
for (int i=2;i<6;i++) {
mXkbOption[i]->insertItem (*xkbDefault);
mXkbOption[i]->insertItem ("Meta");
mXkbOption[i]->insertItem ("Compose");
mXkbOption[i]->insertItem ("ModeShift");
mXkbOption[i]->insertItem ("ModeLock");
mXkbOption[i]->insertItem ("ScrollLock");
mXkbOption[i]->insertItem ("Control");
}
//================================================
// set defaults
//------------------------------------------------
mCurrentDelay = XKBDDELAY_DEFAULT;
mCurrentKrate = XKBDRATE_DEFAULT;
}
示例15: slotTopOk
//=====================================
// XMouse slotTopOk...
//-------------------------------------
void XMouse::slotTopOk (void) {
// log (L_INFO,"XMouse::slotTopOk() called\n");
// ...
// this function is called if you click onto the OK
// button in the setup toplevel window
// ---
mFrame -> enterEvent ( 0 );
bool newMouse = false;
switch (mState) {
case MOUSE_NEW:
if (mouseList->count() > 0) {
mWorkingIndex = *mIndexList.at(mouseList->count()-1);
mWorkingIndex+= 2;
} else {
mWorkingIndex = 1;
}
newMouse = true;
break;
case MOUSE_SETUP:
mWorkingIndex = *mIndexList.at(mSelected);
newMouse = false;
break;
}
// ...
// create the text pointer wrapper object and
// get the mFiles pointer wrapper from the Intro
// object which has read all the data files
// ---
XWrapPointer< QDict<char> > mText (mTextPtr);
QDict<XFile>* mFilePtr = mIntro->getFiles();
XWrapFile < QDict<XFile> > mFiles (mFilePtr);
// ...
// get the workingMouse pointer wrapper. If a new mouse
// should be added use addDevice to create a new object
// otherwhise get the device according to the selection
// made in mouseList and clear the contents
// ---
XWrapPointer<XData> workingMouse;
if (newMouse) {
while (mFiles["sys_INPUT"]->getDevice (mWorkingIndex)) {
mWorkingIndex+= 2;
}
workingMouse.init (
mFiles["sys_INPUT"]->addDevice (mWorkingIndex)
);
} else {
workingMouse.init (
mFiles["sys_INPUT"]->getDevice (mWorkingIndex)
);
}
// ...
// set the selection data from the CDB if the user requested
// a new mouse from the list. The data set here may be overwritten
// from the manual setup made after the vendor/name selection
// ---
// check first if the selection differs from
// the current settings
// ---
bool changeRequest = false;
QString* mouseName = new QString();
mouseName -> sprintf ("%s;%s",
mVendor->currentText().ascii(),mName->currentText().ascii()
);
if (! newMouse) {
if (*mouseName != QString(workingMouse["Name"])) {
changeRequest = true;
}
} else {
changeRequest = true;
}
QDict<char>* spec = NULL;
XDb* pCDB = mFiles["cdb_POINTER"]->cdbGetSpec (
mVendor->currentText(),mName->currentText()
);
if ((pCDB) && (changeRequest)) {
spec = pCDB -> getHash();
// ...
// clear the working mouse contents...
// ---
workingMouse.clear();
// ...
// set base items for the mouse...
// ---
QString* ident = new QString;
ident -> sprintf ("Mouse[%d]",mWorkingIndex);
workingMouse.setPair ("InputFashion","Mouse");
workingMouse.setPair ("Identifier",ident->ascii());
workingMouse.setPair ("Name", mouseName->ascii());
// ...
// set CDB data information...
// ---
QDictIterator<char> it (*spec);
for (; it.current(); ++it) {
QString* key = new QString (it.currentKey());
//.........这里部分代码省略.........