本文整理汇总了C++中QWidgetList::front方法的典型用法代码示例。如果您正苦于以下问题:C++ QWidgetList::front方法的具体用法?C++ QWidgetList::front怎么用?C++ QWidgetList::front使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QWidgetList
的用法示例。
在下文中一共展示了QWidgetList::front方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: deleteWidgetList
void FormWindowBase::deleteWidgetList(const QWidgetList &widget_list)
{
switch (widget_list.size()) {
case 0:
break;
case 1: {
commandHistory()->beginMacro(tr("Delete '%1'").arg(widget_list.front()->objectName()));
emit widgetRemoved(widget_list.front());
DeleteWidgetCommand *cmd = new DeleteWidgetCommand(this);
cmd->init(widget_list.front());
commandHistory()->push(cmd);
commandHistory()->endMacro();
}
break;
default:
commandHistory()->beginMacro(tr("Delete"));
foreach (QWidget *w, widget_list) {
emit widgetRemoved(w);
DeleteWidgetCommand *cmd = new DeleteWidgetCommand(this);
cmd->init(w);
commandHistory()->push(cmd);
}
commandHistory()->endMacro();
break;
}
示例2: deleteWidgetList
void FormWindowBase::deleteWidgetList(const QWidgetList &widget_list)
{
// We need a macro here even for single widgets because the some components (for example,
// the signal slot editor are connected to widgetRemoved() and add their
// own commands (for example, to delete w's connections)
const QString description = widget_list.size() == 1 ?
tr("Delete '%1'").arg(widget_list.front()->objectName()) : tr("Delete");
commandHistory()->beginMacro(description);
foreach (QWidget *w, widget_list) {
emit widgetRemoved(w);
DeleteWidgetCommand *cmd = new DeleteWidgetCommand(this);
cmd->init(w);
commandHistory()->push(cmd);
}