本文整理汇总了C++中QStringList::push_front方法的典型用法代码示例。如果您正苦于以下问题:C++ QStringList::push_front方法的具体用法?C++ QStringList::push_front怎么用?C++ QStringList::push_front使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QStringList
的用法示例。
在下文中一共展示了QStringList::push_front方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: recent
void djvFileInfoUtil::recent(
const QString & fileName,
QStringList & list,
int max)
{
const int index = list.indexOf(fileName);
if (-1 == index)
{
// Insert new item at front of list.
list.push_front(fileName);
while (list.count() > max)
{
list.pop_back();
}
}
else
{
// Move existing item to front of list.
list.removeAt(list.indexOf(fileName));
list.push_front(fileName);
}
}
示例2: launchUpdate
void CAbstractUpdateController::launchUpdate()
{
QString proc;
QStringList args;
QString DLType;
updateShellCommand(proc, args);
//if jail is present
if (mJailPrefix.length())
{
args.push_front(proc);
args.push_front(mJailPrefix);
proc = "chroot";
}
mUpdProc.start(proc,args);
if (!mUpdProc.waitForStarted())
{
reportError(tr("Can not execute update shell command"));
return;
}
DLType = dlType();
if (DLType.length())
mUpdProc.setDLType(DLType);
if (currentState() != eUPDATING)
setCurrentState(eUPDATING);
}
示例3: expr
void
CompleterLineEdit::filterText(const QString & txt)
{
QStringList sl;
if ( txt.isEmpty() ) {
for (PluginsNamesMap::iterator it = _imp->names.begin(); it != _imp->names.end(); ++it) {
sl.push_front(it->second.second);
}
} else {
QString pattern;
for (int i = 0; i < txt.size(); ++i) {
pattern.push_back( QLatin1Char('*') );
pattern.push_back(txt[i]);
}
pattern.push_back( QLatin1Char('*') );
QRegExp expr(pattern, Qt::CaseInsensitive, QRegExp::WildcardUnix);
#ifdef NODE_TAB_DIALOG_USE_MATCHED_LENGTH
std::map<int, QStringList> matchOrdered;
for (PluginsNamesMap::iterator it = _imp->names.begin(); it != _imp->names.end(); ++it) {
if ( expr.exactMatch(it->second.first) ) {
QStringList& matchedForLength = matchOrdered[expr.matchedLength()];
matchedForLength.push_front(it->second.second);
}
}
for (std::map<int, QStringList>::iterator it = matchOrdered.begin(); it != matchOrdered.end(); ++it) {
sl.append(it->second);
}
#else
for (PluginsNamesMap::iterator it = _imp->names.begin(); it != _imp->names.end(); ++it) {
if ( it->second.first.contains(expr) ) {
sl.push_front(it->second.second);
}
}
#endif
}
_imp->model->setStringList(sl);
_imp->listView->setModel(_imp->model);
int rowCount = _imp->model->rowCount();
if (rowCount == 0) {
return;
}
QPoint p = mapToGlobal( QPoint( 0, height() ) );
//QDesktopWidget* desktop = QApplication::desktop();
//QRect screen = desktop->screenGeometry();
//double maxHeight = ( screen.height() - p.y() ) * 0.8;
//QFontMetrics fm = _imp->listView->fontMetrics();
//maxHeight = std::min( maxHeight, ( rowCount * fm.height() * 1.2 + fm.height() ) );
// Position the text edit
// _imp->listView->setFixedSize(width(),maxHeight);
_imp->listView->move(p);
_imp->listView->show();
} // CompleterLineEdit::filterText
示例4: getRouteByString
QStringList MythGenericTree::getRouteByString()
{
QStringList routeByString;
routeByString.push_front(getString());
MythGenericTree *parent = this;
while( (parent = parent->getParent()) )
{
routeByString.push_front(parent->getString());
}
return routeByString;
}
示例5: expr
void
CompleterLineEdit::filterText(const QString & txt)
{
QStringList sl;
if ( txt.isEmpty() ) {
for (PluginsNamesMap::iterator it = _imp->names.begin(); it != _imp->names.end(); ++it) {
sl.push_front(it->second.comboLabel);
}
} else {
QString pattern;
for (int i = 0; i < txt.size(); ++i) {
pattern.push_back( QLatin1Char('*') );
pattern.push_back(txt[i]);
}
pattern.push_back( QLatin1Char('*') );
QRegExp expr(pattern, Qt::CaseInsensitive, QRegExp::WildcardUnix);
#ifdef NODE_TAB_DIALOG_USE_MATCHED_LENGTH
std::map<int, QStringList> matchOrdered;
for (PluginsNamesMap::iterator it = _imp->names.begin(); it != _imp->names.end(); ++it) {
if ( expr.exactMatch(it->second.lineEditLabel) ) {
QStringList& matchedForLength = matchOrdered[expr.matchedLength()];
matchedForLength.push_front(it->second.comboLabel);
}
}
for (std::map<int, QStringList>::iterator it = matchOrdered.begin(); it != matchOrdered.end(); ++it) {
sl.append(it->second);
}
#else
for (PluginsNamesMap::iterator it = _imp->names.begin(); it != _imp->names.end(); ++it) {
if ( it->second.lineEditLabel.contains(expr) ) {
sl.push_front(it->second.comboLabel);
}
}
#endif
}
_imp->model->setStringList(sl);
_imp->listView->setModel(_imp->model);
int rowCount = _imp->model->rowCount();
if (rowCount == 0) {
return;
}
QPoint p = mapToGlobal( QPoint( 0, height() ) );
_imp->listView->move(p);
_imp->listView->show();
} // CompleterLineEdit::filterText
示例6: nameSpecSearch
bool nameSpecSearch(QString phrase)
{
QFile dataFile(fileName);
bool isAvailable = false;
if((!dataFile.open(QFile::ReadOnly))){
throw "Could not open file " + fileName;
}
QTextStream in(&dataFile);
QStringList withinName;
while(!in.atEnd()){
QString line = in.readLine(); //read one line at a time
if(line.contains(phrase) >= 0){
isAvailable = true;
QStringList temp = line.split('|');
QStringList temp2;
for(int i = temp.size()-1; i>=0;i--){
temp2.push_back(temp[i]);
}
line = temp2.join("|");
withinName.push_front(line);
isAvailable = true;
}
}
withinName.sort();
if(isAvailable){
qDebug() << "Name" << "\t\t" << "Birthday";
qDebug() << "====" << "\t\t" << "========";
}
for (QStringList::iterator it = withinName.begin();it != withinName.end(); ++it){
QString current = *it;
QStringList lineItems = current.split('|');
qDebug() << lineItems[0] << "\t" << lineItems[1];
}
return isAvailable;
}
示例7: guessTags
void TagGuesser::guessTags(MPDSong &song) {
QString pattern = Config::instance()->guessPattern();
// Check that we have a pattern at all
if (pattern.isEmpty())
return;
// Cant guess from URL's
if (song.url().contains("://"))
return;
// Return if we already have everything we can guess
if (!(song.title().isEmpty() || song.album().isEmpty() || song.artist().isEmpty() || song.track().isEmpty()))
return;
DEBUG4("Guessing..");
// Tokens to expand. %a=album, %b=band, %n=tracknr, %t=title, %i=ignore
QStringList matchers = pattern.split(QRegExp("%[abnti]"), QString::SkipEmptyParts);
QStringList markers = pattern.split('%', QString::SkipEmptyParts);
// Check that we actually have any matchers, if not, return filename as title, the rest empty.
DEBUG4("Matchers size: %d %d", matchers.size(), markers.size());
if (matchers.isEmpty() || markers.isEmpty()) {
DEBUG4("No matchers or no markers");
if (song.title().isEmpty())
song.setTitle(song.url());
return;
}
// Remove bogus markers
DEBUG4("Removing bogus markers");
markers = markers.filter(QRegExp("^[abnti]"));
// Remove trailing garbage on markers
DEBUG4("Removing trailing garbage on markers");
markers = markers.replaceInStrings(QRegExp("^([abnti]).*"), "%\\1");
DEBUG4("Adding greedy front matcher");
// If pattern does not have leading characters, add a greedy matcher at front so we get the whole start
if (pattern.contains(QRegExp("^%[abnti]")))
matchers.push_front("^");
// If pattern contains trailing characters, add a dummy marker at the end.
DEBUG4("Finding last matcher");
QString lastMarker = markers.last();
DEBUG4("Finding end of last marker");
int endOfLastMatcher = pattern.lastIndexOf(lastMarker) + lastMarker.size();
DEBUG4("Adding dummy end marker");
if (endOfLastMatcher < pattern.size())
markers += "trailingcharacters";
foreach (QString p, markers) {
DEBUG4("marker : %s", qPrintable(p));
}
示例8: getWidget
QStringList Vizkit3DConfig::getVisualizationFrames() const
{
QStringList frames = getWidget()->getVisualizationFrames();
if (!frames.isEmpty())
frames.push_front(getWidget()->getVisualizationFrame());
return frames;
}
示例9: reloadSmiles
void GeneralForm::reloadSmiles()
{
QList<QStringList> emoticons = SmileyPack::getInstance().getEmoticons();
if (emoticons.isEmpty())
{ // sometimes there are no emoticons available, don't crash in this case
qDebug() << "reloadSmilies: No emoticons found";
return;
}
QStringList smiles;
for (int i = 0; i < emoticons.size(); i++)
smiles.push_front(emoticons.at(i).first());
const QSize size(18,18);
bodyUI->smile1->setPixmap(SmileyPack::getInstance().getAsIcon(smiles[0]).pixmap(size));
bodyUI->smile2->setPixmap(SmileyPack::getInstance().getAsIcon(smiles[1]).pixmap(size));
bodyUI->smile3->setPixmap(SmileyPack::getInstance().getAsIcon(smiles[2]).pixmap(size));
bodyUI->smile4->setPixmap(SmileyPack::getInstance().getAsIcon(smiles[3]).pixmap(size));
bodyUI->smile5->setPixmap(SmileyPack::getInstance().getAsIcon(smiles[4]).pixmap(size));
bodyUI->smile1->setToolTip(smiles[0]);
bodyUI->smile2->setToolTip(smiles[1]);
bodyUI->smile3->setToolTip(smiles[2]);
bodyUI->smile4->setToolTip(smiles[3]);
bodyUI->smile5->setToolTip(smiles[4]);
//set maximum size of emoji
QDesktopWidget desktop;
int maxSize = qMin(desktop.geometry().height()/8,
desktop.geometry().width()/8); // 8 is the count of row and column in emoji's in widget
bodyUI->emoticonSize->setMaximum(SmileyPack::getInstance().getAsIcon(smiles[0]).actualSize(QSize(maxSize,maxSize)).width());
}
示例10: reloadSmiles
void GeneralForm::reloadSmiles()
{
QList<QStringList> emoticons = SmileyPack::getInstance().getEmoticons();
if (emoticons.isEmpty())
{ // sometimes there are no emoticons available, don't crash in this case
qDebug() << "reloadSmilies: No emoticons found";
return;
}
QStringList smiles;
for (int i = 0; i < emoticons.size(); i++)
smiles.push_front(emoticons.at(i).first());
const QSize size(18,18);
bodyUI->smile1->setPixmap(SmileyPack::getInstance().getAsIcon(smiles[0]).pixmap(size));
bodyUI->smile2->setPixmap(SmileyPack::getInstance().getAsIcon(smiles[1]).pixmap(size));
bodyUI->smile3->setPixmap(SmileyPack::getInstance().getAsIcon(smiles[2]).pixmap(size));
bodyUI->smile4->setPixmap(SmileyPack::getInstance().getAsIcon(smiles[3]).pixmap(size));
bodyUI->smile5->setPixmap(SmileyPack::getInstance().getAsIcon(smiles[4]).pixmap(size));
bodyUI->smile1->setToolTip(smiles[0]);
bodyUI->smile2->setToolTip(smiles[1]);
bodyUI->smile3->setToolTip(smiles[2]);
bodyUI->smile4->setToolTip(smiles[3]);
bodyUI->smile5->setToolTip(smiles[4]);
}
示例11: onCopyPathDocument
void Notifier::onCopyPathDocument()
{
QModelIndex const& selectedInd = _observer->selectedIndex();
if (!selectedInd.isValid())
return;
BsonTreeItem const *documentItem = QtUtils::item<BsonTreeItem*>(selectedInd);
if (!documentItem)
return;
if (!(detail::isSimpleType(documentItem) || detail::isDocumentType(documentItem) ||
!detail::isDocumentRoot(documentItem)))
return;
QStringList namesList;
BsonTreeItem const *documentItemHelper = documentItem;
while (!detail::isDocumentRoot(documentItemHelper)) {
if (!detail::isArrayChild(documentItemHelper)) {
namesList.push_front(QString::fromStdString(documentItemHelper->fieldName()));
}
documentItemHelper = dynamic_cast<BsonTreeItem*>(documentItemHelper->parent());
}
QClipboard *clipboard = QApplication::clipboard();
clipboard->setText(namesList.join("."));
}
示例12: reloadSmileys
/**
* @brief Reload smileys and size information.
*/
void UserInterfaceForm::reloadSmileys()
{
QList<QStringList> emoticons = SmileyPack::getInstance().getEmoticons();
// sometimes there are no emoticons available, don't crash in this case
if (emoticons.isEmpty()) {
qDebug() << "reloadSmilies: No emoticons found";
return;
}
QStringList smileys;
for (int i = 0; i < emoticons.size(); ++i)
smileys.push_front(emoticons.at(i).first());
const QSize size(18, 18);
for (int i = 0; i < smileLabels.size(); ++i) {
QIcon icon = SmileyPack::getInstance().getAsIcon(smileys[i]);
smileLabels[i]->setPixmap(icon.pixmap(size));
smileLabels[i]->setToolTip(smileys[i]);
}
// set maximum size of emoji
QDesktopWidget desktop;
// 8 is the count of row and column in emoji's in widget
const int sideSize = 8;
int maxSide = qMin(desktop.geometry().height() / sideSize, desktop.geometry().width() / sideSize);
QSize maxSize(maxSide, maxSide);
QIcon icon = SmileyPack::getInstance().getAsIcon(smileys[0]);
QSize actualSize = icon.actualSize(maxSize);
bodyUI->emoticonSize->setMaximum(actualSize.width());
}
示例13: callMember
bool KJavaAppletServer::callMember(QStringList & args, QStringList & ret_args) {
JSStackFrame frame( d->jsstack, ret_args );
args.push_front( QString::number(frame.ticket) );
process->send( KJAS_CALL_MEMBER, args );
waitForReturnData( &frame );
return frame.ready;
}
示例14: list
QStringList fs::list(const QString &path){
QDirIterator dirIt(path,QDirIterator::Subdirectories);
QStringList list;
while (dirIt.hasNext()) {
dirIt.next();
list.push_front(dirIt.filePath());
}
return list;
}
示例15:
QString OSConfigurator_linux24::printUpdateAddressCommand(
Interface *intf, QStringList &update_addresses, QStringList &ignore_addresses)
{
QStringList out;
update_addresses.push_front(intf->getName().c_str());
out.push_back("update_addresses_of_interface");
out.push_back("\"" + update_addresses.join(" ") + "\"");
out.push_back("\"" + ignore_addresses.join(" ") + "\"");
return out.join(" ");
}