本文整理汇总了C++中QQueue::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ QQueue::push_back方法的具体用法?C++ QQueue::push_back怎么用?C++ QQueue::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QQueue
的用法示例。
在下文中一共展示了QQueue::push_back方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LevelOrder
void AVLTree::LevelOrder()
{
QSequentialAnimationGroup *group = new QSequentialAnimationGroup;
QQueue<TreeNode*> q;
q.push_back(root);
while (!q.empty())
{
TreeNode *node = q.front();
q.pop_front();
if (node == NULL) continue;
group->addAnimation(node->getPopAnim());
q.push_back(node->Lson);
q.push_back(node->Rson);
}
group->start(QAbstractAnimation::DeleteWhenStopped);
}
示例2: getFramebuffer
gpu::FramebufferPointer FramebufferCache::getFramebuffer() {
if (_cachedFramebuffers.isEmpty()) {
_cachedFramebuffers.push_back(gpu::FramebufferPointer(gpu::Framebuffer::create(gpu::Element::COLOR_RGBA_32, _frameBufferSize.width(), _frameBufferSize.height())));
}
gpu::FramebufferPointer result = _cachedFramebuffers.front();
_cachedFramebuffers.pop_front();
return result;
}
示例3: tryConnectListList
QQueue<QString> Data::getListList()
{
tryConnectListList();
QQueue <QString> q;
QSqlQuery query;
query.exec("select * from listlist order by id;");
while (query.next())
{
q.push_back(query.value(0).toString());
qDebug() << "Get list" << query.value(1).toInt() << ":" << query.value(0).toString()<< endl;
}
if (q.size() == 0)
{
query.exec("insert into listlist"
"(name, id, count) values('默认列表', 0, 0);");
Data::changeListCount(1);
q.push_back(QString("默认列表"));
qDebug() << "Create list:默认列表" << endl;
}
return q;
}
示例4: addChildren
void DockWidget::addChildren(QObject *object)
{
if (!object->isWidgetType())
{
return;
}
QQueue<QObject*> install;
install.push_back(object);
while (!install.empty())
{
object = install.front();
install.pop_front();
object->installEventFilter(this);
for (auto &i : object->children())
{
if (i->isWidgetType())
{
install.push_back(i);
}
}
}
}
示例5: addMusics
void MusicWindow::addMusics()
{
QQueue<MusicInfo> musics;
MusicInfo musicInfo;
QStringList fileDir = QFileDialog::getOpenFileNames(
this,
tr("添加"),
".",
tr("MP3 音频文件(*.mp1 *.mp2 *.mp3);; WMA 音频文件(*.wma)"));
if (fileDir.isEmpty())
return;
QStringList::iterator it;
musicPage->addMusics(fileDir);
for (it = fileDir.begin(); it != fileDir.end(); ++it)
{
musicInfo.setDir(*it);
musicInfo.setName(QFileInfo(*it).baseName());
musicInfo.setArtist("");
musics.push_back(musicInfo);
}
player->addMusics(musicPage->getCurrentList(), musics);
Data::addMusicsToEnd(musicPage->getCurrentList(), musics);
}
示例6: tryConnectMusicList
QQueue<MusicInfo> Data::getMusicList(QString listName)
{
tryConnectMusicList();
listName = listName.replace("'", "''");
QQueue <MusicInfo> q;
MusicInfo musicInfo;
QSqlQuery query;
query.exec("select * from musiclist where listname = '"+listName+"' order by id;");
while (query.next())
{
musicInfo.setDir(query.value(2).toString());
musicInfo.setName(query.value(3).toString());
musicInfo.setArtist(query.value(4).toString());
q.push_back(musicInfo);
qDebug() << "Get music:" << query.value(3).toString() << endl;
}
int all = q.size();
query.exec("select * from listlist;");
QString str =
QString("update listlist set count = %1 "
"where name = '%2';").arg(all).arg(listName);
query.exec(str);
return q;
}
示例7: releaseFramebuffer
void FramebufferCache::releaseFramebuffer(const gpu::FramebufferPointer& framebuffer) {
if (QSize(framebuffer->getSize().x, framebuffer->getSize().y) == _frameBufferSize) {
_cachedFramebuffers.push_back(framebuffer);
}
}
示例8: isMovable
bool ChessModel::isMovable(char player, QPair<int, int> st, QPair<int, int> ed) const
{
if (player == 'A') {
st.first = 14 - st.first;
st.second = 6 - st.second;
ed.first = 14 - ed.first;
ed.second = 6 - ed.second;
}
if (st.first < 1 || st.first > 13 || st.second < 1 || st.second > 5 ||
ed.first < 1 || ed.first > 13 || ed.second < 1 || ed.second > 5) return 0;
if (getChessId(player, ed) != -1) return 0;
if (getChessId(player, st) == -1) return 0;
if (isHouse(ed) && (getChessId('A' + 'B' - player, ed) != -1)) return 0;
int pt = pieceType[getChessId(player, st)];
if (pt == 10 || pt == 12) return 0;
if (ed.first == 7 && (ed.second == 2 || ed.second == 4)) return 0;
if ((st.first == 1 || st.first == 13) && (st.second == 2 || st.second == 4)) return 0;
int dis = abs(st.first - ed.first) + abs(st.second - ed.second);
if (dis == 1) return 1;
if (dis == 2 && (isHouse(st) || isHouse(ed))) return 1;
if (isRail(st) && isRail(ed)) {
if (st.first == ed.first) {
bool flag = 1;
for (int i = qMin(st.second, ed.second) + 1; i <= qMax(st.second, ed.second) - 1; i++)
if (getChessId('A', qMakePair(st.first, i)) != -1 || getChessId('B', qMakePair(st.first, i)) != -1)
flag = 0;
if (flag) return 1;
}
if (st.second == ed.second) {
bool flag = 1;
for (int i = qMin(st.first, ed.first) + 1; i <= qMax(st.first, ed.first) - 1; i++)
if (getChessId('A', qMakePair(i, st.second)) != -1 || getChessId('B', qMakePair(i, st.second)) != -1)
flag = 0;
if (flag) return 1;
}
if (pt != 9) return 0;
QQueue< QPair<int, int> > queue;
QSet< QPair<int, int> > set;
queue.push_back(st);
while (!queue.empty()) {
QPair<int, int> now = queue.front();
queue.pop_front();
for (int i = 0; i < 4; i++) {
QPair<int, int> tmp = now;
tmp.first += dx[i];
tmp.second += dy[i];
if (isRail(tmp) && getChessId('A', tmp) == -1 && getChessId('B', tmp) == -1 && set.find(tmp) == set.end()) {
queue.push_back(tmp);
set.insert(tmp);
}
}
}
for (auto itm : set) {
if (qAbs(itm.first - ed.first) + qAbs(itm.second - ed.second) <= 1)
return 1;
}
}
return 0;
}