本文整理汇总了C++中QList::toStdList方法的典型用法代码示例。如果您正苦于以下问题:C++ QList::toStdList方法的具体用法?C++ QList::toStdList怎么用?C++ QList::toStdList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QList
的用法示例。
在下文中一共展示了QList::toStdList方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main ()
{
QList<QString> first;
list<QString> second;
first << "A" << "B" << "C" << "D" << "E" << "F";
second = first.toStdList();
assert(second.size() == 6);
return 0;
}
示例2: insertPasteSelection
bool FxSelection::insertPasteSelection() {
QClipboard *clipboard = QApplication::clipboard();
const FxsData *fxsData = dynamic_cast<const FxsData *>(clipboard->mimeData());
m_pastePosition = TConst::nowhere;
if (!fxsData || !fxsData->isConnected()) return false;
if (m_selectedLinks.isEmpty()) return true;
// Start an undo block and ensure it is appropriately destroyed
struct Auto {
bool m_destruct;
~Auto() {
if (m_destruct) TUndoManager::manager()->endBlock();
}
} auto_ = {false};
// Need to make a temporary copy of selected links. It's necessary since the
// selection will
// be updated (cleared) after each insertion.
QList<TFxCommand::Link> selectedLinks(m_selectedLinks);
int i, size = selectedLinks.size();
for (i = 0; i < size; ++i) {
// Clone the fxs to be inserted
QList<TFxP> fxs;
QMap<TFx *, int> zeraryFxColumnSize;
QList<TXshColumnP> columns;
fxsData->getFxs(fxs, zeraryFxColumnSize, columns);
if (fxs.empty() && columns.empty()) return true;
if (!auto_.m_destruct)
auto_.m_destruct = true, TUndoManager::manager()->beginBlock();
TFxCommand::insertPasteFxs(selectedLinks[i], fxs.toStdList(),
zeraryFxColumnSize.toStdMap(),
columns.toStdList(), m_xshHandle, m_fxHandle);
}
return true;
}
示例3: pasteSelection
void FxSelection::pasteSelection() {
/*--- Fxノードを1つだけ選択していた場合、Replace paste ---*/
if (m_selectedFxs.size() >= 1 && m_selectedLinks.size() == 0 &&
m_selectedColIndexes.isEmpty())
replacePasteSelection();
/*--- Linkを1つだけ選択していた場合、Insert paste ---*/
else if (m_selectedFxs.size() == 0 && m_selectedLinks.size() >= 1 &&
m_selectedColIndexes.isEmpty())
insertPasteSelection();
else {
QClipboard *clipboard = QApplication::clipboard();
const FxsData *fxsData =
dynamic_cast<const FxsData *>(clipboard->mimeData());
if (!fxsData) return;
QList<TFxP> fxs;
QMap<TFx *, int> zeraryFxColumnSize;
QList<TXshColumnP> columns;
fxsData->getFxs(fxs, zeraryFxColumnSize, columns);
if (fxs.isEmpty() && columns.isEmpty()) return;
// in case of the paste command triggered from short cut key
if (m_pastePosition == TConst::nowhere && m_schematicScene) {
SchematicSceneViewer *ssv =
dynamic_cast<SchematicSceneViewer *>(m_schematicScene->views().at(0));
if (ssv)
m_pastePosition =
TPointD(ssv->getOldScenePos().x(), ssv->getOldScenePos().y());
}
TFxCommand::pasteFxs(fxs.toStdList(), zeraryFxColumnSize.toStdMap(),
columns.toStdList(), m_pastePosition, m_xshHandle,
m_fxHandle);
if (m_schematicScene) {
selectNone();
for (int i = 0; i < (int)fxs.size(); i++) select(fxs[i]);
m_schematicScene->selectNodes(fxs);
}
}
m_pastePosition = TConst::nowhere;
}
示例4: replacePasteSelection
bool FxSelection::replacePasteSelection() {
QClipboard *clipboard = QApplication::clipboard();
const FxsData *fxsData = dynamic_cast<const FxsData *>(clipboard->mimeData());
m_pastePosition = TConst::nowhere;
if (!fxsData || !fxsData->isConnected()) return false;
if (m_selectedFxs.isEmpty()) return true;
struct Auto {
bool m_destruct;
~Auto() {
if (m_destruct) TUndoManager::manager()->endBlock();
}
} auto_ = {false};
QList<TFxP> selectedFxs(m_selectedFxs);
int i, size = selectedFxs.size();
for (i = 0; i < size; ++i) {
// Clone the fxs to be inserted
QList<TFxP> fxs;
QMap<TFx *, int> zeraryFxColumnSize;
QList<TXshColumnP> columns;
fxsData->getFxs(fxs, zeraryFxColumnSize, columns);
if (fxs.empty() && columns.empty()) return true;
if (!auto_.m_destruct)
auto_.m_destruct = true, TUndoManager::manager()->beginBlock();
TFx *inFx = m_selectedFxs[i].getPointer();
TFxCommand::replacePasteFxs(inFx, fxs.toStdList(),
zeraryFxColumnSize.toStdMap(),
columns.toStdList(), m_xshHandle, m_fxHandle);
}
return true;
}
示例5: toStdList
void tst_QList::toStdList() const
{
QList<QString> list;
list << "foo" << "bar" << "baz";
// yuck.
std::list<QString> slist;
slist.push_back(QLatin1String("foo"));
slist.push_back(QLatin1String("bar"));
slist.push_back(QLatin1String("baz"));
QCOMPARE(list.toStdList(), slist);
QCOMPARE(list, QList<QString>() << "foo" << "bar" << "baz");
}
示例6: parsePluginsRequest
QString PluginManagerImpl::parsePluginsRequest(const QString &templ, QList<PluginRequest> &plugins, QStringList & names)
{
if (templ.trimmed().isEmpty()) {
return "Plugins template is empty";
}
bool inBr = false;
PluginRequest cur;
QString argument;
cur.start = false;
for (int i=0 ; i<templ.size(); i++) {
if (templ[i]=='!' && cur.name.isEmpty() && !inBr) {
cur.start = true;
}
else if (templ[i]=='(' && !inBr) {
inBr = true;
}
else if (templ[i]==')' && inBr) {
inBr = false;
cur.arguments << argument;
argument = "";
}
else if (templ[i]==',' && inBr) {
cur.arguments << argument;
argument = "";
}
else if (templ[i]==',' && !inBr) {
plugins << cur;
cur.start = false;
cur.arguments.clear();
cur.name = "";
}
else if (inBr) {
argument += templ[i];
}
else {
cur.name += templ[i];
}
}
plugins << cur;
int starts = 0;
// Qt bug !!! Use STL instead and then convert back to QList
std::list<PluginRequest> stdPlugins = plugins.toStdList();
std::list<PluginRequest>::iterator it=stdPlugins.begin();
while (it!=stdPlugins.end()) {
PluginRequest p = (*it);
if (p.name.contains("*") || p.name.contains("?")) {
if (p.start) {
return "Entry point defined for masked by * name in plugins template";
}
QDir dir(path);
QStringList entries = dir.entryList(QStringList() << p.name+".pluginspec", QDir::Files);
it = stdPlugins.erase(it);
foreach (const QString & e, entries) {
PluginRequest pp;
pp.name = e.left(e.size()-11);
pp.arguments = p.arguments;
pp.start = false;
stdPlugins.insert(it, pp);
}
}
else {
++it;
示例7: deleteElements
void TemplatesDBManager::deleteElements(const QList<int>& deletedIds) {
deleteBy("id",
"Templates",
deletedIds.toStdList()
);
}
示例8: keysAsVector
vector<KeyPair> keysAsVector(QList<KeyPair> const& keys)
{
auto list = keys.toStdList();
return {begin(list), end(list)};
}
示例9: setNumberSegmentPropety
//根据用户的设置,重新调整分段即相应信息
bool NumberSegmentIdentification::setNumberSegmentPropety(qulonglong startNumber,
qulonglong endNumber,
IdentificationState command)
{
qDebug()<<"setNumberSegmentPropety";
if( startNumber>=endNumber || startNumber<MinPhoneNumber || endNumber>=MaxPhoneNumber)
{
qDebug()<<" setNumberSegmentPropety NumberSegment format wrong。";
return false;
}
// QString startNumber = QString::number(startNumber);
// QString endNumberString = QString::number(endNumber);
//![0]节点排序
QList<qulonglong> allStartNumber = records.keys();
if(!allStartNumber.contains(startNumber)) //某一号段新的起点或结点
allStartNumber.append(startNumber);
if(!allStartNumber.contains(endNumber+1)) //某一号段新的起点或结点
allStartNumber.append(endNumber+1);
if(!allStartNumber.contains(MaxPhoneNumber)) //增加边界
allStartNumber.append(MaxPhoneNumber);
std::list<qulonglong> allStartNumber_stl = allStartNumber.toStdList();
allStartNumber_stl.sort(); //排序
allStartNumber = QList<qulonglong>::fromStdList(allStartNumber_stl);
//两个节点点所在的位置(已经排好序)
int startNumberIndex = allStartNumber.indexOf(startNumber);
int endNumberIndex = allStartNumber.indexOf(endNumber+1);
//![1]首先确定用户设置的号段(startNumber与endNumber之间)
if(!records.contains(startNumber))
{
//新的中间段,startNumber与endNumber为号段
struct NumberSegmentInformation numberSegmentInformation;
numberSegmentInformation.startNumber = startNumber;
numberSegmentInformation.endNumber = endNumber;
numberSegmentInformation.count = 0;
numberSegmentInformation.state = command;
//插入到记录表中
records.insert(startNumber,numberSegmentInformation);
}
else
{
records[startNumber].state = command;
records[startNumber].endNumber = endNumber;
}
//重新统计该号段的号码个数
records[startNumber].Numbers.clear();
qDebug()<<"startNumber,endNumber:" +QString::number(startNumber) +" ~ " +QString::number(endNumber);
for(int i =0;i <allNotingNumbers.count();i++)
{
if(allNotingNumbers.at(i) >=records[startNumber].startNumber &&
allNotingNumbers.at(i)<=records[startNumber].endNumber)
{
records[startNumber].Numbers.append(allNotingNumbers.at(i));
qDebug()<<"startNumber~endNumber,add:" +QString::number(allNotingNumbers.at(i));
}
}
records[startNumber].count = records[startNumber].Numbers.count();
qDebug()<<"after startNumber,endNumber:";
showresult();
//![2]确定endNumber+1与后面的号段合并,以endNumber+1为起点,以下一个号段的结点为结点
if(!records.contains(endNumber+1))
{
struct NumberSegmentInformation numberSegmentInformationEnd;
numberSegmentInformationEnd.startNumber = endNumber+1;
numberSegmentInformationEnd.endNumber = allStartNumber[endNumberIndex+1]-1; //下一个结点的起始位置-1
numberSegmentInformationEnd.count = 0;
if(records.contains(allStartNumber[endNumberIndex+1]))
{
numberSegmentInformationEnd.state =records[allStartNumber[endNumberIndex+1]].state;
//清除重复的记录
records.remove(allStartNumber[endNumberIndex+1]);
}
else
numberSegmentInformationEnd.state = Noting;
records.insert(numberSegmentInformationEnd.startNumber,numberSegmentInformationEnd);
//重新统计该号段的号码个数
records[endNumber+1].Numbers.clear();
qDebug()<<"endNumber+1~next:" +
QString::number(records[endNumber+1].startNumber) +" ~ " +
QString::number(records[endNumber+1].endNumber);
for(int i =0;i <allNotingNumbers.count();i++)
{
if(allNotingNumbers.at(i) >=records[endNumber+1].startNumber &&
allNotingNumbers.at(i)<=records[endNumber+1].endNumber)
{
records[endNumber+1].Numbers.append(allNotingNumbers.at(i));
qDebug()<<"endNumber+1~next,add:" +QString::number(allNotingNumbers.at(i));
}
}
records[endNumber+1].count = records[endNumber+1].Numbers.count();
}
//.........这里部分代码省略.........