本文整理汇总了C++中QList::take方法的典型用法代码示例。如果您正苦于以下问题:C++ QList::take方法的具体用法?C++ QList::take怎么用?C++ QList::take使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QList
的用法示例。
在下文中一共展示了QList::take方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: int
QLayoutItem *BorderLayoutIterator::takeCurrent()
{
BorderLayout::BorderLayoutStruct *b
= idx < int( list->count() ) ? list->take( idx ) : 0;
QLayoutItem *item = b ? b->item : 0;
delete b;
return item;
}
示例2: tile_maximize
void qapp::tile_maximize(xwindow *client)
{
int i;
if(tmaxclient != NULL && (i = clients.find(tmaxclient)) != -1)
clients.insert(clients.find(client), clients.take(i));
tile_order(client);
}
示例3: readFileToList
bool Doc::readFileToList(QString &fileName, QList<QString> &list)
{
QFile file(fileName);
QString s = QString::null;
QString t = QString::null;
QString buf = QString::null;
int i = 0;
if (fileName == QString::null)
{
return false;
}
while (list.isEmpty() == false)
{
list.first();
delete list.take();
}
if (file.open(IO_ReadOnly))
{
list.append(new QString("Entry"));
list.append(new QString("Dummy"));
// First read all entries to a string list
while (file.atEnd() == false)
{
file.readLine(buf, 1024);
// If there is no "equal" sign on this row or it begins
// with a hash, ignore it
i = buf.find(QString("="));
if (i > -1 && buf.left(1) != QString("#"))
{
/* Get the string up to equal sign */
s = buf.mid(0, i).stripWhiteSpace();
list.append(new QString(s));
/* Get the string after the equal sign */
t = buf.mid(i + 1).stripWhiteSpace();
list.append(new QString(t));
}
}
file.close();
return true;
}
else
{
return false;
}
}
示例4: readDeviceClasses
bool Doc::readDeviceClasses()
{
DeviceClass* dc = NULL;
QString path = QString::null;
QString dir;
_app->settings()->get(KEY_SYSTEM_DIR, dir);
dir += QString("/") + DEVICECLASSPATH + QString("/");
QDir d(dir);
d.setFilter(QDir::Files);
d.setNameFilter("*.deviceclass");
if (d.exists() == false || d.isReadable() == false)
{
QMessageBox::warning(_app, "QLC", "Unable to open or read from device directory! Check settings and permissions.");
return false;
}
QStringList dirlist(d.entryList());
QStringList::Iterator it;
QList <QString> list; // Our stringlist that contains the files' contents
// Put a slash to the end of the directory name if it isn't there
if (dir.right(1) != QString("/"))
{
dir = dir + QString("/");
}
// Go thru all files
for (it = dirlist.begin(); it != dirlist.end(); ++it)
{
path = dir + *it;
FileHandler::readFileToList(path, list);
dc = createDeviceClass(list);
if (dc != NULL)
{
dc->setFile(path);
m_deviceClassList.append(dc);
}
// 03-Jan-2002 / HJu
// The list wasn't cleared between files
while (list.isEmpty() == false)
{
list.first();
delete list.take();
}
}
return true;
}
示例5: decContentsDepth
/*! Decrease the level of the contents hierarchy.
* This will end the current sublist.
* \sa incContentsDepth()
*/
void FTVHelp::decContentsDepth()
{
ASSERT(m_indent>0);
if (m_indent>0)
{
m_indent--;
QList<FTVNode> *nl = &m_indentNodes[m_indent];
FTVNode *parent = nl->getLast();
QList<FTVNode> *children = &m_indentNodes[m_indent+1];
while (!children->isEmpty())
{
parent->children.append(children->take(0));
}
}
}
示例6: setTouchPanel
//====================================
// setTouchPanel
//------------------------------------
void SaXManipulateTouchscreens::setTouchPanel (const QString& group) {
// .../
//! set all panel data associated with the given group name to
//! the current pointer data. The group name consists of the
//! vendor and model name separated by a colon
// ----
if ( ! mCDBPanels ) {
mCDBPanels = new SaXProcess ();
mCDBPanels -> start (CDB_TOUCHERS);
}
QList< QDict<QString> > data;
data = mCDBPanels -> getTablePointerCDB_DATA (
group
);
if (data.isEmpty()) {
excCDBRecordNotFound (group);
qError (errorString(),EXC_CDBRECORDNOTFOUND);
return;
}
// .../
// move the data record to the correct position
// refering to the section ID -> mPointer
// ----
QDict<QString>* record = data.take(0);
for (int n=0;n < mPointer;n++) {
data.append(new QDict<QString>());
}
data.append ( record );
// .../
// merge the toucher data into the current section
// ----
mImport -> merge ( data );
// .../
// set vendor and name tag
// ----
QStringList nameList = QStringList::split ( ":", group );
setNamePair (
nameList.first(),
nameList.last()
);
}
示例7: setMouse
//====================================
// setMouse
//------------------------------------
void SaXManipulateMice::setMouse ( const QString& group ) {
// .../
//! set all mouse data associated with the given group name to
//! the current pointer data. The group name consists of the
//! vendor and model name separated by a colon
// ----
if ( ! mCDBMice ) {
mCDBMice = new SaXProcess ();
mCDBMice -> start (CDB_POINTERS);
}
QList< QDict<QString> > data;
data = mCDBMice -> getTablePointerCDB_DATA (
group
);
// .../
// move the data record to the correct position
// refering to the section ID -> mPointer
// ----
QDict<QString>* record = data.take(0);
for (int n=0;n < mPointer;n++) {
data.append(new QDict<QString>());
}
data.append ( record );
// .../
// merge the data into the current section now
// ----
if (data.isEmpty()) {
excCDBRecordNotFound (group);
qError (errorString(),EXC_CDBRECORDNOTFOUND);
return;
}
mImport -> merge ( data );
// .../
// set vendor and name tag
// ----
QStringList nameList = QStringList::split ( ":", group );
mImport -> setItem ( "Vendor", nameList.first() );
mImport -> setItem ( "Name" , nameList.last() );
}
示例8: generatePage
//.........这里部分代码省略.........
}
QCString oldDir = QDir::currentDirPath().utf8();
QDir::setCurrent(outputDir);
// 5. run bib2xhtml perl script on the generated file which will insert the
// bibliography in citelist.doc
portable_system("perl","\""+bib2xhtmlFile+"\" "+getListOfBibFiles(" ",FALSE)+" \""+
citeListFile+"\"");
QDir::setCurrent(oldDir);
// 6. read back the file
f.setName(citeListFile);
if (!f.open(IO_ReadOnly))
{
err("could not open file %s/citelist.doc for reading\n",outputDir.data());
}
bool insideBib=FALSE;
QCString doc;
QFileInfo fi(citeListFile);
QCString input(fi.size()+1);
f.readBlock(input.data(),fi.size());
f.close();
input.at(fi.size())='\0';
int p=0,s;
//printf("input=[%s]\n",input.data());
while ((s=input.find('\n',p))!=-1)
{
QCString line = input.mid(p,s-p);
//printf("p=%d s=%d line=[%s]\n",p,s,line.data());
p=s+1;
if (line.find("<!-- BEGIN BIBLIOGRAPHY")!=-1) insideBib=TRUE;
else if (line.find("<!-- END BIBLIOGRAPH")!=-1) insideBib=FALSE;
else if (insideBib) doc+=line+"\n";
int i;
// determine text to use at the location of the @cite command
if (insideBib && (i=line.find("<a name=\"CITEREF_"))!=-1)
{
int j=line.find("\">[");
int k=line.find("]</a>");
if (j!=-1 && k!=-1)
{
QCString label = line.mid(i+17,j-i-17);
QCString number = line.mid(j+2,k-j-1);
CiteInfo *ci = m_entries.find(label);
//printf("label='%s' number='%s' => %p\n",label.data(),number.data(),ci);
if (ci)
{
ci->text = number;
}
}
}
}
//printf("doc=[%s]\n",doc.data());
// 7. add it as a page
addRelatedPage(CiteConsts::fileName,
theTranslator->trCiteReferences(),doc,0,CiteConsts::fileName,1,0,0,0);
// 8. for latex we just copy the bib files to the output and let
// latex do this work.
if (Config_getBool("GENERATE_LATEX"))
{
// copy bib files to the latex output dir
QStrList &citeDataList = Config_getList("CITE_BIB_FILES");
QCString latexOutputDir = Config_getString("LATEX_OUTPUT")+"/";
const char *bibdata = citeDataList.first();
while (bibdata)
{
QCString bibFile = bibdata;
if (!bibFile.isEmpty() && bibFile.right(4)!=".bib") bibFile+=".bib";
QFileInfo fi(bibFile);
if (fi.exists())
{
if (!bibFile.isEmpty())
{
copyFile(bibFile,latexOutputDir+fi.fileName().data());
}
}
else
{
err("bib file %s not found!\n",bibFile.data());
}
bibdata = citeDataList.next();
}
}
// 9. Remove temporary files
thisDir.remove(citeListFile);
thisDir.remove(doxygenBstFile);
thisDir.remove(bib2xhtmlFile);
while (!tempFiles.isEmpty())
{
QCString *s=tempFiles.take(0);
thisDir.remove(*s);
}
}
示例9: tile_order
void qapp::tile_order(xwindow *actclient)
{
if(smode)
return;
xwindow *client,*tmcl=NULL;
int cct=0,cheight,lh=0;
QWidget *dt = QApplication::desktop();
if(actclient != NULL && (clients.find(actclient) == -1 || ! actclient->is_tileable() || actclient->is_unmapped() || ! is_curdesk(actclient)))
actclient = NULL;
for(client = clients.first(); client != NULL; client = clients.next())
{
if(client != actclient && ! client->is_unmapped() && is_curdesk(client) && client->is_tileable())
cct++;
}
if(actclient == NULL && cct > 0)
cct--;
tmaxclient = NULL;
if(cct)
cheight = (dt->height()-defaults::tb_height)/cct;
int xpos,xcw,ypos,yp;
ypos = yp = defaults::toolbar_top?defaults::tb_height+1:0;
xpos = (int)(dt->width()*defaults::tleftspace);
xcw = dt->width()-xpos-1;
for(client = clients.first(); client != NULL; client = clients.next())
{
if(! client->is_tileable() || client->is_unmapped() || ! is_curdesk(client))
continue;
if(actclient == NULL || cct == 0)
actclient = client;
if(client == actclient)
{
tmcl = tmaxclient = client;
continue;
}
if(lh < 0)
lh = 0;
client->minimize_frame(cct > defaults::wminframe?TRUE:FALSE);
lh = client->set_tile(xpos+1, ypos-lh, xcw, cheight+lh);
ypos += cheight;
}
if(tmcl != NULL)
{
tmcl->minimize_frame(FALSE);
tmcl->set_tile(0, yp, xpos, dt->height()-defaults::tb_height);
}
if(actclient != NULL)
clients.prepend(clients.take(clients.find(actclient)));
}
示例10: addPen
//====================================
// addPen
//------------------------------------
int SaXManipulateTablets::addPen (const QString& group) {
// .../
//! add a new Pen or Eraser associated with the given group name to
//! the current pointer data. The group name consists of the
//! vendor and model name separated by a colon. The contents of the
//! data record will set the InputFashion type for this addon
//! pointer device
// ----
if ( ! mCDBPens ) {
mCDBPens = new SaXProcess ();
mCDBPens -> start (CDB_PENS);
}
QList< QDict<QString> > data;
data = mCDBPens -> getTablePointerCDB_DATA (
group
);
if (data.isEmpty()) {
excCDBRecordNotFound (group);
qError (errorString(),EXC_CDBRECORDNOTFOUND);
return -1;
}
// .../
// set input fashion type for the selected pen
// ----
QDict<QString> penData = *data.at(0);
QString* type = penData["TabletType"];
if (! type) {
excPointerFashionTypeFailed ("undefined");
qError (errorString(),EXC_POINTERFASHIONTYPEFAILED);
return -1;
}
if ((*type != "stylus") && (*type != "eraser")) {
excPointerFashionTypeFailed (*type);
qError (errorString(),EXC_POINTERFASHIONTYPEFAILED);
return -1;
}
QString fashion (SAX_INPUT_PEN);
if (*type == "eraser") {
fashion = SAX_INPUT_ERASER;
}
// .../
// create new input device for the pen and make
// it the current pointer device
// ----
int newPen = mManipInputDevices->addInputDevice (fashion);
if ( ! selectPointer (newPen)) {
return -1;
}
// .../
// move the data record to the correct position
// refering to the section ID -> mPointer
// ----
QDict<QString>* record = data.take(0);
for (int n=0;n < mPointer;n++) {
data.append(new QDict<QString>());
}
data.append ( record );
// .../
// merge the pen data now into the current section
// ----
mImport -> merge ( data );
// .../
// set vendor and name tag
// ----
QStringList nameList = QStringList::split ( ":", group );
mImport -> setItem ( "Vendor", nameList.first() );
mImport -> setItem ( "Name" , nameList.last() );
return newPen;
}