PositionViewWidget *KraftView::createPositionViewWidget( DocPositionBase *dp, int pos ) { PositionViewWidget *w = new PositionViewWidget( ); int cw = m_positionScroll->width(); if ( cw < 400 ) cw = 400; w->resize( cw, w->height() ); connect( w, SIGNAL( deletePosition() ), mDeleteMapper, SLOT( map() ) ); connect( w, SIGNAL( moveUp() ), mMoveUpMapper, SLOT( map() ) ); connect( w, SIGNAL( moveDown() ), mMoveDownMapper, SLOT( map() ) ); connect( w, SIGNAL( lockPosition() ), mLockPositionMapper, SLOT( map() ) ); connect( w, SIGNAL( unlockPosition() ), mUnlockPositionMapper, SLOT( map() ) ); connect( w, SIGNAL( positionModified()), mModifiedMapper, SLOT( map() ) ); setMappingId( w, pos ); QStringList units = UnitManager::self()->allUnits(); units.sort(); w->m_cbUnit->addItems(units); if( dp->dbId().toInt() < 0 ) { w->slotSetState( PositionViewWidget::New ); } /* do resizing and add the widget to the scrollview and move it to the final place */ if ( mHelpLabel ) { mHelpLabel->hide(); } mPositionWidgetList.insert( pos, w ); m_positionScroll->addChild( w, pos ); //Set the correct indexes when the widget is not appended if(pos < mPositionWidgetList.count()) { for(int i = pos+1; i < mPositionWidgetList.count(); ++i) { mPositionWidgetList.at(i)->setOrdNumber(i+1); } } w->setDocPosition( dp, getDocument()->locale() ); w->setOrdNumber( pos+1 ); w->slotSetTax( dp->taxType() ); return w; }
// Removes the element in the specified position from the list // This also destroys the object that is removed // If the position is invalid nothing happens void OrderedList::destroyElement (byte pos) { deletePosition (pos, true); }
// Removes the element in the specified position // If does not delete the object, only removes it from the list // If the position is invalid nothing happens void OrderedList::removeElement (byte pos) { deletePosition (pos, false); }