本文整理汇总了C++中QObjectList::setAutoDelete方法的典型用法代码示例。如果您正苦于以下问题:C++ QObjectList::setAutoDelete方法的具体用法?C++ QObjectList::setAutoDelete怎么用?C++ QObjectList::setAutoDelete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QObjectList
的用法示例。
在下文中一共展示了QObjectList::setAutoDelete方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: prepareList
void EmoticonSelector::prepareList(void)
{
// kdDebug(14000) << k_funcinfo << "called." << endl;
int row = 0;
int col = 0;
QMap<QString, QStringList> list = Kopete::Emoticons::self()->emoticonAndPicList();
int emoticonsPerRow = static_cast<int>(sqrt(list.count()));
//kdDebug(14000) << "emoticonsPerRow=" << emoticonsPerRow << endl;
if ( lay )
{
QObjectList *objList = queryList( "EmoticonLabel" );
//kdDebug(14000) << k_funcinfo << "There are " << objList->count() << " EmoticonLabels to delete." << endl;
objList->setAutoDelete(true);
objList->clear();
delete objList;
delete lay;
}
lay = new QGridLayout(this, 0, 0, 4, 4, "emoticonLayout");
movieList.clear();
for (QMap<QString, QStringList>::const_iterator it = list.constBegin(); it != list.constEnd(); ++it )
{
QWidget *w = new EmoticonLabel(it.data().first(), it.key(), this);
movieList.push_back( ((QLabel*)w)->movie() );
connect(w, SIGNAL(clicked(const QString&)), this, SLOT(emoticonClicked(const QString&)));
// kdDebug(14000) << "adding Emoticon to row=" << row << ", col=" << col << "." << endl;
lay->addWidget(w, row, col);
if ( col == emoticonsPerRow )
{
col = 0;
row++;
}
else
col++;
}
resize(minimumSizeHint());
}