本文整理汇总了C++中QPtrList类的典型用法代码示例。如果您正苦于以下问题:C++ QPtrList类的具体用法?C++ QPtrList怎么用?C++ QPtrList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QPtrList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getMATypes
PlotLine * THERM::calculateCustom (QString &p, QPtrList<PlotLine> &d)
{
// format1: MA_TYPE, MA_PERIOD, THRESHOLD, SMOOTHING_TYPE, SMOOTHING_PERIOD
if (checkFormat(p, d, 5, 5))
return 0;
QStringList mal;
getMATypes(mal);
maType = mal.findIndex(formatStringList[0]);
maPeriod = formatStringList[1].toInt();
threshold = formatStringList[2].toDouble();
smoothType = mal.findIndex(formatStringList[3]);
smoothing = formatStringList[4].toInt();
QPtrList<PlotLine> pll;
pll.setAutoDelete(FALSE);
getTHERM(pll);
int loop;
for (loop = pll.count() - 1; loop > 0; loop--)
pll.remove(loop);
return pll.at(0);
}
示例2: KAction
QPtrList<KAction> *AIMContact::customContextMenuActions()
{
QPtrList<KAction> *actionCollection = new QPtrList<KAction>();
if ( !m_warnUserAction )
{
m_warnUserAction = new KAction( i18n( "&Warn User" ), 0, this, SLOT( warnUser() ), this, "warnAction" );
}
m_actionVisibleTo = new KToggleAction(i18n("Always &Visible To"), "", 0,
this, SLOT(slotVisibleTo()), this, "actionVisibleTo");
m_actionInvisibleTo = new KToggleAction(i18n("Always &Invisible To"), "", 0,
this, SLOT(slotInvisibleTo()), this, "actionInvisibleTo");
bool on = account()->isConnected();
m_warnUserAction->setEnabled( on );
m_actionVisibleTo->setEnabled(on);
m_actionInvisibleTo->setEnabled(on);
SSIManager* ssi = account()->engine()->ssiManager();
m_actionVisibleTo->setChecked( ssi->findItem( m_ssiItem.name(), ROSTER_VISIBLE ));
m_actionInvisibleTo->setChecked( ssi->findItem( m_ssiItem.name(), ROSTER_INVISIBLE ));
actionCollection->append( m_warnUserAction );
actionCollection->append(m_actionVisibleTo);
actionCollection->append(m_actionInvisibleTo);
return actionCollection;
}
示例3: KActionSeparator
QPtrList<KAction> KDataToolAction::dataToolActionList( const QValueList<KDataToolInfo> & tools, const QObject *receiver, const char* slot )
{
QPtrList<KAction> actionList;
if ( tools.isEmpty() )
return actionList;
actionList.append( new KActionSeparator() );
QValueList<KDataToolInfo>::ConstIterator entry = tools.begin();
for( ; entry != tools.end(); ++entry )
{
QStringList userCommands = (*entry).userCommands();
QStringList commands = (*entry).commands();
Q_ASSERT(!commands.isEmpty());
if ( commands.count() != userCommands.count() )
kdWarning() << "KDataTool desktop file error (" << (*entry).service()->entryPath()
<< "). " << commands.count() << " commands and "
<< userCommands.count() << " descriptions." << endl;
QStringList::ConstIterator uit = userCommands.begin();
QStringList::ConstIterator cit = commands.begin();
for (; uit != userCommands.end() && cit != commands.end(); ++uit, ++cit )
{
//kdDebug() << "creating action " << *uit << " " << *cit << endl;
KDataToolAction * action = new KDataToolAction( *uit, *entry, *cit );
connect( action, SIGNAL( toolActivated( const KDataToolInfo &, const QString & ) ),
receiver, slot );
actionList.append( action );
}
}
return actionList;
}
示例4: main
int main(int argc,char **argv)
{
QApplication app(argc,argv);
QPtrList<int> list;
for (int i=0;i<3;i++)
{
list.append(new int(i)); // 插入資料
}
list.first(); // 先跳到第一個元素
for (int i=0;i<3;i++,list.next())
{
cout << *(list.current()) << endl;
}
list.first();
list.next();
list.remove();
list.remove();
list.remove();
cout << *(list.current()) << endl;
// 由這一個例子可以知道,刪掉一個成員後,指標會跑到下一個.但若刪掉後沒有下一個時,指標會跑到前一個
return 0;
}
示例5: selectedItems
void KMMimePartTree::slotEdit()
{
QPtrList<QListViewItem> selected = selectedItems();
if ( selected.count() != 1 )
return;
mReaderWin->slotEditAttachment( static_cast<KMMimePartTreeItem*>( selected.first() )->node() );
}
示例6: qDebug
STDMETHODIMP QOleDataObject::QueryGetData( FORMATETC *pformatetc )
{
#ifdef DEBUG_QDND_SRC
qDebug( "QOleDataObject::QueryGetData( %p )", pformatetc );
#endif
if ( !pformatetc ) {
return E_INVALIDARG;
}
if ( pformatetc->lindex != -1 ) {
return DV_E_LINDEX;
}
if ( pformatetc->dwAspect != DVASPECT_CONTENT ) {
return DV_E_DVASPECT;
}
int tymed = pformatetc->tymed;
/* Currently we only support HGLOBAL */
if ( !( tymed & TYMED_HGLOBAL ) ) {
return DV_E_TYMED;
}
int cf = pformatetc->cfFormat;
QPtrList<QWindowsMime> all = QWindowsMime::all();
for ( QWindowsMime * c = all.first(); c ; c = all.next() ) {
const char * mime = c->mimeFor( cf );
if ( mime && m_dragObj->provides( mime ) ) {
return S_OK;
}
}
return DV_E_FORMATETC;
}
示例7: setIcons
/***********************************************************************************
KMixToolbox contains several GUI relevant methods that are shared between the
KMix Main Program, and the KMix Applet.
kmixctrl - as not non-GUI application - does NOT link to KMixToolBox.
This means: Shared GUI stuff goes into the KMixToolBox class , non-GUI stuff goes
into the MixerToolBox class.
***********************************************************************************/
void KMixToolBox::setIcons(QPtrList<QWidget> &mdws, bool on ) {
for ( QWidget *qmdw=mdws.first(); qmdw!=0; qmdw=mdws.next() ) {
if ( qmdw->inherits("MixDeviceWidget") ) { // -<- play safe here
static_cast<MixDeviceWidget*>(qmdw)->setIcons( on );
}
}
}
示例8: keyFrames
void TLFrameSequenceLayout::loadFrames( QPtrList<Layer> layers )
{
number_of_frame_sequences = 0;
max_used_frames = 0;
delete current_frame_sequence;
list_of_frame_sequences.clear();
Layer *l_it;
for ( l_it = layers.first(); l_it; l_it = layers.next() )
{
QPtrList<KeyFrame> keyframes = l_it -> keyFrames();
number_of_frame_sequences++;
TLFrameSequence *new_frame_sequence = new TLFrameSequence( number_of_frame_sequences, viewport(), this );
if ( l_it == layers.getFirst() )
current_frame_sequence = new_frame_sequence;
addChild( new_frame_sequence, 0, ( number_of_frame_sequences - 1 ) * new_frame_sequence -> height() );
connect( new_frame_sequence, SIGNAL( frameInserted() ), SLOT( slotUpdateMaxUsedFrames() ) );
connect( new_frame_sequence, SIGNAL( frameRemoved() ), SLOT( slotUpdateMaxUsedFrames() ) );
connect( new_frame_sequence, SIGNAL( keyframeRemoved( int ) ), SIGNAL( keyframeRemovedToES( int ) ) );
connect( new_frame_sequence, SIGNAL( motionTweenCreated( int ) ), SIGNAL( motionTweenCreatedToES( int ) ) );
connect( new_frame_sequence, SIGNAL( motionTweenRemoved( int ) ), SIGNAL( motionTweenRemovedToES( int ) ) );
list_of_frame_sequences.append( new_frame_sequence );
last_frame_sequence = new_frame_sequence;
updateContentSize();
new_frame_sequence -> loadFrames( keyframes );
}
}
示例9: setFixedExtent
void QDockArea::setFixedExtent( int d, QDockWindow *dw )
{
QPtrList<QDockWindow> lst;
QDockWindow *w;
for ( w = dockWindows->first(); w; w = dockWindows->next() ) {
if ( w->isHidden() )
continue;
if ( orientation() == Horizontal ) {
if ( dw->y() != w->y() )
continue;
} else {
if ( dw->x() != w->x() )
continue;
}
if ( orientation() == Horizontal )
d = QMAX( d, w->minimumHeight() );
else
d = QMAX( d, w->minimumWidth() );
if ( w->isResizeEnabled() )
lst.append( w );
}
for ( w = lst.first(); w; w = lst.next() ) {
if ( orientation() == Horizontal )
w->setFixedExtentHeight( d );
else
w->setFixedExtentWidth( d );
}
}
示例10: cacheSaveToDisk
void KSSLD::cacheSaveToDisk() {
KSSLCNode *node;
for (node = certList.first(); node; node = certList.next()) {
if (node->permanent || node->expires > QDateTime::currentDateTime()) {
// First convert to a binary format and then write the kconfig entry
// write the (CN, policy, cert) to KSimpleConfig
cfg->setGroup(node->cert->getSubject());
cfg->writeEntry("Certificate", node->cert->toString());
cfg->writeEntry("Policy", node->policy);
cfg->writeEntry("Expires", node->expires);
cfg->writeEntry("Permanent", node->permanent);
cfg->writeEntry("Hosts", node->hosts);
// Also write the chain
QStringList qsl;
QPtrList<KSSLCertificate> cl = node->cert->chain().getChain();
for (KSSLCertificate *c = cl.first(); c != 0; c = cl.next()) {
//kdDebug() << "Certificate in chain: " << c->toString() << endl;
qsl << c->toString();
}
cl.setAutoDelete(true);
cfg->writeEntry("Chain", qsl);
}
}
cfg->sync();
// insure proper permissions -- contains sensitive data
QString cfgName(KGlobal::dirs()->findResource("config", "ksslpolicies"));
if (!cfgName.isEmpty())
::chmod(QFile::encodeName(cfgName), 0600);
}
示例11: dlg
Resource *ResourceSelectDialog::getResource(AddressBook *ab, QWidget *parent)
{
QPtrList< Resource > resources = ab->resources();
if(resources.count() == 1)
return resources.first();
Resource *found = 0;
Resource *r = resources.first();
while(r)
{
if(!r->readOnly())
{
if(found)
{
found = 0;
break;
}
else
{
found = r;
}
}
r = resources.next();
}
if(found)
return found;
ResourceSelectDialog dlg(ab, parent);
if(dlg.exec() == KDialog::Accepted)
return dlg.resource();
else
return 0;
}
示例12: deselectAll
void QTodoList::sort()
{
QTodoSortDialog sort_dialog;
deselectAll();
if(sort_dialog.exec() == QDialog::Accepted)
{
preserveContentsYPos();
const QTodoSortCriteriaMap* criterias = sort_dialog.getCriterias();
QPtrList<QWidget> list_widgets;
list_widgets.append(0);
QTodoListIterator it(this);
for(;it.current();++it)
list_widgets.append(it.current());
QTodoListItemsSorter sorter(&list_widgets,criterias);
QPtrList<QWidget>* sorted = sorter.get();
QTUM::get()->startRecording();
takeAll();
for(unsigned int i = 0; i < sorted->count(); ++i)
{
if(QTodoItem* item = dynamic_cast<QTodoItem*>(sorted->at(i)))
{
insertTodo(item,i);
item->setDepth(item->getDepth());
}
}
QTUM::get()->stopRecording();
restoreContentsYPos();
}
}
示例13: workspace
//
// A window title was selected from window menu, show that window
//
void App::slotWindowMenuCallback(int item)
{
QPtrList <QWidget> wl = workspace()->windowList();
if (item == ID_WINDOW_CASCADE || item == ID_WINDOW_TILE)
{
return;
}
if (wl.count())
{
QWidget* widget;
widget = wl.at(item);
if (widget != NULL)
{
widget->show();
widget->setFocus();
}
else
{
assert(false);
}
disconnect(m_windowMenu);
}
}
示例14: QueryGetData
STDMETHODIMP QOleDataObject::GetData( FORMATETC *pformatetcIn, STGMEDIUM *pmedium )
{
// is data is in our format?
HRESULT hr = QueryGetData( pformatetcIn );
if ( hr != S_OK )
return hr;
int cf = pformatetcIn->cfFormat;
pmedium->tymed = TYMED_HGLOBAL;
QPtrList<QWindowsMime> all = QWindowsMime::all();
for ( QWindowsMime * c = all.first(); c ; c = all.next() ) {
const char * mime = c->mimeFor( cf );
if ( mime && m_dragObj->provides( mime ) ) {
QByteArray ba = m_dragObj->encodedData( mime );
ba = c->convertFromMime( ba, mime, cf );
HGLOBAL hGlobal = GlobalAlloc ( GMEM_MOVEABLE | GMEM_SHARE, ba.size() );
if ( !hGlobal )
return E_OUTOFMEMORY;
memcpy ( GlobalLock ( hGlobal ), ba.data(), ba.size() );
GlobalUnlock ( hGlobal );
pmedium->hGlobal = hGlobal;
pmedium->pUnkForRelease = NULL;
return S_OK;
}
}
return E_UNEXPECTED;
}
示例15: defined
void QEventLoop::setSocketNotifierPending( QSocketNotifier *notifier )
{
int sockfd = notifier->socket();
int type = notifier->type();
if ( sockfd < 0 || type < 0 || type > 2 || notifier == 0 ) {
#if defined(QT_CHECK_RANGE)
qWarning( "QSocketNotifier: Internal error" );
#endif
return;
}
QPtrList<QSockNot> *list = d->sn_vec[type].list;
QSockNot *sn;
if ( ! list )
return;
sn = list->first();
while ( sn && !(sn->obj == notifier && sn->fd == sockfd) )
sn = list->next();
if ( ! sn ) { // not found
return;
}
// We choose a random activation order to be more fair under high load.
// If a constant order is used and a peer early in the list can
// saturate the IO, it might grab our attention completely.
// Also, if we're using a straight list, the callback routines may
// delete other entries from the list before those other entries are
// processed.
if ( ! FD_ISSET( sn->fd, sn->queue ) ) {
d->sn_pending_list.insert( (rand() & 0xff) %
(d->sn_pending_list.count()+1), sn );
FD_SET( sn->fd, sn->queue );
}
}