本文整理汇总了C++中QDictIterator类的典型用法代码示例。如果您正苦于以下问题:C++ QDictIterator类的具体用法?C++ QDictIterator怎么用?C++ QDictIterator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QDictIterator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setValue
//=====================================
// 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() );
}
}
}
示例2: QFile
//=====================================
// 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);
}
示例3: qDebug
/** return the maximum resolution in the list of images */
float
GeoImageList::maxResolution()
{
if (!minMaxResUptodate_) {
minRes_ = -1;
maxRes_ = 500;
qDebug("GeoImageList::maxResolution");
QDictIterator < GeoImage > it = QDictIterator < GeoImage > (*this);
for (; it.current(); ++it) {
GeoImage *img = it.current();
qDebug("%s: xres: %f yres: %f",
(img->filename()).latin1(),
img->resolutionX(), img->resolutionY());
float res = it.current()->resolutionX();
if (res > minRes_)
minRes_ = res;
if (res < maxRes_)
maxRes_ = res;
res = it.current()->resolutionY();
if (res > minRes_)
minRes_ = res;
if (res < maxRes_)
maxRes_ = res;
}
minMaxResUptodate_ = true;
}
return maxRes_;
}
示例4: RK_TRACE
bool RKComponent::isValid () {
RK_TRACE (PLUGIN);
for (QDictIterator<RKComponentBase> it (child_map); it.current (); ++it) {
if (!(it.current ()->isSatisfied ())) return false;
}
return true;
}
示例5: kdebug
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;
}
示例6: XKeycodeToKeysym
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;
}
示例7: while
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;
}
示例8: itModel
//=====================================
// 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");
}
}
示例9: clear
//=====================================
// 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: 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;
}
示例11: 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;
}
示例12: RK_TRACE
void RKComponent::updateEnablednessRecursive () {
RK_TRACE (PLUGIN);
bool enabled;
if (enabledness_property->boolValue ()) {
enabled = ((!parentComponent ()) || (parentComponent ()->isEnabled ()));
} else {
enabled = false;
}
setEnabled (enabled); /* We do this, even if the state *seems* to be unchanged. This is needed, as isEnabled () also returns false, if the parent QWidget is not enabled. However, the parent QWidget may not always be the parent component. */
if (enabled != isEnabled ()) {
for (QDictIterator<RKComponentBase> it (child_map); it.current (); ++it) {
if (it.current ()->isComponent()) {
static_cast<RKComponent*> (it.current ())->updateEnablednessRecursive ();
}
}
}
}
示例13: it
//====================================
// 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: getTablePointer
//====================================
// 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);
}
}
}
}
示例15: mText
//=====================================
// XKeyboard apply keyboard
//-------------------------------------
bool XKeyboard::apply ( void ) {
// log(L_INFO,"XKeyboard::apply() called\n");
// ...
// apply the keyboard to the X-Server for immediate
// usage. This call will use the XKB extension
// ---
XWrapPointer< QDict<char> > mText (mTextPtr);
QString* XkbModel = NULL;
QString* XkbLayout = NULL;
QString* XkbVariant = NULL;
QString* XkbOptions = NULL;
// 1) primary XKB model
QDictIterator<char> itModel (mModelHash);
for (; itModel.current(); ++itModel) {
if (QString::fromLocal8Bit (itModel.current()) == mType->currentText()) {
XkbModel = new QString (itModel.currentKey());
}
}
// 2) primary XKB layout
QDictIterator<char> itLayout (mLayoutHash);
for (; itLayout.current(); ++itLayout) {
if (QString::fromLocal8Bit(itLayout.current()) == mLayout->currentText()) {
XkbLayout = new QString (itLayout.currentKey());
}
}
// 3) variant for primary XKB layout
XkbVariant = new QString();
if (mVariant->currentText()) {
*XkbVariant = mVariant->currentText();
}
// 4) additional layout and variant
QListViewItemIterator itAdd (mAddView);
for ( ; itAdd.current(); ++itAdd ) {
QCheckListItem* item = (QCheckListItem*)itAdd.current();
if (item->isOn()) {
QString layout = itAdd.current()->text(2);
QString variant = "";
XkbLayout->sprintf("%s,%s",
XkbLayout->ascii(),layout.ascii()
);
if (itAdd.current()->text(3)) {
variant = itAdd.current()->text(3);
}
XkbVariant->sprintf("%s,%s",
XkbVariant->ascii(),variant.ascii()
);
}
}
// 5) options
if (mKeyboardOptions["XkbOptions"]) {
if (! QString(mKeyboardOptions["XkbOptions"]).isEmpty()) {
XkbOptions = new QString (mKeyboardOptions["XkbOptions"]);
}
}
QString optm ("-model");
QString optl ("-layout");
QString opto ("-option");
QString optv ("-variant");
if ((XkbVariant) && (XkbOptions)) {
#if 0
printf("%s %s %s %s %s %s %s %s\n",
optm.ascii(),XkbModel->ascii(),optl.ascii(),XkbLayout->ascii(),
opto.ascii(),XkbOptions->ascii(),optv.ascii(),XkbVariant->ascii()
);
#endif
#if 1
qx ( SETXKBMAP,STDNONE,8,"%s %s %s %s %s %s %s %s",
optm.ascii(),XkbModel->ascii(),optl.ascii(),XkbLayout->ascii(),
opto.ascii(),XkbOptions->ascii(),optv.ascii(),XkbVariant->ascii()
);
#endif
} else if (XkbVariant) {
#if 0
printf("%s %s %s %s %s %s\n",
optm.ascii(),XkbModel->ascii(),optl.ascii(),XkbLayout->ascii(),
optv.ascii(),XkbVariant->ascii()
);
#endif
#if 1
qx ( SETXKBMAP,STDNONE,8,"%s %s %s %s %s %s",
optm.ascii(),XkbModel->ascii(),optl.ascii(),XkbLayout->ascii(),
optv.ascii(),XkbVariant->ascii()
);
#endif
} else if (XkbOptions) {
#if 0
printf("%s %s %s %s %s %s\n",
optm.ascii(),XkbModel->ascii(),optl.ascii(),XkbLayout->ascii(),
opto.ascii(),XkbOptions->ascii()
);
#endif
#if 1
qx ( SETXKBMAP,STDNONE,8,"%s %s %s %s %s %s",
optm.ascii(),XkbModel->ascii(),optl.ascii(),XkbLayout->ascii(),
opto.ascii(),XkbOptions->ascii()
);
//.........这里部分代码省略.........