本文整理汇总了C++中QPtrList::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ QPtrList::clear方法的具体用法?C++ QPtrList::clear怎么用?C++ QPtrList::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QPtrList
的用法示例。
在下文中一共展示了QPtrList::clear方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: slotOKClicked
void VCXYPadProperties::slotOKClicked()
{
QPtrList<XYChannelUnit>* list;
// Update the X list
list = m_parent->channelsX();
list->setAutoDelete(true);
list->clear();
list->setAutoDelete(false);
QListViewItemIterator xit(m_listX);
while (xit.current())
{
list->append(createChannelUnit(*xit));
++xit;
}
// Update the Y list
list = m_parent->channelsY();
list->setAutoDelete(true);
list->clear();
list->setAutoDelete(false);
QListViewItemIterator yit(m_listY);
while (yit.current())
{
list->append(createChannelUnit(*yit));
++yit;
}
accept();
}
示例2: close
void QSocketPrivate::close()
{
closeSocket();
wsize = 0;
rba.clear(); wba.clear();
windex = 0;
}
示例3: slotCursorRight
// -----------------------------------------------------------
void QucsApp::slotCursorRight()
{
if(!editText->isHidden()) return; // for edit of component property ?
QPtrList<Element> movingElements;
Schematic *Doc = (Schematic*)DocumentTab->currentPage();
int markerCount = Doc->copySelectedElements(&movingElements);
if((movingElements.count() - markerCount) < 1) {
if(markerCount > 0) { // only move marker if nothing else selected
Doc->markerLeftRight(false, &movingElements);
movingElements.clear();
}
else {
if(Doc->scrollRight(-Doc->horizontalScrollBar()->lineStep()))
Doc->scrollBy(Doc->horizontalScrollBar()->lineStep(), 0);
}
Doc->viewport()->update();
view->drawn = false;
return;
}
view->moveElements(&movingElements, Doc->GridX, 0); // move "GridX" to right
view->MAx3 = 1; // sign for moved elements
view->endElementMoving(Doc, &movingElements);
}
示例4: connectionClosed
void QSocketPrivate::connectionClosed()
{
// We keep the open state in case there's unread incoming data
state = QSocket::Idle;
closeSocket();
wba.clear();
windex = wsize = 0;
}
示例5: slotCursorDown
// -----------------------------------------------------------
void QucsApp::slotCursorDown()
{
if(!editText->isHidden()) { // for edit of component property ?
if(view->MAx3 == 0) return; // edit component namen ?
Component *pc = (Component*)view->focusElement;
Property *pp = pc->Props.at(view->MAx3-1); // current property
int Pos = pp->Description.find('[');
if(Pos < 0) return; // no selection list ?
Pos = pp->Description.find(editText->text(), Pos); // current list item
if(Pos < 0) return; // should never happen
Pos = pp->Description.find(',', Pos);
if(Pos < 0) return; // was last item ?
Pos++;
if(pp->Description.at(Pos) == ' ') Pos++; // remove leading space
int End = pp->Description.find(',', Pos);
if(End < 0) { // is last item ?
End = pp->Description.find(']', Pos);
if(End < 0) return; // should never happen
}
editText->setText(pp->Description.mid(Pos, End-Pos));
editText->selectAll();
return;
}
QPtrList<Element> movingElements;
Schematic *Doc = (Schematic*)DocumentTab->currentPage();
int markerCount = Doc->copySelectedElements(&movingElements);
if((movingElements.count() - markerCount) < 1) {
if(markerCount > 0) { // only move marker if nothing else selected
Doc->markerUpDown(false, &movingElements);
movingElements.clear();
}
else {
if(Doc->scrollDown(-Doc->verticalScrollBar()->lineStep()))
Doc->scrollBy(0, Doc->verticalScrollBar()->lineStep());
}
Doc->viewport()->update();
view->drawn = false;
return;
}
view->moveElements(&movingElements, 0, Doc->GridY); // move "GridY" down
view->MAx3 = 1; // sign for moved elements
view->endElementMoving(Doc, &movingElements);
}
示例6: slotSelectionChanged
void KMJobViewer::slotSelectionChanged()
{
int acts = m_manager->actions();
int state(-1);
int thread(0);
bool completed(true), remote(false);
QPtrListIterator<JobItem> it(m_items);
QPtrList<KMJob> joblist;
joblist.setAutoDelete(false);
for (; it.current(); ++it)
{
if (it.current()->isSelected())
{
// check if threaded job. "thread" value will be:
// 0 -> no jobs
// 1 -> only thread jobs
// 2 -> only system jobs
// 3 -> thread and system jobs
if (it.current()->job()->type() == KMJob::Threaded) thread |= 0x1;
else thread |= 0x2;
if (state == -1) state = it.current()->job()->state();
else if (state != 0 && state != it.current()->job()->state()) state = 0;
completed = (completed && it.current()->job()->isCompleted());
joblist.append(it.current()->job());
if (it.current()->job()->isRemote())
remote = true;
}
}
if (thread != 2)
joblist.clear();
actionCollection()->action("job_remove")->setEnabled((thread == 1) || (/*!remote &&*/ !completed && (state >= 0) && (acts & KMJob::Remove)));
actionCollection()->action("job_hold")->setEnabled(/*!remote &&*/ !completed && (thread == 2) && (state > 0) && (state != KMJob::Held) && (acts & KMJob::Hold));
actionCollection()->action("job_resume")->setEnabled(/*!remote &&*/ !completed && (thread == 2) && (state > 0) && (state == KMJob::Held) && (acts & KMJob::Resume));
actionCollection()->action("job_move")->setEnabled(!remote && !completed && (thread == 2) && (state >= 0) && (acts & KMJob::Move));
actionCollection()->action("job_restart")->setEnabled(!remote && (thread == 2) && (state >= 0) && (completed) && (acts & KMJob::Restart));
m_manager->validatePluginActions(actionCollection(), joblist);
}
示例7: loadDictList
void Index::loadDictList(QPtrList<File> &fileList, const QStringList &dictList, const QStringList &dictNameList)
{
fileList.clear();
// check if we have a dict
if (dictList.size() < 1)
{
msgerr(i18n("No dictionaries in list!"));
return;
}
QStringList::ConstIterator it;
QStringList::ConstIterator dictIt;
for (it = dictList.begin(), dictIt = dictNameList.begin(); it != dictList.end(); ++it, ++dictIt)
{
File *f = new File(*it, *dictIt);
// our ugly substitute for exceptions
if (f->isValid())
fileList.append(f);
else
delete f;
}
}
示例8: doExport
void NPmxExport::doExport() {
int i, j;
NVoice *voice_elem;
NStaff *staff_elem;
NTimeSig *timesig;
NKeySig *keysig;
NClef *clef;
QPtrList<QString> lyrNames;
QString *lyrName;
QString lyricslist[NUM_LYRICS];
property_type kind;
int count;
int acr;
bool staffsWritten, first;
const char *endOfLine;
int voice_count;
int barpos;
int count_of_lyrics;
int idx;
int multistaffnr;
int numOfStaffsInMultistaff;
#if GCC_MAJ_VERS > 2
ostringstream os;
ostringstream *pmxout[2];
#else
char obuffer[2][OBLONG];
char buffer[BUFLONG];
ostrstream os(buffer, 100);
ostrstream *pmxout[2];
#endif
badmeasure *bad;
lastTone_ = 1000;
lastLength_ = 1000;
openSpecialEnding_ = 0;
pendingSpecialEnd_ = 0;
pendingEndSpecialEnd_ = false;
tupletBase_ = 0;
countof128th_ = 128;
barNr_ = 1;
tiePool_ = 0;
slurPool_ = 0;
vaPool_ = 0;
pendingTimeSig_ = 0;
pendingKeySig_ = 0;
pendingSpecialEnd_ = 0;
drum_problem_written_ = false;
exportDialog_->getPMXOptions( pmxOpts_ );
specialCharList_.clear();
badlist_.clear();
if (fileName.isNull())
return;
if (NResource::staffSelExport_ == 0) {
NResource::staffSelExport_ = new bool[staffList_->count()];
for (i = 0; i < (int)staffList_->count(); NResource::staffSelExport_[i++] = true);
staffsToExport_ = staffList_->count();
}
else {
staffsToExport_ = 0;
for (i = 0; i < (int)staffList_->count(); i++) {
if (NResource::staffSelExport_[i]) {
staffsToExport_++;
}
}
}
out_.open(fileName);
if (!out_) {
os << "error opening file " << fileName << '\0';
#if GCC_MAJ_VERS > 2
KMessageBox::sorry
(0, QString(os.str().c_str()), kapp->makeStdCaption(i18n("PMX export")));
#else
KMessageBox::sorry
(0, QString(os.str()), kapp->makeStdCaption(i18n("PMX export")));
#endif
return;
}
#if GCC_MAJ_VERS > 2
pmxout[0] = new ostringstream();
pmxout[1] = new ostringstream();
#else
pmxout[0] = new ostrstream(obuffer[0], OBLONG);
pmxout[1] = new ostrstream(obuffer[1], OBLONG);
#endif
va_descr_ = (struct trill_descr_str *) alloca(staffsToExport_ * sizeof(struct trill_descr_str));
for (i = 0; i < staffsToExport_; i++) {
va_descr_[i].trill_nr = -1;
}
LastPMXfile_ = fileName;
voice_elem = staffList_->first()->getVoiceNr(0);
keysig = voice_elem->getFirstKeysig();
if (!keysig) {
keysig = new NKeySig(0, 0);
}
timesig = voice_elem->getFirstTimeSig();
if (!timesig) {
timesig = new NTimeSig(0, &NResource::nullprops_);
timesig->setSignature(4, 4);
}
//.........这里部分代码省略.........