本文整理汇总了C++中QPtrList::getFirst方法的典型用法代码示例。如果您正苦于以下问题:C++ QPtrList::getFirst方法的具体用法?C++ QPtrList::getFirst怎么用?C++ QPtrList::getFirst使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QPtrList
的用法示例。
在下文中一共展示了QPtrList::getFirst方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: printf
void
xQGanttBarViewPort::deleteSelectedItems()
{
#ifdef _DEBUG_
printf("-> xQGanttBarViewPort::deleteSelectedItems()\n");
#endif
QPtrList<KGanttItem> list;
observeList(&list);
getSelectedItems(_toplevelitem, list);
for(KGanttItem *subitem = list.first();
subitem != 0;
subitem = list.next())
{
#ifdef _DEBUG_
printf(" : %s \n", subitem->getText().latin1());
#endif
connect(subitem, SIGNAL(destroyed(KGanttItem *)),
this, SLOT(itemDestroyed(KGanttItem *)));
}
list.remove(_toplevelitem);
while(list.count() > 0)
{
KGanttItem *item = list.getFirst();
delete item;
}
#ifdef _DEBUG_
printf("<- xQGanttBarViewPort::deleteSelectedItems()\n");
#endif
}
示例2: loadFrames
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 );
}
}
示例3: doPluginAction
bool KMCupsJobManager::doPluginAction(int ID, const QPtrList<KMJob>& jobs)
{
switch (ID)
{
case 0:
if (jobs.count() == 1)
return jobIppReport(jobs.getFirst());
break;
case 1:
return changePriority(jobs, true);
case 2:
return changePriority(jobs, false);
case 3:
return editJobAttributes(jobs.getFirst());
}
return false;
}
示例4: inspectTuplet
void NPmxExport::inspectTuplet(NPlayable *elem, int staff_nr, int barnr_) {
QPtrList<NPlayable> *tupletlist;
badmeasure *bad;
int len1, len2;
NPlayable *elem2;
bool len2set = false;
tupletlist = elem->getTupletList();
if ((int)(tupletlist->count()) != elem->getNumNotes()) {
elem2 = tupletlist->first();
len1 = len2 = elem2->getSubType();
for (elem2 = tupletlist->next(); elem2; elem2 = tupletlist->next()) {
if (elem2->getSubType() != len1) {
if (len2set) {
if (elem2->getSubType() != len2) {
bad = new badmeasure(PMX_ERR_NOT_NUM_TUMPLET, staff_nr, barnr_, 0, 0);
badlist_.append(bad);
}
}
else {
len2set = true;
len2 = elem2->getSubType();
}
}
}
if (len2set) {
if (len1 != 2*len2 && len2 != 2*len1) {
bad = new badmeasure(PMX_ERR_NOT_NUM_TUMPLET, staff_nr, barnr_, 0, 0);
badlist_.append(bad);
}
if (len1 < len2) {
tupletBase_ = len1;
}
else {
tupletBase_ = len2;
}
}
else {
tupletBase_ = len1;
}
}
else {
tupletBase_ = tupletlist->getFirst()->getSubType();
}
if (tupletlist->getLast()->getType() == T_REST) {
bad = new badmeasure(PMX_ERR_TUPLET_ENDS_REST, staff_nr, barnr_, 0, 0);
badlist_.append(bad);
}
}
示例5: temp_stack_prev
void QtCalculator::temp_stack_prev(){
CALCAMNT *number;
if( temp_stack.current() == temp_stack.getFirst()){
KNotifyClient::beep();
return;
}
number = temp_stack.prev();
if(number == NULL){
KNotifyClient::beep();
return;
}
else{
// printf("Number: %Lg\n",*number);
last_input = RECALL;
DISPLAY_AMOUNT = *number;
UpdateDisplay();
}
}
示例6: mousePressEvent
void QueueLabel::mousePressEvent( QMouseEvent* mouseEvent )
{
hideToolTip();
if( m_timer.isActive() ) // if the user clicks again when (right after) the menu is open,
{ // (s)he probably wants to close it
m_timer.stop();
return;
}
Playlist *pl = Playlist::instance();
PLItemList &queue = pl->m_nextTracks;
if( queue.isEmpty() )
return;
int length = 0;
for( QPtrListIterator<PlaylistItem> it( queue ); *it; ++it )
{
const int s = (*it)->length();
if( s > 0 ) length += s;
}
QPtrList<KPopupMenu> menus;
menus.setAutoDelete( true );
KPopupMenu *menu = new KPopupMenu;
menus.append( menu );
const uint count = queue.count();
if( length )
menu->insertTitle( i18n( "1 Queued Track (%1)", "%n Queued Tracks (%1)", count )
.arg( MetaBundle::prettyLength( length, true ) ) );
else
menu->insertTitle( i18n( "1 Queued Track", "%n Queued Tracks", count ) );
Pana::actionCollection()->action( "queue_manager" )->plug( menu );
menu->insertItem( SmallIconSet( Pana::icon( "rewind" ) ),
count > 1 ? i18n( "&Dequeue All Tracks" ) : i18n( "&Dequeue Track" ), 0 );
menu->insertSeparator();
uint i = 1;
QPtrListIterator<PlaylistItem> it( queue );
it.toFirst();
while( i <= count )
{
for( uint n = kMin( i + MAX_TO_SHOW - 1, count ); i <= n; ++i, ++it )
menu->insertItem(
KStringHandler::rsqueeze( i18n( "%1. %2" ).arg( i ).arg( veryNiceTitle( *it ) ), 50 ), i );
if( i < count )
{
menus.append( new KPopupMenu );
menu->insertSeparator();
menu->insertItem( i18n( "1 More Track", "%n More Tracks", count - i + 1 ), menus.getLast() );
menu = menus.getLast();
}
}
menu = menus.getFirst();
int mx, my;
const int mw = menu->sizeHint().width(),
mh = menu->sizeHint().height(),
sy = mapFrom( Pana::StatusBar::instance(), QPoint( 0, 0 ) ).y(),
sheight = Pana::StatusBar::instance()->height();
const QRect dr = QApplication::desktop()->availableGeometry( this );
if( mapYToGlobal( sy ) - mh > dr.y() )
my = mapYToGlobal( sy ) - mh;
else if( mapYToGlobal( sy + sheight ) + mh < dr.y() + dr.height() )
my = mapYToGlobal( sy + sheight );
else
my = mapToGlobal( mouseEvent->pos() ).y();
mx = mapXToGlobal( 0 ) - ( mw - width() ) / 2;
int id = menu->exec( QPoint( mx, my ) );
if( id < 0 )
m_timer.start( 50, true );
else if( id == 0 ) //dequeue
{
const PLItemList dequeued = queue;
while( !queue.isEmpty() )
pl->queue( queue.getLast(), true );
emit queueChanged( PLItemList(), dequeued );
}
else
{
PlaylistItem *selected = queue.at( id - 1 );
if( selected )
pl->ensureItemCentered( selected );
}
}