本文整理汇总了C++中QPtrList::getLast方法的典型用法代码示例。如果您正苦于以下问题:C++ QPtrList::getLast方法的具体用法?C++ QPtrList::getLast怎么用?C++ QPtrList::getLast使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QPtrList
的用法示例。
在下文中一共展示了QPtrList::getLast方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: temp_stack_next
void QtCalculator::temp_stack_next(){
CALCAMNT *number;
if( temp_stack.current() == temp_stack.getLast()){
KNotifyClient::beep();
return;
}
number = temp_stack.next();
if(number == NULL){
KNotifyClient::beep();
return;
}
else{
// printf("Number: %Lg\n",*number);
last_input = RECALL;
DISPLAY_AMOUNT = *number;
UpdateDisplay();
}
}
示例2: 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);
}
}
示例3: 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 );
}
}