本文整理汇总了C++中QList::getFirst方法的典型用法代码示例。如果您正苦于以下问题:C++ QList::getFirst方法的具体用法?C++ QList::getFirst怎么用?C++ QList::getFirst使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QList
的用法示例。
在下文中一共展示了QList::getFirst方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: generate
void UmlTransition::generate(QList<UmlTransition> trs, UmlClass * machine, UmlClass * anystate, UmlState * state, QCString & body, QCString indent, bool completion)
{
UmlTransition * tr;
bool guard = FALSE;
for (tr = trs.first(); tr != 0; tr = trs.next()) {
body += indent;
if (!tr->cppGuard().isEmpty()) {
// manage guard
body += ((tr == trs.getFirst()) ? "if (" : "else if (")
+ tr->cppGuard() + ") {\n";
guard = TRUE;
}
else
// no gard : it is the last transition, may be the first
body += ((tr == trs.getFirst()) ? "{\n" : "else {\n");
// the target state
UmlItem * tg = tr->target();
bool self_external = (state == tg) && tr->isExternal();
while (tg->kind() != aState)
tg = tg->parent();
// the parent common to the current and the target state
UmlState * common = state;
if (self_external) {
// execute exit behavior
if (!state->cppExitBehavior().isEmpty())
body += indent + " _doexit(stm);\n";
}
else {
bool fromExit =
// the exit behavior is made entering in the exit point
(tr->parent()->kind() == anExitPointPseudoState);
// compute common parent and manage exit behavior
if (tr->target()->kind() != aTerminatePseudoState) {
while (! ((UmlState *) tg)->inside(common)) {
if (!fromExit && !common->cppExitBehavior().isEmpty())
body += indent + " stm" + common->path() + "._doexit(stm);\n";
fromExit = FALSE;
switch (common->parent()->kind()) {
case aState:
common = (UmlState *) common->parent();
break;
case aRegion:
common = (UmlState *) common->parent()->parent();
break;
default:
UmlCom::trace("Error : transition from '" + state->name()
+ "' goes outside the state machine");
throw 0;
}
}
}
}
// manage transition activity
if (!tr->cppActivity().isEmpty())
body += "#ifdef VERBOSE_STATE_MACHINE\n" + indent +
" puts(\"DEBUG : execute activity of transition " + tr->name() +
"\");\n#endif\n" + tr->cppActivity();
// manage entry behavior
if (self_external) {
if (state->needCreate())
body += indent + " create(stm);\n";
}
else if (tr->target()->kind() != aTerminatePseudoState) {
if (tg != common) {
QCString enter;
UmlState * tg_parent;
// the enter behavior of the target state will be managed
// generating a call to create
for (tg_parent = (UmlState *) tg->parent();
tg_parent != common;
tg_parent = (UmlState *) tg_parent->parent())
if (!tg_parent->cppEntryBehavior().isEmpty())
enter.insert(0,
indent + " stm" + tg_parent->path() + "._doentry(stm);\n");
if (!enter.isEmpty())
body += enter;
}
// set the current state if needed
if (tg != state)
body += indent + " stm._set_currentState(stm"
+ ((UmlState *) tg)->path() + ");\n#ifdef VERBOSE_STATE_MACHINE\n" +
indent + " puts(\"DEBUG : current state is now " + ((UmlState *) tg)->prettyPath() +
"\");\n#endif\n";
}
// do the transition
if (tr->target()->kind() == aState) {
//.........这里部分代码省略.........
示例2: slotRun
//=====================================
// XKeyboard virtual slots...
//-------------------------------------
bool XKeyboard::slotRun (int index) {
if (XTemplate::slotRun (index)) {
// log(L_INFO,"XKeyboard::slotRun() called: %d\n",index);
// ...
// this function is called if the keyboard page is activated.
// use this function to init the dialog with the current
// setup of the keyboard
// ---
XWrapPointer< QDict<char> > mText (mTextPtr);
mStatus -> message (mText["RunXKeyboard"]);
mFrame -> nextButton() -> setText (mText["finish"]);
// ...
// get the mFiles pointer wrapper from the Intro
// object which has read all the data files. Than
// lookup the keyboard XData object
// ---
QDict<XFile>* mFilePtr = mIntro->getFiles();
XWrapFile < QDict<XFile> > mFiles (mFilePtr);
XData* sysData = mFiles["sys_KEYBOARD"] -> getDevice(0);
if (! sysData) {
return (FALSE);
}
QDict<char> keyboardInfo = sysData -> getData();
QString XKBLayouts = keyboardInfo["XkbLayout"];
QString XKBVariants = keyboardInfo["XkbVariant"];
QString XKBModel = keyboardInfo["XkbModel"];
//=====================================
// clean QListView data fields
//-------------------------------------
mAddView -> clearSelection();
QListViewItemIterator itAdd (mAddView);
for ( ; itAdd.current(); ++itAdd ) {
QCheckListItem* item = (QCheckListItem*)itAdd.current();
item -> setOn ( false );
item -> setText ( 3 , "" );
}
//=====================================
// select base keyboard model
//-------------------------------------
QDictIterator<char> itModel (mModelHash);
for (; itModel.current(); ++itModel) {
if (itModel.currentKey() == XKBModel) {
mType -> setCurrentText (QString::fromLocal8Bit (itModel.current()));
}
}
//=====================================
// get layout/variant lists
//-------------------------------------
XStringList completeLayout (XKBLayouts);
completeLayout.setSeperator (",");
QList<char> layoutList = completeLayout.getList();
QString baseLayout = layoutList.getFirst();
layoutList.removeFirst();
QStringList completeVariant = QStringList::split (",", XKBVariants,True);
QList<char> variantList;
QStringList::Iterator in;
for (in = completeVariant.begin(); in != completeVariant.end(); ++in) {
if (QString (*in).isEmpty()) {
variantList.append ("!");
} else {
variantList.append (*in);
}
}
QString baseVariant = variantList.getFirst();
variantList.removeFirst();
int varCount = 0;
//=====================================
// select base/secondary layout(s)
//-------------------------------------
// 1)
QDictIterator<char> itLayout (mLayoutHash);
for (; itLayout.current(); ++itLayout) {
if (itLayout.currentKey() == baseLayout) {
mLayout -> setCurrentText (QString::fromLocal8Bit (itLayout.current()));
}
}
// 2)
QListIterator<char> it (layoutList);
for (; it.current(); ++it) {
QListViewItemIterator itAdd (mAddView);
for ( ; itAdd.current(); ++itAdd ) {
QCheckListItem* item = (QCheckListItem*)itAdd.current();
QString layout = itAdd.current()->text(2);
if (layout == it.current()) {
item -> setOn (true);
if (QString(variantList.at(varCount)) != "!") {
item -> setText ( 3 , variantList.at(varCount) );
}
mAddView -> setSelected (itAdd.current(), true);
mAddView -> ensureItemVisible (item);
varCount++;
}
//.........这里部分代码省略.........