本文整理汇总了C++中MLayout::preferredSize方法的典型用法代码示例。如果您正苦于以下问题:C++ MLayout::preferredSize方法的具体用法?C++ MLayout::preferredSize怎么用?C++ MLayout::preferredSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MLayout
的用法示例。
在下文中一共展示了MLayout::preferredSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: heightForWidthPerformance
void Pt_MLayout::heightForWidthPerformance()
{
QFETCH(bool, qtOnly);
QFETCH(bool, hfw);
QFETCH(bool, nested);
QGraphicsLinearLayout *outerlayout = NULL;
if(nested) {
outerlayout = new QGraphicsLinearLayout(m_form);
for(int i = 0; i < 5; i++) {
QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical);
outerlayout->addItem(layout);
outerlayout = layout;
}
}
QGraphicsLinearLayout *qlayout = NULL;
MLayout *layout = NULL;
MLinearLayoutPolicy *policy = NULL;
if(qtOnly) {
qlayout = new QGraphicsLinearLayout(Qt::Vertical);
if (nested)
outerlayout->addItem(qlayout);
else
m_form->setLayout(qlayout);
} else {
layout = new MLayout;
policy = new MLinearLayoutPolicy(layout, Qt::Vertical);
if (nested)
outerlayout->addItem(layout);
else
m_form->setLayout(layout);
}
for(int i = 0; i < 1; i++) {
MySquareWidget *widget = new MySquareWidget;
QSizePolicy sizepolicy = widget->sizePolicy();
sizepolicy.setHeightForWidth(hfw);
widget->setSizePolicy(sizepolicy);
if (qtOnly)
qlayout->addItem(widget);
else
policy->addItem(widget);
}
while (MTheme::hasPendingRequests()) {
usleep(10);
QCoreApplication::processEvents();
}
QBENCHMARK {
if (qtOnly) {
qlayout->invalidate();
QCoreApplication::processEvents();
(void)qlayout->preferredSize();
} else {
layout->invalidate();
QCoreApplication::processEvents();
(void)layout->preferredSize();
}
}
}