예제 #1
0
/*!
    Destroys the QGraphicsAnchorLayout object.
*/
QGraphicsAnchorLayout::~QGraphicsAnchorLayout()
{
    Q_D(QGraphicsAnchorLayout);

    for (int i = count() - 1; i >= 0; --i) {
        QGraphicsLayoutItem *item = d->items.at(i);
        removeAt(i);
        if (item) {
            if (item->ownedByLayout())
                delete item;
        }
    }

    d->removeCenterConstraints(this, QGraphicsAnchorLayoutPrivate::Horizontal);
    d->removeCenterConstraints(this, QGraphicsAnchorLayoutPrivate::Vertical);
    d->deleteLayoutEdges();

    Q_ASSERT(d->itemCenterConstraints[0].isEmpty());
    Q_ASSERT(d->itemCenterConstraints[1].isEmpty());
    Q_ASSERT(d->items.isEmpty());
    Q_ASSERT(d->m_vertexList.isEmpty());
}
예제 #2
0
bool QTimerInfoList::unregisterTimer(int timerId)
{
    // set timer inactive
    for (int i = 0; i < count(); ++i) {
        register QTimerInfo *t = at(i);
        if (t->id == timerId) {
            // found it
            removeAt(i);
            if (t == firstTimerInfo)
                firstTimerInfo = 0;
            if (t == currentTimerInfo)
                currentTimerInfo = 0;

            // release the timer id
            if (!QObjectPrivate::get(t->obj)->inThreadChangeEvent)
                QAbstractEventDispatcherPrivate::releaseTimerId(timerId);

            delete t;
            return true;
        }
    }
    // id not found
    return false;
}
예제 #3
0
 item_type* cutTop()
 {
     return removeAt(0);
 }
예제 #4
0
// Removes the last element from an array and returns the value of that element.
frame_point_data_t* PSFramePoints::pop()
{
	return removeAt(length-1);
}
예제 #5
0
WObject* WEXPORT WVList::removeSame( WObject* obj )
{
    return( removeAt( indexOfSame( obj ) ) );
}
예제 #6
0
void CDeviceTypeList::deleteAt(POSITION pos)
{
   TypeStruct* typeStruct = removeAt(pos);

   delete typeStruct;
}
예제 #7
0
void GCompound::remove(GObject* gobj) {
    int index = findGObject(gobj);
    if (index != -1) removeAt(index);
}
예제 #8
0
파일: graph.cpp 프로젝트: fidelbc/graphbag
void Graph::erase_vertex( Vertex * v ){
  int index = indexOf( v );
  if( index > -1 ){
    removeAt( index );
  }
}
예제 #9
0
void QMatList::removeMat(QMat *mat){
    if ( !mat )
        return;
    removeAt(m_list.indexOf(mat));
}
예제 #10
0
void Server_Room::removeClient(Server_ProtocolHandler *client)
{
	removeAt(indexOf(client));
	sendRoomEvent(new Event_LeaveRoom(id, client->getUserInfo()->getName()));
	emit roomInfoChanged();
}
void MAbstractLayoutPolicy::removeItem(const QGraphicsLayoutItem* item)
{
    removeAt(indexOf(item));
}
예제 #12
0
// Removes the last element from an array and returns the value of that element.
player_point_3d_t* PSPoints2Draw::pop()
{
	return removeAt(length-1);
}
예제 #13
0
/*!
    \since 4.8

    Removes the layout item \a item without destroying it.
    Ownership of the item is transferred to the caller.

    \sa addItem()
*/
void QGraphicsGridLayout::removeItem(QGraphicsLayoutItem *item)
{
    Q_D(QGraphicsGridLayout);
    int index = d->engine.indexOf(item);
    removeAt(index);
}
예제 #14
0
void MarkerModel::removeMarker(MarkerItem* item) {
	auto container = item->container();
	int row = container->index();
	container->removeAt(item->index());
	emit dataChanged(index(row, 1), index(row, 1)); 
}
예제 #15
0
            item_type* remove(item_type* pItem)
            {				
                pos_type i = pItem->getPos();

                return removeAt(i);
            }	
예제 #16
0
void SWidgetManager::remove( QWidget *widget )
{
    removeAt( p->widgets.indexOf(widget) );
}
예제 #17
0
void AbstractMediaList::replace(int index, const VlcMedia &new_media)
{
    removeAt(index);
    insert(index, new_media);
}
void MAbstractLayoutPolicy::removeItem(const QGraphicsLayoutItem *item)
{
    int index = indexOf(item);
    if (index >= 0)
        removeAt(index);
}
예제 #19
0
VlcMedia AbstractMediaList::takeAt(int index)
{
    VlcMedia item = value(index);
    removeAt(index);
    return item;
}
예제 #20
0
void ContactsKopete::updateContactData(const QString & contact)
{
    if (d->noOnlineContacts) {
        load(true);
        return;
    }

    // Retrieving contact name
    QDBusReply < QString > contactName = d->interface->getDisplayName(contact);
    if (!contactName.isValid()) {
        return;
    }

    QDBusReply < QVariantMap > contactProperties = d->interface->contactProperties(contact);
    if (!contactProperties.isValid() || contactProperties.value().size() == 0) {
        return;
    }

    QDBusReply < bool > contactOnline = d->interface->isContactOnline(contact);
    if (!contactOnline.isValid()) {
        return;
    }

    QString avatarPath = contactProperties.value().value("picture").toString();
    avatarPath = KUrl(avatarPath).toLocalFile();
    if (avatarPath.isEmpty()) {
        avatarPath = "user-online";
    }
    kDebug() << "avatarPath" << avatarPath;

    QString status = contactProperties.value().value("status_message").toString();
    if (status.isEmpty()) {
        status = contactProperties.value().value("status").toString();
    }

    int index;
    for (index = 0; index < size(); index++) {
        if (itemAt(index).data == contact) {
            break;
        }
    }

    if (index >= size()) {
        // we don't have this contact in the list
        if (contactOnline.value()) {
            add(
                contactProperties.value().value("display_name").toString(),
                status,
                KIcon(avatarPath),
                contact);
        }
    } else {
        // we already have this contact
        if (contactOnline.value()) {
            // we are updating the contact
            set(index,
                contactProperties.value().value("display_name").toString(),
                status,
                KIcon(avatarPath),
                contact);
        } else {
            // we are removing the contact from the list
            removeAt(index);

            if (size() == 0) {
                d->noOnlineContacts = true;
                add(i18n("No online contacts"), "", KIcon("user-offline"), QVariant());
            }
        }
    }
}
예제 #21
0
void AbstractMediaList::removeFirst()
{
    removeAt(0);
}
예제 #22
0
void GCompound::removeAll() {
    while (!contents.isEmpty()) {
        removeAt(0);
    }
}
예제 #23
0
void AbstractMediaList::removeLast()
{
    removeAt(length() - 1);
}
예제 #24
0
void AbstractMediaList::removeOne(const VlcMedia &media)
{
    removeAt(indexOf(media));
}
예제 #25
0
void KNMusicDatabase::onActionRowRemove(QModelIndex index)
{
    removeAt(index.row());
}
예제 #26
0
/**
 * Removes double entries from the list. Double entries can occur
 * when a point is a waypoint as well as an airfield. In this case,
 * the one with the higher severity or longer name is preferred.
 * This function ASSUMES THE LIST IS SORTED!
 */
void ReachableList::removeDoubles()
{
  QList<int> removeList;

  for (int i=count()-1; i>=1; i--)
    {
      const ReachablePoint& p1 = at(i);

      for (int j=0; j<i; j++)
        {
          const ReachablePoint& p2 = at(j);

          //qDebug("i=%d j=%d, P1=%s, P2=%s,", i, j, p1.getWaypoint()->name.toLatin1().data(), p2.getWaypoint()->name.toLatin1().data());

          if ( p2.getWaypoint()->wgsPoint == p1.getWaypoint()->wgsPoint )
            {
              //qDebug("  points are the same");
              // ok, the points are the same. Now we choose which one to remove

              if ( p2.getWaypoint()->priority != p1.getWaypoint()->priority )
                {
                  // the waypoint with the lower priority will be removed
                  if ( p2.getWaypoint()->priority > p1.getWaypoint()->priority )
                    {
                      removeList.append(i);
                    }
                  else
                    {
                      removeList.append(j);
                    }
                  continue;
                }

              if ( p2.getWaypoint()->name == p1.getWaypoint()->name )
                {
                  // both name are identical. remove the one which has not set
                  // the airfield origin flag.
                  if( ! p1.isOrignAfl() )
                     {
                       removeList.append(i);
                       continue;
                     }

                  if( ! p2.isOrignAfl() )
                     {
                       removeList.append(j);
                       continue;
                     }

                  // both origin flags are set, remove one of the objects
                  removeList.append(j);
                  continue;
                }

              if ( p2.getWaypoint()->name.length() == p1.getWaypoint()->name.length() )
                {
                  // the lengths of the names are the same
                  // remove the one with the lowest alphabetical value
                  // (remember that A<a)
                  if (p2.getWaypoint()->name > p1.getWaypoint()->name)
                    {
                      removeList.append(i);
                    }
                  else
                    {
                      removeList.append(j);
                    }
                  continue;
                }

              // if the names are not of equal length, remove the shortest.
              if ( p2.getWaypoint()->name.length() > p1.getWaypoint()->name.length() )
                {
                  removeList.append(i);
                }
              else
                {
                  removeList.append(j);
                }
              continue;
            }

          // qDebug("  points are NOT the same: (%d, %d) vs (%d, %d)",p1.getWaypoint()->origP.x(),p1.getWaypoint()->origP.y(),p2.getWaypoint()->origP.x(),p2.getWaypoint()->origP.y());
        } // End of for j
    } // End of for i

  // sort remove list
  qSort( removeList.begin(), removeList.end(), qLess<int>() );

  // Start remove at the end of the list so that access index is always valid.
  for (int i = removeList.count()-1; i >= 0; i--)
    {
      // qDebug("Removing point %d (%s)", removeList.at(i), at(removeList.at(i)).getWaypoint()->name.toLatin1().data());
      // remove doubles from global list
      removeAt( removeList.at(i) );
    }
}
예제 #27
0
void LinkedList<Item>::headRemove() {
  removeAt(0);
}