本文整理汇总了C++中QSpacerItem::sizeHint方法的典型用法代码示例。如果您正苦于以下问题:C++ QSpacerItem::sizeHint方法的具体用法?C++ QSpacerItem::sizeHint怎么用?C++ QSpacerItem::sizeHint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSpacerItem
的用法示例。
在下文中一共展示了QSpacerItem::sizeHint方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sizeHint
QSize QSpacerItemProto::sizeHint() const
{
QSpacerItem *item = qscriptvalue_cast<QSpacerItem*>(thisObject());
if (item)
return item->sizeHint();
return QSize();
}
示例2: sipIsDerived
static PyObject *meth_QSpacerItem_sizeHint(PyObject *sipSelf, PyObject *sipArgs)
{
PyObject *sipParseErr = NULL;
bool sipSelfWasArg = (!sipSelf || sipIsDerived((sipSimpleWrapper *)sipSelf));
{
QSpacerItem *sipCpp;
if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_QSpacerItem, &sipCpp))
{
QSize *sipRes;
Py_BEGIN_ALLOW_THREADS
sipRes = new QSize((sipSelfWasArg ? sipCpp->QSpacerItem::sizeHint() : sipCpp->sizeHint()));
Py_END_ALLOW_THREADS
return sipConvertFromNewType(sipRes,sipType_QSize,NULL);
}
}
示例3: setDirection
/*!
Sets the direction of this layout to \a direction.
*/
void QBoxLayout::setDirection(Direction direction)
{
Q_D(QBoxLayout);
if (d->dir == direction)
return;
if (horz(d->dir) != horz(direction)) {
//swap around the spacers (the "magic" bits)
//#### a bit yucky, knows too much.
//#### probably best to add access functions to spacerItem
//#### or even a QSpacerItem::flip()
for (int i = 0; i < d->list.size(); ++i) {
QBoxLayoutItem *box = d->list.at(i);
if (box->magic) {
QSpacerItem *sp = box->item->spacerItem();
if (sp) {
if (sp->expandingDirections() == Qt::Orientations(0) /*No Direction*/) {
//spacing or strut
QSize s = sp->sizeHint();
sp->changeSize(s.height(), s.width(),
horz(direction) ? QSizePolicy::Fixed:QSizePolicy::Minimum,
horz(direction) ? QSizePolicy::Minimum:QSizePolicy::Fixed);
} else {
//stretch
if (horz(direction))
sp->changeSize(0, 0, QSizePolicy::Expanding,
QSizePolicy::Minimum);
else
sp->changeSize(0, 0, QSizePolicy::Minimum,
QSizePolicy::Expanding);
}
}
}
}
}
d->dir = direction;
invalidate();
}
示例4: getLayoutItemInfo
QString LayoutDumper::getLayoutItemInfo(QLayoutItem* item)
{
QWidgetItem* wi = dynamic_cast<QWidgetItem*>(item);
QSpacerItem* si = dynamic_cast<QSpacerItem*>(item);
if (wi) {
if (wi->widget()) {
return QString("%1 [alignment: %2]")
.arg(getWidgetInfo(*wi->widget()))
.arg(toString(wi->alignment()));
}
} else if (si) {
QSize hint = si->sizeHint();
QLayout* layout = si->layout();
return QString("QSpacerItem: sizeHint (%1 x %2), policy %3, "
"constraint %4, alignment %5")
.arg(hint.width())
.arg(hint.height())
.arg(toString(si->sizePolicy()))
.arg(layout ? toString(layout->sizeConstraint())
: "[no layout]")
.arg(si->alignment());
}
return "";
}