当前位置: 首页>>代码示例>>C++>>正文


C++ QList::contains方法代码示例

本文整理汇总了C++中QList::contains方法的典型用法代码示例。如果您正苦于以下问题:C++ QList::contains方法的具体用法?C++ QList::contains怎么用?C++ QList::contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QList的用法示例。


在下文中一共展示了QList::contains方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: removeColumns

/*!
    \fn void QTextTable::removeColumns(int index, int columns)

    Removes a number of \a columns starting with the column at the specified
    \a index.

    \sa insertRows() insertColumns() removeRows() resize() appendRows() appendColumns()
*/
void QTextTable::removeColumns(int pos, int num)
{
    Q_D(QTextTable);
//     qDebug() << "-------- removeCols" << pos << num;

    if (num <= 0 || pos < 0)
	return;
    if (d->dirty)
        d->update();
    if (pos >= d->nCols)
        return;
    if (pos + num > d->nCols)
        pos = d->nCols - num;

    QTextDocumentPrivate *p = d->pieceTable;
    QTextFormatCollection *collection = p->formatCollection();
    p->beginEditBlock();

    // delete whole table?
    if (pos == 0 && num == d->nCols) {
        const int pos = p->fragmentMap().position(d->fragment_start);
        p->remove(pos, p->fragmentMap().position(d->fragment_end) - pos + 1);
        p->endEditBlock();
        return;
    }

    p->aboutToRemoveCell(cellAt(0, pos).firstPosition(), cellAt(d->nRows - 1, pos + num - 1).lastPosition());

    QList<int> touchedCells;
    for (int r = 0; r < d->nRows; ++r) {
        for (int c = pos; c < pos + num; ++c) {
            int cell = d->grid[r*d->nCols + c];
            QTextDocumentPrivate::FragmentIterator it(&p->fragmentMap(), cell);
            QTextCharFormat fmt = collection->charFormat(it->format);
            int span = fmt.tableCellColumnSpan();
            if (touchedCells.contains(cell) && span <= 1)
                continue;
            touchedCells << cell;

            if (span > 1) {
                fmt.setTableCellColumnSpan(span - 1);
                p->setCharFormat(it.position(), 1, fmt);
            } else {
                // remove cell
                int index = d->cells.indexOf(cell) + 1;
                int f_end = index < d->cells.size() ? d->cells.at(index) : d->fragment_end;
                p->remove(it.position(), p->fragmentMap().position(f_end) - it.position());
            }
        }
    }

    QTextTableFormat tfmt = format();
    tfmt.setColumns(tfmt.columns()-num);
    QVector<QTextLength> columnWidths = tfmt.columnWidthConstraints();
    if (columnWidths.count() > pos) {
        columnWidths.remove(pos, num);
        tfmt.setColumnWidthConstraints (columnWidths);
    }
    QTextObject::setFormat(tfmt);

    p->endEditBlock();
//     qDebug() << "-------- end removeCols" << pos << num;
}
开发者ID:Suneal,项目名称:qt,代码行数:71,代码来源:qtexttable.cpp

示例2: checkDuplicates

ErrorList topolTest::checkDuplicates( double tolerance, QgsVectorLayer *layer1, QgsVectorLayer *layer2, bool isExtent )
{
  Q_UNUSED( tolerance );
  Q_UNUSED( layer2 );
  //TODO: multilines - check all separate pieces
  int i = 0;
  ErrorList errorList;

  QList<QgsFeatureId> duplicateIds;

  QgsSpatialIndex* index = mLayerIndexes[layer1->id()];

  QgsGeometry canvasExtentPoly = QgsGeometry::fromWkt( theQgsInterface->mapCanvas()->extent().asWktPolygon() );

  QMap<QgsFeatureId, FeatureLayer>::const_iterator it;
  for ( it = mFeatureMap2.constBegin(); it != mFeatureMap2.constEnd(); ++it )
  {
    if ( !( ++i % 100 ) )
      emit progress( i );

    QgsFeatureId currentId = it->feature.id();

    if ( duplicateIds.contains( currentId ) )
    {
      //is already a duplicate geometry..skip..
      continue;
    }

    if ( testCancelled() )
      break;

    QgsGeometry g1 = it->feature.geometry();
    QgsRectangle bb = g1.boundingBox();

    QList<QgsFeatureId> crossingIds;
    crossingIds = index->intersects( bb );

    QList<QgsFeatureId>::Iterator cit = crossingIds.begin();
    QList<QgsFeatureId>::ConstIterator crossingIdsEnd = crossingIds.end();

    bool duplicate = false;

    for ( ; cit != crossingIdsEnd; ++cit )
    {
      duplicate = false;
      // skip itself
      if ( mFeatureMap2[*cit].feature.id() == it->feature.id() )
        continue;

      QgsGeometry g2 = mFeatureMap2[*cit].feature.geometry();
      if ( g2.isEmpty() )
      {
        QgsMessageLog::logMessage( tr( "Invalid second geometry in duplicate geometry test." ), tr( "Topology plugin" ) );
        continue;
      }

      if ( !_canExportToGeos( g2 ) )
      {
        QgsMessageLog::logMessage( tr( "Failed to import second geometry into GEOS in duplicate geometry test." ), tr( "Topology plugin" ) );
        continue;
      }

      if ( g1.equals( g2 ) )
      {
        duplicate = true;
        duplicateIds.append( mFeatureMap2[*cit].feature.id() );
      }

      if ( duplicate )
      {


        QList<FeatureLayer> fls;
        fls << *it << *it;
        QgsGeometry conflict( g1 );

        if ( isExtent )
        {
          if ( canvasExtentPoly.disjoint( conflict ) )
          {
            continue;
          }
          if ( canvasExtentPoly.crosses( conflict ) )
          {
            conflict = conflict.intersection( canvasExtentPoly );
          }
        }

        TopolErrorDuplicates* err = new TopolErrorDuplicates( bb, conflict, fls );

        errorList << err;
      }

    }

  }
  return errorList;
}
开发者ID:GrokImageCompression,项目名称:QGIS,代码行数:98,代码来源:topolTest.cpp

示例3: while

QHash<QByteArray, QByteArray> QAuthenticatorPrivate::parseDigestAuthenticationChallenge(const QByteArray &challenge)
{
    QHash<QByteArray, QByteArray> options;
    // parse the challenge
    const char *d = challenge.constData();
    const char *end = d + challenge.length();
    while (d < end) {
        while (d < end && (*d == ' ' || *d == '\n' || *d == '\r'))
            ++d;
        const char *start = d;
        while (d < end && *d != '=')
            ++d;
        QByteArray key = QByteArray(start, d - start);
        ++d;
        if (d >= end)
            break;
        bool quote = (*d == '"');
        if (quote)
            ++d;
        if (d >= end)
            break;
        start = d;
        QByteArray value;
        while (d < end) {
            bool backslash = false;
            if (*d == '\\' && d < end - 1) {
                ++d;
                backslash = true;
            }
            if (!backslash) {
                if (quote) {
                    if (*d == '"')
                        break;
                } else {
                    if (*d == ',')
                        break;
                }
            }
            value += *d;
            ++d;
        }
        while (d < end && *d != ',')
            ++d;
        ++d;
        options[key] = value;
    }

    QByteArray qop = options.value("qop");
    if (!qop.isEmpty()) {
        QList<QByteArray> qopoptions = qop.split(',');
        if (!qopoptions.contains("auth"))
            return QHash<QByteArray, QByteArray>();
        // #### can't do auth-int currently
//         if (qop.contains("auth-int"))
//             qop = "auth-int";
//         else if (qop.contains("auth"))
//             qop = "auth";
//         else
//             qop = QByteArray();
        options["qop"] = "auth";
    }

    return options;
}
开发者ID:,项目名称:,代码行数:64,代码来源:

示例4: f

QList<Abi> Abi::abisOfBinary(const Utils::FileName &path)
{
    QList<Abi> tmp;
    if (path.isEmpty())
        return tmp;

    QFile f(path.toString());
    if (!f.exists())
        return tmp;

    if (!f.open(QFile::ReadOnly))
        return tmp;

    QByteArray data = f.read(1024);
    if (data.size() >= 67
            && getUint8(data, 0) == '!' && getUint8(data, 1) == '<' && getUint8(data, 2) == 'a'
            && getUint8(data, 3) == 'r' && getUint8(data, 4) == 'c' && getUint8(data, 5) == 'h'
            && getUint8(data, 6) == '>' && getUint8(data, 7) == 0x0a) {
        // We got an ar file: possibly a static lib for ELF, PE or Mach-O

        data = data.mid(8); // Cut of ar file magic
        quint64 offset = 8;

        while (!data.isEmpty()) {
            if ((getUint8(data, 58) != 0x60 || getUint8(data, 59) != 0x0a)) {
                qWarning() << path.toString() << ": Thought it was an ar-file, but it is not!";
                break;
            }

            const QString fileName = QString::fromLocal8Bit(data.mid(0, 16));
            quint64 fileNameOffset = 0;
            if (fileName.startsWith(QLatin1String("#1/")))
                fileNameOffset = fileName.mid(3).toInt();
            const QString fileLength = QString::fromLatin1(data.mid(48, 10));

            int toSkip = 60 + fileNameOffset;
            offset += fileLength.toInt() + 60 /* header */;

            tmp.append(abiOf(data.mid(toSkip)));
            if (tmp.isEmpty() && fileName == QLatin1String("/0              "))
                tmp = parseCoffHeader(data.mid(toSkip, 20)); // This might be windws...

            if (!tmp.isEmpty()
                    && tmp.at(0).binaryFormat() != Abi::MachOFormat)
                break;

            offset += (offset % 2); // ar is 2 byte aligned
            f.seek(offset);
            data = f.read(1024);
        }
    } else {
        tmp = abiOf(data);
    }
    f.close();

    // Remove duplicates:
    QList<Abi> result;
    foreach (const Abi &a, tmp) {
        if (!result.contains(a))
            result.append(a);
    }

    return result;
}
开发者ID:retrobrain,项目名称:qt-creator,代码行数:64,代码来源:abi.cpp

示例5: QStringList

QList<fugio::NodeControlInterface::AvailablePinEntry> NamespacePin::oscPins( const QStringList &pCurDir ) const
{
	QList<fugio::NodeControlInterface::AvailablePinEntry>		PinLst;

	for( QHash<QString,QVariant>::const_iterator it = mDataNames.begin() ; it != mDataNames.end() ; it++ )
	{
		QSharedPointer<fugio::PinInterface>		CurPin;

		QStringList		CurLst = it.key().split( '/', QString::SkipEmptyParts );

		if( !pCurDir.isEmpty() )
		{
			if( CurLst.size() <= pCurDir.size() )
			{
				continue;
			}

			bool			CurFnd = true;

			for( int i = 0 ; i < pCurDir.size() ; i++ )
			{
				if( CurLst.first() != pCurDir.at( i ) )
				{
					CurFnd = false;

					break;
				}

				CurLst.removeFirst();
			}

			if( !CurFnd )
			{
				continue;
			}
		}

		QStringList		NewLst = QStringList( CurLst.takeFirst() );

		while( true )
		{
			QString		CurNam = NewLst.join( '/' ).prepend( '/' );

			CurPin = mPin->node()->findOutputPinByName( CurNam );

			if( CurPin )
			{
				break;
			}

			fugio::NodeControlInterface::AvailablePinEntry		PE( "" );

			if( CurLst.isEmpty() )
			{
				QUuid		PinUid = PID_FLOAT;

				switch( QMetaType::Type( it.value().type() ) )
				{
					case QMetaType::Float:
					case QMetaType::Double:
						PinUid = PID_FLOAT;
						break;

					case QMetaType::Bool:
						PinUid = PID_BOOL;
						break;

					case QMetaType::Int:
					case QMetaType::Long:
						PinUid = PID_INTEGER;
						break;

					case QMetaType::QByteArray:
						PinUid = PID_BYTEARRAY;
						break;

					case QMetaType::QColor:
						PinUid = PID_COLOUR;
						break;

					case QMetaType::QString:
						PinUid = PID_STRING;
						break;

					case QMetaType::QVariantList:
						PinUid = PID_LIST;
						break;

					default:
						break;
				}

				PE = fugio::NodeControlInterface::AvailablePinEntry( CurNam, PinUid );
			}
			else
			{
				PE = fugio::NodeControlInterface::AvailablePinEntry( CurNam, PID_OSC_SPLIT );
			}

			if( !PinLst.contains( PE ) )
//.........这里部分代码省略.........
开发者ID:bigfug,项目名称:Fugio,代码行数:101,代码来源:namespacepin.cpp

示例6: processGameCommandContainer

Response::ResponseCode Server_ProtocolHandler::processGameCommandContainer(const CommandContainer &cont, ResponseContainer &rc)
{
    static QList<GameCommand::GameCommandType> antifloodCommandsWhiteList = QList<GameCommand::GameCommandType>()
        // draw/undo card draw (example: drawing 10 cards one by one from the deck)
        << GameCommand::DRAW_CARDS
        << GameCommand::UNDO_DRAW
        // create, delete arrows (example: targeting with 10 cards during an attack)
        << GameCommand::CREATE_ARROW
        << GameCommand::DELETE_ARROW
        // set card attributes (example: tapping 10 cards at once)
        << GameCommand::SET_CARD_ATTR
        // increment / decrement counter (example: -10 life points one by one)
        << GameCommand::INC_COUNTER
        // mulling lots of hands in a row
        << GameCommand::MULLIGAN
        // allows a user to sideboard without receiving flooding message
        << GameCommand::MOVE_CARD;

    if (authState == NotLoggedIn)
        return Response::RespLoginNeeded;

    QMap<int, QPair<int, int> > gameMap = getGames();
    if (!gameMap.contains(cont.game_id()))
        return Response::RespNotInRoom;
    const QPair<int, int> roomIdAndPlayerId = gameMap.value(cont.game_id());

    QReadLocker roomsLocker(&server->roomsLock);
    Server_Room *room = server->getRooms().value(roomIdAndPlayerId.first);
    if (!room)
        return Response::RespNotInRoom;

    QReadLocker roomGamesLocker(&room->gamesLock);
    Server_Game *game = room->getGames().value(cont.game_id());
    if (!game) {
        if (room->getExternalGames().contains(cont.game_id())) {
            server->sendIsl_GameCommand(cont,
                                        room->getExternalGames().value(cont.game_id()).server_id(),
                                        userInfo->session_id(),
                                        roomIdAndPlayerId.first,
                                        roomIdAndPlayerId.second
                                        );
            return Response::RespNothing;
        }
        return Response::RespNotInRoom;
    }

    QMutexLocker gameLocker(&game->gameMutex);
    Server_Player *player = game->getPlayers().value(roomIdAndPlayerId.second);
    if (!player)
        return Response::RespNotInRoom;

    int commandCountingInterval = server->getCommandCountingInterval();
    int maxCommandCountPerInterval = server->getMaxCommandCountPerInterval();
    GameEventStorage ges;
    Response::ResponseCode finalResponseCode = Response::RespOk;
    for (int i = cont.game_command_size() - 1; i >= 0; --i) {
        const GameCommand &sc = cont.game_command(i);
        logDebugMessage(QString("game %1 player %2: ").arg(cont.game_id()).arg(roomIdAndPlayerId.second) + QString::fromStdString(sc.ShortDebugString()));

        if (commandCountingInterval > 0) {
            int totalCount = 0;
            if (commandCountOverTime.isEmpty())
                commandCountOverTime.prepend(0);

            if(!antifloodCommandsWhiteList.contains((GameCommand::GameCommandType) getPbExtension(sc)))
                ++commandCountOverTime[0];

            for (int i = 0; i < commandCountOverTime.size(); ++i)
                totalCount += commandCountOverTime[i];

            if (totalCount > maxCommandCountPerInterval)
                return Response::RespChatFlood;
        }

        Response::ResponseCode resp = player->processGameCommand(sc, rc, ges);

        if (resp != Response::RespOk)
            finalResponseCode = resp;
    }
    ges.sendToGame(game);

    return finalResponseCode;
}
开发者ID:MRH4287,项目名称:Cockatrice,代码行数:83,代码来源:server_protocolhandler.cpp

示例7: moveFocus

void QAbstractButtonPrivate::moveFocus(int key)
{
    QList<QAbstractButton *> buttonList = queryButtonList();;
#ifndef QT_NO_BUTTONGROUP
    bool exclusive = group ? group->d_func()->exclusive : autoExclusive;
#else
    bool exclusive = autoExclusive;
#endif
    QWidget *f = QApplication::focusWidget();
    QAbstractButton *fb = qobject_cast<QAbstractButton *>(f);
    if (!fb || !buttonList.contains(fb))
        return;

    QAbstractButton *candidate = 0;
    int bestScore = -1;
    QRect target = f->rect().translated(f->mapToGlobal(QPoint(0,0)));
    QPoint goal = target.center();
    uint focus_flag = qt_tab_all_widgets() ? Qt::TabFocus : Qt::StrongFocus;

    for (int i = 0; i < buttonList.count(); ++i) {
        QAbstractButton *button = buttonList.at(i);
        if (button != f && button->window() == f->window() && button->isEnabled() && !button->isHidden() &&
            (autoExclusive || (button->focusPolicy() & focus_flag) == focus_flag)) {
            QRect buttonRect = button->rect().translated(button->mapToGlobal(QPoint(0,0)));
            QPoint p = buttonRect.center();

            //Priority to widgets that overlap on the same coordinate.
            //In that case, the distance in the direction will be used as significant score,
            //take also in account orthogonal distance in case two widget are in the same distance.
            int score;
            if ((buttonRect.x() < target.right() && target.x() < buttonRect.right())
                  && (key == Qt::Key_Up || key == Qt::Key_Down)) {
                //one item's is at the vertical of the other
                score = (qAbs(p.y() - goal.y()) << 16) + qAbs(p.x() - goal.x());
            } else if ((buttonRect.y() < target.bottom() && target.y() < buttonRect.bottom())
                        && (key == Qt::Key_Left || key == Qt::Key_Right) ) {
                //one item's is at the horizontal of the other
                score = (qAbs(p.x() - goal.x()) << 16) + qAbs(p.y() - goal.y());
            } else {
                score = (1 << 30) + (p.y() - goal.y()) * (p.y() - goal.y()) + (p.x() - goal.x()) * (p.x() - goal.x());
            }

            if (score > bestScore && candidate)
                continue;

            switch(key) {
            case Qt::Key_Up:
                if (p.y() < goal.y()) {
                    candidate = button;
                    bestScore = score;
                }
                break;
            case Qt::Key_Down:
                if (p.y() > goal.y()) {
                    candidate = button;
                    bestScore = score;
                }
                break;
            case Qt::Key_Left:
                if (p.x() < goal.x()) {
                    candidate = button;
                    bestScore = score;
                }
                break;
            case Qt::Key_Right:
                if (p.x() > goal.x()) {
                    candidate = button;
                    bestScore = score;
                }
                break;
            }
        }
    }

    if (exclusive
#ifdef QT_KEYPAD_NAVIGATION
        && !QApplication::keypadNavigationEnabled()
#endif
        && candidate
        && fb->d_func()->checked
        && candidate->d_func()->checkable)
        candidate->click();

    if (candidate) {
        if (key == Qt::Key_Up || key == Qt::Key_Left)
            candidate->setFocus(Qt::BacktabFocusReason);
        else
            candidate->setFocus(Qt::TabFocusReason);
    }
}
开发者ID:MarianMMX,项目名称:MarianMMX,代码行数:90,代码来源:qabstractbutton.cpp

示例8: validate

bool UIMachineSettingsSerialPage::validate(QString &strWarning, QString &strTitle)
{
    bool valid = true;
    QList<QPair<QString, QString> > ports;
    QStringList paths;

    int index = 0;
    for (; index < mTabWidget->count(); ++ index)
    {
        QWidget *tab = mTabWidget->widget (index);
        UIMachineSettingsSerial *page =
            static_cast<UIMachineSettingsSerial*> (tab);

        if (!page->mGbSerial->isChecked())
            continue;

        /* Check the predefined port attributes uniqueness: */
        {
            QString strIRQ = page->mLeIRQ->text();
            QString strIOPort = page->mLeIOPort->text();
            QPair<QString, QString> pair(strIRQ, strIOPort);
            valid = !strIRQ.isEmpty() && !strIOPort.isEmpty() && !ports.contains(pair);
            if (!valid)
            {
                if (strIRQ.isEmpty())
                    strWarning = tr("IRC not specified.");
                else if (strIOPort.isEmpty())
                    strWarning = tr("IO port not specified.");
                else
                    strWarning = tr ("duplicate port attributes specified.");
                strTitle += ": " +
                    vboxGlobal().removeAccelMark(mTabWidget->tabText(mTabWidget->indexOf(tab)));
            }
            ports << pair;
        }

        /* Check the port path emptiness & unicity */
        KPortMode mode =
            gpConverter->fromString<KPortMode> (page->mCbMode->currentText());
        if (mode != KPortMode_Disconnected)
        {
            QString path = page->mLePath->text();
            valid = !path.isEmpty() && !paths.contains (path);
            if (!valid)
            {
                if (!page->mGbSerial->isChecked())
                    page->mCbMode->setCurrentIndex (KPortMode_Disconnected);
                else
                {
                    strWarning = path.isEmpty() ?
                        tr ("port path not specified.") :
                        tr ("duplicate port path entered.");
                    strTitle += ": " +
                        vboxGlobal().removeAccelMark (mTabWidget->tabText (mTabWidget->indexOf (tab)));
                    break;
                }
            }
            paths << path;
        }
    }

    return valid;
}
开发者ID:apaka,项目名称:vbox,代码行数:63,代码来源:UIMachineSettingsSerial.cpp

示例9: ResetLibrary

// Build Library
void tAt5CategoryLibrary::BuildLibrary( std::vector< boost::shared_ptr< tAt5FeatureDefinition > >& featureDefinitionList, tAt5CategoryTranslatorXPtr xCategoryTranslator, const bool& quit )
{
    ResetLibrary();

    QList<QString> majorCategoriesDisabled;
    for ( unsigned int fdl = 0; fdl < featureDefinitionList.size(); ++ fdl )
    {
        if ( quit )
            return;
        
        // For some reason Jeppesen is naming their block array features.  We dont want these showing up in the category list,
        // so dont include block features here.
        if(featureDefinitionList[fdl]->xFeatureDefinition->FeatureType() != At5::eFT_BlockArray)
        {
            QString catName = featureDefinitionList[fdl]->xFeatureDefinition->MajorCategoryName() + "." + featureDefinitionList[fdl]->xFeatureDefinition->MinorCategoryName();
            At5::tUShort majorVersion = 0;
            try
            {
                tAt5AtlasIoAccess dataAccess = featureDefinitionList[fdl]->xOriginalAtlas->GetAt5DataThreadSafe();
                majorVersion = dataAccess->GetMajorVersion();
            }
            catch(QString errMsg)
            {
                qDebug() << QString("Build library failed.  At5 could not be read. %1").arg(errMsg);
                qDebug() << (AT5_EXCEPTION_WHERE_INFO.toAscii().data());
                return;
            }
            At5::tFeatureDefinition::eInitialCategories initialCategorySetting = featureDefinitionList[fdl]->xFeatureDefinition->InitialCategorySettings();

            if(majorVersion > 13)
            {
                if(initialCategorySetting & At5::tFeatureDefinition::eIC_StandardMajCatOff)
                {
                    majorCategoriesDisabled.append(featureDefinitionList[fdl]->xFeatureDefinition->MajorCategoryName());
                }
                if(initialCategorySetting & At5::tFeatureDefinition::eIC_StandardMinCatOff)
                {
                    m_InitiallyDisabledCategoryNames[catName] |= featureDefinitionList[fdl]->xOriginalAtlas->GetMapFilter(); 
                }
            }
            // Tag translation takes priority over category translation
            QString displayName = xCategoryTranslator->TranslateTagName(featureDefinitionList[fdl]->groupTag, tAt5CategoryTranslator::Display);

            // Translator returns same name if no translation is found
            if (displayName == featureDefinitionList[fdl]->groupTag)
                displayName = xCategoryTranslator->TranslateCategoryName(catName, tAt5CategoryTranslator::Display);

            Insert(displayName, featureDefinitionList[fdl].get(), m_MajorCategoryList);
        }
    }
    // Loop the list again and if the major cat name is disabled, then disable all the minor cat names
    for ( unsigned int fdl = 0; fdl < featureDefinitionList.size(); ++ fdl )
    {
        if ( quit )
            return;
        
        // For some reason Jeppesen is naming their block array features.  We dont want these showing up in the category list,
        // so dont include block features here.
        if(featureDefinitionList[fdl]->xFeatureDefinition->FeatureType() != At5::eFT_BlockArray)
        {
            QString catName = featureDefinitionList[fdl]->xFeatureDefinition->MajorCategoryName() + "." + featureDefinitionList[fdl]->xFeatureDefinition->MinorCategoryName();
            if(majorCategoriesDisabled.contains(featureDefinitionList[fdl]->xFeatureDefinition->MajorCategoryName()))
            {
                m_InitiallyDisabledCategoryNames[catName] |= featureDefinitionList[fdl]->xOriginalAtlas->GetMapFilter(); 
            }
        }
    }
}
开发者ID:dulton,项目名称:53_hero,代码行数:69,代码来源:At5CategoryLibrary.cpp

示例10: QLabel

QTORGANIZER_USE_NAMESPACE

TodoEditPage::TodoEditPage(QWidget *parent)
    :QWidget(parent),
    m_manager(0),
    m_subjectEdit(0),
    m_startTimeEdit(0),
    m_dueTimeEdit(0),
    m_priorityEdit(0),
    m_statusEdit(0),
    m_alarmComboBox(0)
{
    // Create widgets
    QLabel *subjectLabel = new QLabel("Subject:", this);
    m_subjectEdit = new QLineEdit(this);
    QLabel *startTimeLabel = new QLabel("Start time:", this);
    m_startTimeEdit = new QDateTimeEdit(this);
    m_startTimeEdit->setDisplayFormat(QString("yyyy-MM-dd hh:mm:ss AP"));
    QLabel *dueTimeLabel = new QLabel("Due time:", this);
    m_dueTimeEdit = new QDateTimeEdit(this);
    m_dueTimeEdit->setDisplayFormat(QString("yyyy-MM-dd hh:mm:ss AP"));
    QLabel *priorityLabel = new QLabel("Priority:", this);
    m_priorityEdit = new QComboBox(this);
    QLabel *statusLabel = new QLabel("Status:", this);
    m_statusEdit = new QComboBox(this);
    QLabel *alarmLabel = new QLabel("Alarm:", this);
    m_alarmComboBox = new QComboBox(this);
    QLabel *calendarLabel = new QLabel("Calendar:", this);

    QStringList alarmList;
    alarmList  << "None"
                << "0 minutes before"
                << "5 minutes before"
                << "15 minutes before"
                << "30 minutes before"
                << "1 hour before";
    m_alarmComboBox->addItems(alarmList);
    connect(m_alarmComboBox, SIGNAL(currentIndexChanged(const QString)), this,
                        SLOT(handleAlarmIndexChanged(const QString)));

    m_calendarComboBox = new QComboBox(this);
    // the calendar names are not know here, fill the combo box later...

    // Add push buttons
    QHBoxLayout* hbLayout = new QHBoxLayout();
    QPushButton *okButton = new QPushButton("Save", this);
    connect(okButton,SIGNAL(clicked()),this,SLOT(saveClicked()));
    hbLayout->addWidget(okButton);
    QPushButton *cancelButton = new QPushButton("Cancel", this);
    connect(cancelButton,SIGNAL(clicked()),this,SLOT(cancelClicked()));
    hbLayout->addWidget(cancelButton);

    // check to see whether we support alarms.
    QOrganizerManager defaultManager;
    QList<QOrganizerItemDetail::DetailType> supportedDetails = defaultManager.supportedItemDetails(QOrganizerItemType::TypeTodo);

    QVBoxLayout *scrollAreaLayout = new QVBoxLayout();
    scrollAreaLayout->addWidget(subjectLabel);
    scrollAreaLayout->addWidget(m_subjectEdit);
    scrollAreaLayout->addWidget(startTimeLabel);
    scrollAreaLayout->addWidget(m_startTimeEdit);
    scrollAreaLayout->addWidget(dueTimeLabel);
    scrollAreaLayout->addWidget(m_dueTimeEdit);
    scrollAreaLayout->addWidget(priorityLabel);
    scrollAreaLayout->addWidget(m_priorityEdit);
    scrollAreaLayout->addWidget(statusLabel);
    scrollAreaLayout->addWidget(m_statusEdit);
    if (supportedDetails.contains(QOrganizerItemDetail::TypeVisualReminder)) {
        scrollAreaLayout->addWidget(alarmLabel);
        scrollAreaLayout->addWidget(m_alarmComboBox);
    }
    scrollAreaLayout->addWidget(calendarLabel);
    scrollAreaLayout->addWidget(m_calendarComboBox);
    scrollAreaLayout->addStretch();
    scrollAreaLayout->addLayout(hbLayout);

    QScrollArea *scrollArea = new QScrollArea(this);
    scrollArea->setWidgetResizable(true);
    QWidget *formContainer = new QWidget(scrollArea);
    formContainer->setLayout(scrollAreaLayout);
    scrollArea->setWidget(formContainer);

    QVBoxLayout *mainLayout = new QVBoxLayout();
    mainLayout->addWidget(scrollArea);
    setLayout(mainLayout);

    // Fill priority combo
    m_priorityEdit->addItem("Unknown", QVariant(QOrganizerItemPriority::UnknownPriority));
    m_priorityEdit->addItem("Highest", QVariant(QOrganizerItemPriority::HighestPriority));
    m_priorityEdit->addItem("Extremely high", QVariant(QOrganizerItemPriority::ExtremelyHighPriority));
    m_priorityEdit->addItem("Very high", QVariant(QOrganizerItemPriority::VeryHighPriority));
    m_priorityEdit->addItem("High", QVariant(QOrganizerItemPriority::HighPriority));
    m_priorityEdit->addItem("Medium", QVariant(QOrganizerItemPriority::MediumPriority));
    m_priorityEdit->addItem("Low", QVariant(QOrganizerItemPriority::LowPriority));
    m_priorityEdit->addItem("Very low", QVariant(QOrganizerItemPriority::VeryLowPriority));
    m_priorityEdit->addItem("Extremely low", QVariant(QOrganizerItemPriority::ExtremelyLowPriority));
    m_priorityEdit->addItem("Lowest", QVariant(QOrganizerItemPriority::LowestPriority));

    // Fill status combo
    m_statusEdit->addItem("Not started", QVariant(QOrganizerTodoProgress::StatusNotStarted));
//.........这里部分代码省略.........
开发者ID:Distrotech,项目名称:qtpim,代码行数:101,代码来源:todoeditpage.cpp

示例11: uploadingProcess

void Uploading::uploadingProcess(const QString &actionId)
{
	{
		QProgressDialog progressDialog;
		progressDialog.setWindowModality(Qt::WindowModal);
		progressDialog.setWindowTitle(tr("Выгрузка базы данных"));
		progressDialog.setLabelText(tr("Процесс выгрузки базы данных"));
		progressDialog.setCancelButton(0);
		progressDialog.setMinimumDuration(0);
		progressDialog.setMaximum(6);
		progressDialog.setValue(0);

		QSqlDatabase db = QSqlDatabase::database(UPLOADING);
		createDBScheme();

		progressDialog.setValue(1);
		QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);

		QSqlQuery selectDataQuery(QSqlDatabase::database(mConnection));
		QSqlQuery insertDataQuery(db);

		if(selectDataQuery.exec("SELECT id, title, performer FROM Actions WHERE id = " + actionId))
		{
			insertDataQuery.prepare("INSERT INTO Actions VALUES(:id, :title, :performer);");
			while(selectDataQuery.next())
			{
				insertDataQuery.bindValue(":id", selectDataQuery.value(0));
				insertDataQuery.bindValue(":title", selectDataQuery.value(1));
				insertDataQuery.bindValue(":performer", selectDataQuery.value(2));
				insertDataQuery.exec();
			}
		}

		progressDialog.setValue(2);

		QList<int> placeSchemeIds;
		QList<int> clientIds;

		if(selectDataQuery.exec("SELECT id, id_action, id_placeScheme, id_client, identifier FROM Tickets WHERE id_action = " + actionId))
		{
			insertDataQuery.prepare("INSERT INTO Tickets VALUES(NULL, :id_action, :id_placeScheme, :id_client, :identifier, :passedFlag);");
			while(selectDataQuery.next())
			{
				insertDataQuery.bindValue(":id_action", selectDataQuery.value(1));
				insertDataQuery.bindValue(":id_placeScheme", selectDataQuery.value(2));
				insertDataQuery.bindValue(":id_client", selectDataQuery.value(3));
				insertDataQuery.bindValue(":identifier", selectDataQuery.value(4));
				insertDataQuery.bindValue(":passedFlag", "false");
				insertDataQuery.exec();

				if(selectDataQuery.isNull(2) == false)
					placeSchemeIds.append(selectDataQuery.value(2).toInt());

				if(selectDataQuery.isNull(3) == false)
					clientIds.append(selectDataQuery.value(4).toInt());
			}
		}

		progressDialog.setValue(3);

		if(placeSchemeIds.isEmpty() == false)
		{
			if(selectDataQuery.exec("SELECT id, seatNumber, row FROM PlaceSchemes"))
			{
				insertDataQuery.prepare("INSERT INTO PlaceSchemes VALUES(:id, :seatNumber, :row)");
				while(selectDataQuery.next())
				{
					if(placeSchemeIds.contains( selectDataQuery.value(0).toInt()) )
					{
						insertDataQuery.bindValue(":id", selectDataQuery.value(0));
						insertDataQuery.bindValue(":seatNumber", selectDataQuery.value(1));
						insertDataQuery.bindValue(":row", selectDataQuery.value(2));
						insertDataQuery.exec();
					}
				}
			}
		}

		progressDialog.setValue(4);

		if(clientIds.isEmpty() == false)
		{
			if(selectDataQuery.exec("SELECT id, name, login FROM Clients"))
			{
				insertDataQuery.prepare("INSERT INTO Clients VALUES(:id, :name, :login)");
				while(selectDataQuery.next())
				{
					if(clientIds.contains( selectDataQuery.value(0).toInt() ))
					{
						insertDataQuery.bindValue(":id", selectDataQuery.value(0));
						insertDataQuery.bindValue(":name", selectDataQuery.value(1));
						insertDataQuery.bindValue(":login", selectDataQuery.value(2));
						insertDataQuery.exec();
					}
				}
			}
		}

		progressDialog.setValue(5);

//.........这里部分代码省略.........
开发者ID:Demonist,项目名称:TCS,代码行数:101,代码来源:uploading.cpp

示例12: fillTabsWithPass

void RmShaderDialog::fillTabsWithPass(int index)
{
	clearTabs();
	if (index < 0 || eff_selected == NULL || index >= eff_selected->size())
		return;

	pass_selected = &(eff_selected->at(index));

	// Set the source code of vertex shader
	ui.textVertex->setText(pass_selected->getVertex());

	// Set the source code of fragment shader
	ui.textFragment->setText(pass_selected->getFragment());

	// General Info in the first tab
	QString info;
	if (pass_selected->hasRenderTarget())
		info += "Render Target: " + pass_selected->getRenderTarget().name + "\n";

	for (int i = 0; i < 2; i++)
		for (int j = 0;
		     j < (i == 0 ? pass_selected->vertexUniformVariableSize() : pass_selected->fragmentUniformVariableSize());
		     j++) {
			UniformVar v = pass_selected->getUniform(j, i == 0 ? RmPass::VERTEX : RmPass::FRAGMENT);

			if(v.representerTagName == "RmRenderTarget") {
				if (i == 0)
					info += "Vertex";
				else
					info += "Fragment";

				info += " render Input: " + v.name;

				for (int k = 0; k < eff_selected -> size(); k++)
					if (eff_selected->at(k).getRenderTarget().name == v.textureName) {
						info += " (from pass: " + eff_selected->at(k).getName() + ")";
						break;
					}

				info += "\n";
			}
		}

	if (!info.isEmpty()) {
		QLabel *lblinfo = new QLabel(info);
		layoutUniform->addWidget(lblinfo, 0, 0, 1, 5);
		shown.append(lblinfo);
	}

	// any value change is sent to the state holder with this mapper
	// Signal are send from signaler in the form "varnameNM" where
	// NM is the index of row and column in case of matrix. (00 if
	// it is a simple variable).
	delete signaler;
	signaler = new QSignalMapper();
	connect(signaler, SIGNAL(mapped(const QString &)), this, SLOT(valuesChanged(const QString &)));


	// Uniform Variables in the first Tab
	QList<QString> usedVarables; // parser can give same variable twice in the vertex and fragment
	int row = 1;
	for (int ii = 0; ii < 2; ii++)
		for (int jj = 0;
		     jj < (ii == 0 ? pass_selected->vertexUniformVariableSize() : pass_selected->fragmentUniformVariableSize());
		     jj++) {
			UniformVar v = pass_selected->getUniform(jj, ii == 0 ? RmPass::VERTEX : RmPass::FRAGMENT);
			if (v.representerTagName == "RmRenderTarget" || usedVarables.contains(v.name))
				continue;
			usedVarables.append(v.name);

			QString varname = (ii == 0 ? "Vertex: " : "Fragment: ");
			varname += UniformVar::getStringFromUniformType(v.type) +
			           " " + v.name + (v.minSet || v.maxSet ? "\n" : "");

			switch (v.type) {
			case UniformVar::INT:
			case UniformVar::IVEC2:
			case UniformVar::IVEC3:
			case UniformVar::IVEC4: {
				int n = v.type == UniformVar::INT ? 1 : (v.type == UniformVar::IVEC2 ? 2 : (v.type == UniformVar::IVEC3 ? 3 : 4 ));
				for (int i = 0; i < n; i++) {
					QSpinBox *input = new QSpinBox();
					input->setObjectName(v.name + "0" + QString().setNum(i));
					if (v.minSet)
						input->setMinimum(v.fmin);
					else
						input -> setMinimum(-1000);

					if (v.maxSet)
						input->setMaximum(v.fmax);
					else
						input->setMaximum(1000);

					input->setSingleStep((v.minSet && v.maxSet )? std::max(( v.imax - v.imin )/10, 1) : 1 );
					input->setValue(v.ivec4[i]);
					layoutUniform->addWidget(input, row, 1 + i, 1,
					                         ((i + 1)==n ? 5-n : 1));
					shown.append(input);

					connect(input, SIGNAL(valueChanged(int)), signaler, SLOT(map()));
//.........这里部分代码省略.........
开发者ID:GuoXinxiao,项目名称:meshlab,代码行数:101,代码来源:rmshaderdialog.cpp

示例13: buildForest

void BFSForest::buildForest() {
	QList<RoadVertexDesc> seeds;
	QList<int> groups;

	QMap<RoadEdgeDesc, bool> visitedEdge;
	QMap<RoadVertexDesc, bool> visitedVertex;

	// ルートとして与えられた頂点について
	for (int i = 0; i < roots.size() / 2; i++) {
		RoadVertexDesc src = roots[i * 2];
		RoadVertexDesc tgt = roots[i * 2 + 1];

		// エッジの取得
		RoadEdgeDesc e_desc = GraphUtil::getEdge(roads, src, tgt);

		// エッジのグループ、seedフラグを設定
		roads->graph[e_desc]->group = i;
		roads->graph[e_desc]->seed = true;

		// 頂点srcが既存のシードと重複している場合
		if (seeds.contains(src)) {
			// 頂点srcをコピーする
			RoadVertex* v = new RoadVertex(roads->graph[src]->pt);
			RoadVertexDesc new_src = boost::add_vertex(roads->graph);
			roads->graph[new_src] = v;

			// 古いエッジを削除
			roads->graph[e_desc]->valid = false;

			// 新しいエッジを追加
			e_desc = GraphUtil::addEdge(roads, new_src, tgt, roads->graph[e_desc]);

			src = new_src;
		}

		// 頂点tgtが既存のシードと重複している場合
		if (seeds.contains(tgt)) {
			// 頂点tgtをコピーする
			RoadVertex* v = new RoadVertex(roads->graph[tgt]->pt);
			RoadVertexDesc new_tgt = boost::add_vertex(roads->graph);
			roads->graph[new_tgt] = v;

			// 古いエッジを削除
			roads->graph[e_desc]->valid = false;

			// 新しいエッジを追加
			e_desc = GraphUtil::addEdge(roads, src, new_tgt, roads->graph[e_desc]);

			tgt = new_tgt;
		}

		// src、tgtが更新されたかも知れないので、おおもとのデータも更新しておく
		roots[i * 2] = src;
		roots[i * 2 + 1] = tgt;

		// シードを登録する
		seeds.push_back(src);
		seeds.push_back(tgt);
		groups.push_back(i);
		groups.push_back(i);

		// ルートエッジ・頂点を訪問済みとマークする
		visitedEdge[e_desc] = true;
		visitedVertex[src] = true;
		visitedVertex[tgt] = true;
	}

	// ルート頂点リストからスタートして、BFSで全頂点を訪問する
	while (!seeds.empty()) {
		RoadVertexDesc parent = seeds.front();
		seeds.pop_front();

		int group = groups.front();
		groups.pop_front();

		std::vector<RoadVertexDesc> children;

		// 隣接ノードリストを先に洗い出す
		std::vector<RoadVertexDesc> nodes;
		std::vector<RoadEdgeDesc> edges;
		RoadOutEdgeIter ei, eend;
		for (boost::tie(ei, eend) = boost::out_edges(parent, roads->graph); ei != eend; ++ei) {
			if (!roads->graph[*ei]->valid) continue;
			if (visitedEdge[*ei]) continue;

			// 隣接ノードを取得
			RoadVertexDesc child = boost::target(*ei, roads->graph);
			if (!roads->graph[child]->valid) continue;

			if (getParent(parent).contains(child)) continue;

			nodes.push_back(child);
			edges.push_back(*ei);

			// 当該エッジを通過したとマークする
			visitedEdge[*ei] = true;
		}

		// 洗い出した隣接ノードに対して、訪問する
		for (int i = 0; i < nodes.size(); i++) {
//.........这里部分代码省略.........
开发者ID:gnishida,项目名称:Morph,代码行数:101,代码来源:BFSForest.cpp

示例14: on_addButton_clicked

void InsertLinkTableDialog::on_addButton_clicked()
{
    QList<QTableWidgetItem *> aItems=ui->sourceTableWidget->selectedItems();
    QList<int> rows;

    for (int i=0; i<aItems.length(); i++)
    {
        if (!rows.contains(aItems.at(i)->row()))
        {
            rows.append(aItems.at(i)->row());
        }
    }

    for (int e=0; e<rows.length()-1; e++)
    {
        int min=rows.at(e);
        int minIndex=e;

        for (int i=e+1; i<rows.length(); i++)
        {
            if (rows.at(i)<min)
            {
                min=rows.at(i);
                minIndex=i;
            }
        }

        rows.swap(e, minIndex);
    }

    for (int i=0; i<rows.length(); i++)
    {
        int aSourceRow=rows.at(i);
        int aDestRow=-1;

        if (ui->beginRadioButton->isChecked())
        {
            aDestRow=mBeginPos;
            mBeginPos++;
        }
        else
        if (ui->beforeRadioButton->isChecked())
        {
            aDestRow=mDestTable->ui->dataTableWidget->currentRow();
            mBeginPos=0;
        }
        else
        if (ui->afterRadioButton->isChecked())
        {
            aDestRow=mDestTable->ui->dataTableWidget->currentRow()+1;
            mBeginPos=0;
        }
        else
        if (ui->endRadioButton->isChecked())
        {
            aDestRow=mDestTable->ui->dataTableWidget->rowCount();
            mBeginPos=0;
        }

        if (ui->sourceTableWidget->itemDelegateForRow(aSourceRow))
        {
            mDestTable->insertMiddleRow(aDestRow);

            mDestTable->ui->dataTableWidget->item(aDestRow, 0)->setText(ui->sourceTableWidget->item(aSourceRow, 0)->text());
        }
        else
        {
            mDestTable->insertRow(aDestRow);

            for (int j=0; j<ui->sourceTableWidget->columnCount() && j<mDestTable->ui->dataTableWidget->columnCount(); j++)
            {
                EColumnType aDestColumnType=mDestTable->typeColumns.at(j).column->type();
                EColumnType aSourceColumnType=mSourceTable->typeColumns.at(j).column->type();

                if (aDestColumnType==ctInteger)
                {
                    if (!((IntegerColumn*)mDestTable->typeColumns.at(j).column)->mIsAutoInc)
                    {
                        if (aSourceColumnType==ctInteger)
                        {
                            QString aText=ui->sourceTableWidget->item(aSourceRow, j)->text();

                            int removeBefore=0;
                            int removeAfter=0;

                            if (!((IntegerColumn*)mSourceTable->typeColumns.at(j).column)->mSplitRows)
                            {
                                removeBefore=((IntegerColumn*)mSourceTable->typeColumns.at(j).column)->mPrefix.length();
                                removeAfter=((IntegerColumn*)mSourceTable->typeColumns.at(j).column)->mPostfix.length();
                            }

                            aText.remove(aText.length()-removeAfter, removeAfter);
                            aText.remove(0, removeBefore);

                            double aValue=aText.toDouble();

                            if (((IntegerColumn*)mDestTable->typeColumns.at(j).column)->mSplitRows)
                            {
                                mDestTable->ui->dataTableWidget->item(aDestRow, j)->setText(QString::number(aValue, 'f', ((IntegerColumn*)mDestTable->typeColumns.at(j).column)->mDecimals));
                            }
//.........这里部分代码省略.........
开发者ID:Gris87,项目名称:ProtocolCreator,代码行数:101,代码来源:insertlinktabledialog.cpp

示例15: appendUnique

void appendUnique(QList<T> &left, const QList<T> &right)
{
    foreach (const T &value, right)
        if (!left.contains(value))
            left += value;
}
开发者ID:AtlantisCD9,项目名称:Qt,代码行数:6,代码来源:qaudiodeviceinfo_symbian_p.cpp


注:本文中的QList::contains方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。