本文整理汇总了C++中QSizePolicy::verticalStretch方法的典型用法代码示例。如果您正苦于以下问题:C++ QSizePolicy::verticalStretch方法的具体用法?C++ QSizePolicy::verticalStretch怎么用?C++ QSizePolicy::verticalStretch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSizePolicy
的用法示例。
在下文中一共展示了QSizePolicy::verticalStretch方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: displayText
QString SizePolicyDelegate::displayText( const QVariant& value ) const
{
const QSizePolicy sp(value.value<QSizePolicy>());
return QString::fromLatin1(SIZEPOLICY_MASK)
.arg(s_sizePolicyListData->nameForPolicy(sp.horizontalPolicy()))
.arg(s_sizePolicyListData->nameForPolicy(sp.verticalPolicy()))
.arg(sp.horizontalStretch())
.arg(sp.verticalStretch());
}
示例2: sizePolicyToString
static QString sizePolicyToString(const QSizePolicy &p)
{
QString rc; {
QTextStream str(&rc);
str << "Control=" << p.controlType() << " expdirs=" << p.expandingDirections()
<< " hasHeightForWidth=" << p.hasHeightForWidth()
<< " H: Policy=" << p.horizontalPolicy()
<< " stretch=" << p.horizontalStretch()
<< " V: Policy=" << p.verticalPolicy()
<< " stretch=" << p.verticalStretch();
}
return rc;
}
示例3: getWidgetSize
int QSplitterLayoutStruct::getWidgetSize(Qt::Orientation orient)
{
if (sizer == -1) {
QSize s = widget->sizeHint();
const int presizer = pick(s, orient);
const int realsize = pick(widget->size(), orient);
if (!s.isValid() || (widget->testAttribute(Qt::WA_Resized) && (realsize > presizer))) {
sizer = pick(widget->size(), orient);
} else {
sizer = presizer;
}
QSizePolicy p = widget->sizePolicy();
int sf = (orient == Qt::Horizontal) ? p.horizontalStretch() : p.verticalStretch();
if (sf > 1)
sizer *= sf;
}
return sizer;
}
示例4: getStretch
static int getStretch(const QWidget *w)
{
QSizePolicy sp = w->sizePolicy();
return qMax(sp.horizontalStretch(), sp.verticalStretch());
}
示例5: doResize
void QSplitterPrivate::doResize()
{
Q_Q(QSplitter);
QRect r = q->contentsRect();
int n = list.count();
QVector<QLayoutStruct> a(n*2);
int i;
bool noStretchFactorsSet = true;
for (i = 0; i < n; ++i) {
QSizePolicy p = list.at(i)->widget->sizePolicy();
int sf = orient == Qt::Horizontal ? p.horizontalStretch() : p.verticalStretch();
if (sf != 0) {
noStretchFactorsSet = false;
break;
}
}
int j=0;
for (i = 0; i < n; ++i) {
QSplitterLayoutStruct *s = list.at(i);
#ifdef QSPLITTER_DEBUG
qDebug("widget %d hidden: %d collapsed: %d handle hidden: %d", i, s->widget->isHidden(),
s->collapsed, s->handle->isHidden());
#endif
a[j].init();
if (s->handle->isHidden()) {
a[j].maximumSize = 0;
} else {
a[j].sizeHint = a[j].minimumSize = a[j].maximumSize = s->getHandleSize(orient);
a[j].empty = false;
}
++j;
a[j].init();
if (s->widget->isHidden() || s->collapsed) {
a[j].maximumSize = 0;
} else {
a[j].minimumSize = pick(qSmartMinSize(s->widget));
a[j].maximumSize = pick(s->widget->maximumSize());
a[j].empty = false;
bool stretch = noStretchFactorsSet;
if (!stretch) {
QSizePolicy p = s->widget->sizePolicy();
int sf = orient == Qt::Horizontal ? p.horizontalStretch() : p.verticalStretch();
stretch = (sf != 0);
}
if (stretch) {
a[j].stretch = s->getWidgetSize(orient);
a[j].sizeHint = a[j].minimumSize;
a[j].expansive = true;
} else {
a[j].sizeHint = qMax(s->getWidgetSize(orient), a[j].minimumSize);
}
}
++j;
}
qGeomCalc(a, 0, n*2, pick(r.topLeft()), pick(r.size()), 0);
#ifdef QSPLITTER_DEBUG
for (i = 0; i < n*2; ++i) {
qDebug("%*s%d: stretch %d, sh %d, minS %d, maxS %d, exp %d, emp %d -> %d, %d",
i, "", i,
a[i].stretch,
a[i].sizeHint,
a[i].minimumSize,
a[i].maximumSize,
a[i].expansive,
a[i].empty,
a[i].pos,
a[i].size);
}
#endif
for (i = 0; i < n; ++i) {
QSplitterLayoutStruct *s = list.at(i);
setGeo(s, a[i*2+1].pos, a[i*2+1].size, false);
}
}
示例6: applySimpleProperty
//.........这里部分代码省略.........
case QVariant::Cursor: {
const QMetaEnum cursorShape_enum = metaEnum<QAbstractFormBuilderGadget>("cursorShape");
dom_prop->setElementCursorShape(QLatin1String(cursorShape_enum.valueToKey(qvariant_cast<QCursor>(v).shape())));
}
return true;
#endif
case QVariant::KeySequence: {
DomString *s = new DomString();
s->setText(qvariant_cast<QKeySequence>(v).toString(QKeySequence::PortableText));
dom_prop->setElementString(s);
}
return true;
case QVariant::Locale: {
DomLocale *dom = new DomLocale();
const QLocale locale = qvariant_cast<QLocale>(v);
const QMetaEnum language_enum = metaEnum<QAbstractFormBuilderGadget>("language");
const QMetaEnum country_enum = metaEnum<QAbstractFormBuilderGadget>("country");
dom->setAttributeLanguage(QLatin1String(language_enum.valueToKey(locale.language())));
dom->setAttributeCountry(QLatin1String(country_enum.valueToKey(locale.country())));
dom_prop->setElementLocale(dom);
}
return true;
case QVariant::SizePolicy: {
DomSizePolicy *dom = new DomSizePolicy();
const QSizePolicy sizePolicy = qvariant_cast<QSizePolicy>(v);
dom->setElementHorStretch(sizePolicy.horizontalStretch());
dom->setElementVerStretch(sizePolicy.verticalStretch());
const QMetaEnum sizeType_enum = metaEnum<QAbstractFormBuilderGadget>("sizeType");
dom->setAttributeHSizeType(QLatin1String(sizeType_enum.valueToKey(sizePolicy.horizontalPolicy())));
dom->setAttributeVSizeType(QLatin1String(sizeType_enum.valueToKey(sizePolicy.verticalPolicy())));
dom_prop->setElementSizePolicy(dom);
}
return true;
case QVariant::Date: {
DomDate *dom = new DomDate();
const QDate date = qvariant_cast<QDate>(v);
dom->setElementYear(date.year());
dom->setElementMonth(date.month());
dom->setElementDay(date.day());
dom_prop->setElementDate(dom);
}
return true;
case QVariant::Time: {
DomTime *dom = new DomTime();
const QTime time = qvariant_cast<QTime>(v);
dom->setElementHour(time.hour());
dom->setElementMinute(time.minute());
dom->setElementSecond(time.second());
dom_prop->setElementTime(dom);
}