本文整理汇总了C++中FlowLayout::addItem方法的典型用法代码示例。如果您正苦于以下问题:C++ FlowLayout::addItem方法的具体用法?C++ FlowLayout::addItem怎么用?C++ FlowLayout::addItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FlowLayout
的用法示例。
在下文中一共展示了FlowLayout::addItem方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QGraphicsWidget
KGVisualItemGroup::KGVisualItemGroup(QGraphicsWidget *parent) :
QGraphicsWidget(parent, Qt::Widget), m_isFiltered(0)
{
FlowLayout *layout = new FlowLayout;
layout->setSpacing(Qt::Horizontal, 40);
layout->setSpacing(Qt::Vertical, 40);
layout->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum);
layout->setContentsMargins(40,40,20,10);
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum);
setLayout(layout);
KGVisualAppendItem *appendItem = new KGVisualAppendItem(KGVisualAppendItem::APPEND, this);
appendItem->setPreferredSize(225, 155);
layout->addItem(appendItem);
p_visualInsertItem = new KGVisualAppendItem(KGVisualAppendItem::INSERT, this);
p_visualInsertItem->setPreferredSize(40, 155);
p_visualInsertItem->setVisible(false);
setAcceptHoverEvents(true);
setAcceptDrops(false);
QGraphicsProxyWidget *w = createButton();
w->setPos(0, 40);
w->setParentItem(this);
//setFlags(QGraphicsItem::ItemHasNoContents);
}
示例2: wiseWords
Window::Window()
: QGraphicsWidget(0, Qt::Window)
{
FlowLayout *lay = new FlowLayout;
QLatin1String wiseWords("I am not bothered by the fact that I am unknown."
" I am bothered when I do not know others. (Confucius)");
QString sentence(wiseWords);
QStringList words = sentence.split(QLatin1Char(' '), QString::SkipEmptyParts);
for (int i = 0; i < words.count(); ++i) {
QGraphicsProxyWidget *proxy = new QGraphicsProxyWidget(this);
QLabel *label = new QLabel(words.at(i));
label->setFrameStyle(QFrame::Box | QFrame::Plain);
proxy->setWidget(label);
lay->addItem(proxy);
}
setLayout(lay);
}