本文整理汇总了C++中QSizePolicy::setVerData方法的典型用法代码示例。如果您正苦于以下问题:C++ QSizePolicy::setVerData方法的具体用法?C++ QSizePolicy::setVerData怎么用?C++ QSizePolicy::setVerData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSizePolicy
的用法示例。
在下文中一共展示了QSizePolicy::setVerData方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sizePolicy
/*!
\return MinimumExpanding/Fixed for a horizontal orientation;
Fixed/MinimumExpanding for a vertical orientation.
*/
QSizePolicy QwtSlider::sizePolicy() const
{
QSizePolicy sp;
if ( orientation() == Qt::Horizontal )
{
sp.setHorData( QSizePolicy::MinimumExpanding );
sp.setVerData( QSizePolicy::Fixed );
}
else
{
sp.setHorData( QSizePolicy::Fixed );
sp.setVerData( QSizePolicy::MinimumExpanding );
}
return sp;
}
示例2: sizePolicy
//! \return MinimumExpanding/MinimumExpanding
QSizePolicy QwtPlot::sizePolicy() const
{
QSizePolicy sp;
sp.setHorData( QSizePolicy::MinimumExpanding );
sp.setVerData( QSizePolicy::MinimumExpanding );
return sp;
}
示例3: _createItem
void SpinOptionView::_createItem() {
myLabel = new QLabel(myOption->name().c_str(), myTab);
char tmp[64];
snprintf(tmp, sizeof(tmp)-1, "%d", ((ZLSpinOptionEntry*)myOption)->maxValue());
myNumPick = new ZNumPicker(strlen(tmp), myTab, NULL, 0, (ZSkinService::WidgetClsID)4);
myNumPick->setMinValue(((ZLSpinOptionEntry*)myOption)->minValue());
myNumPick->setMaxValue(((ZLSpinOptionEntry*)myOption)->maxValue());
myNumPick->setLineStep(((ZLSpinOptionEntry*)myOption)->step());
myNumPick->setValue(((ZLSpinOptionEntry*)myOption)->initialValue());
QFont f = qApp->font();
f.setPointSize(14);
myLabel->setFont(f);
#if 0
QSizePolicy pol = myNumPick->sizePolicy();
pol.setHorData(QSizePolicy::Fixed);
pol.setVerData(QSizePolicy::Fixed);
myNumPick->setSizePolicy(pol);
pol = myLabel->sizePolicy();
pol.setHorData(QSizePolicy::Fixed);
myLabel->setSizePolicy(pol);
myLabel->setLineWidth(80);
#endif
int width = myToColumn - myFromColumn + 1;
myTab->addItem(myLabel, myRow, myFromColumn, myFromColumn + (width * 2) / 3 - 1, Qt::AlignLeft);
myTab->addItem(myNumPick, myRow, myFromColumn + (width * 2) / 3, myToColumn-1, Qt::AlignLeft);
}
示例4: initPlot
/*!
\brief Initializes a QwtPlot instance
\param title Title text
*/
void QwtPlot::initPlot(const QString &title)
{
d_layout = new QwtPlotLayout;
d_curves = new QwtCurveDict;
d_markers = new QwtMarkerDict;
d_autoReplot = FALSE;
d_lblTitle = new QLabel(title, this);
d_lblTitle->setFont(QFont(fontInfo().family(), 14, QFont::Bold));
d_lblTitle->setAlignment(Qt::AlignCenter|Qt::WordBreak|Qt::ExpandTabs);
d_legend = new QwtLegend(this);
d_autoLegend = FALSE;
d_scale[yLeft] = new QwtScale(QwtScale::Left, this, "yLeft");
d_scale[yRight] = new QwtScale(QwtScale::Right, this, "yRight");
d_scale[xTop] = new QwtScale(QwtScale::Top, this, "xTop");
d_scale[xBottom] = new QwtScale(QwtScale::Bottom, this, "xBottom");
initAxes();
d_grid = new QwtPlotGrid(this);
d_grid->setPen(QPen(Qt::black, 0, Qt::DotLine));
d_grid->enableXMin(FALSE);
d_grid->enableYMin(FALSE);
d_grid->setAxis(xBottom, yLeft);
d_canvas = new QwtPlotCanvas(this);
d_canvas->setFrameStyle(QFrame::Panel|QFrame::Sunken);
d_canvas->setLineWidth(2);
d_canvas->setMidLineWidth(0);
#ifndef QWT_NO_COMPAT
connect(d_canvas, SIGNAL(mousePressed(const QMouseEvent &)),
this, SIGNAL(plotMousePressed(const QMouseEvent &)));
connect(d_canvas, SIGNAL(mouseMoved(const QMouseEvent &)),
this, SIGNAL(plotMouseMoved(const QMouseEvent &)));
connect(d_canvas, SIGNAL(mouseReleased(const QMouseEvent &)),
this, SIGNAL(plotMouseReleased(const QMouseEvent &)));
#endif
updateTabOrder();
QSizePolicy sp;
sp.setHorData( QSizePolicy::MinimumExpanding );
sp.setVerData( QSizePolicy::MinimumExpanding );
setSizePolicy(sp);
}
示例5: setObjectProperty
//.........这里部分代码省略.........
v = e.firstChild().toText().data() + ".convertToImage()";
} else if ( e.tagName() == "enum" ) {
if ( stdset )
v = "%1::%2";
else
v = "\"%1\"";
QString oc = objClass;
QString ev = e.firstChild().toText().data();
if ( oc == "QListView" && ev == "Manual" ) // #### workaround, rename QListView::Manual in 4.0
oc = "QScrollView";
if ( stdset )
v = v.arg( oc ).arg( ev );
else
v = v.arg( ev );
} else if ( e.tagName() == "set" ) {
QString keys( e.firstChild().toText().data() );
QStringList lst = QStringList::split( '|', keys );
v = "int( ";
QStringList::Iterator it = lst.begin();
while ( it != lst.end() ) {
v += objClass + "::" + *it;
if ( it != lst.fromLast() )
v += " | ";
++it;
}
v += " )";
} else if ( e.tagName() == "sizepolicy" ) {
QDomElement n3 = e.firstChild().toElement();
QSizePolicy sp;
while ( !n3.isNull() ) {
if ( n3.tagName() == "hsizetype" )
sp.setHorData( (QSizePolicy::SizeType)n3.firstChild().toText().data().toInt() );
else if ( n3.tagName() == "vsizetype" )
sp.setVerData( (QSizePolicy::SizeType)n3.firstChild().toText().data().toInt() );
else if ( n3.tagName() == "horstretch" )
sp.setHorStretch( n3.firstChild().toText().data().toInt() );
else if ( n3.tagName() == "verstretch" )
sp.setVerStretch( n3.firstChild().toText().data().toInt() );
n3 = n3.nextSibling().toElement();
}
QString tmp;
if ( !obj.isEmpty() )
tmp = obj + "->";
v = "QSizePolicy( (QSizePolicy::SizeType)%1, (QSizePolicy::SizeType)%2, %3, %4, " + tmp + "sizePolicy().hasHeightForWidth() )";
v = v.arg( (int)sp.horData() ).arg( (int)sp.verData() ).arg( sp.horStretch() ).arg( sp.verStretch() );
} else if ( e.tagName() == "palette" ) {
QPalette pal;
bool no_pixmaps = e.elementsByTagName( "pixmap" ).count() == 0;
QDomElement n;
if ( no_pixmaps ) {
n = e.firstChild().toElement();
while ( !n.isNull() ) {
QColorGroup cg;
if ( n.tagName() == "active" ) {
cg = loadColorGroup( n );
pal.setActive( cg );
} else if ( n.tagName() == "inactive" ) {
cg = loadColorGroup( n );
pal.setInactive( cg );
} else if ( n.tagName() == "disabled" ) {
cg = loadColorGroup( n );
pal.setDisabled( cg );
}
n = n.nextSibling().toElement();
}
}
示例6: elementToVariant
//.........这里部分代码省略.........
v = QVariant(QKeySequence(key));
#else
v = QVariant(key);
#endif
ok = true;
}
}
else if (e.tagName() == "font")
{
QFont f;
bool boolOk;
if (e.hasAttribute("family"))
f.setFamily(e.attribute("family"));
if (e.hasAttribute("pointsize"))
f.setPointSize(e.attribute("pointsize").toInt());
if (e.hasAttribute("bold"))
f.setBold(getBoolFromString(e.attribute("bold"), boolOk));
if (e.hasAttribute("italic"))
f.setItalic(getBoolFromString(e.attribute("italic"), boolOk));
if (e.hasAttribute("strikeout"))
f.setStrikeOut(getBoolFromString(e.attribute("strikeout"), boolOk));
v = QVariant(f);
ok = true;
}
else if (e.tagName() == "sizepolicy")
{
QSizePolicy sp;
if (e.hasAttribute("hsizetype"))
sp.setHorData((QSizePolicy::SizeType)e.attribute("hsizetype").toInt());
if (e.hasAttribute("vsizetype"))
sp.setVerData((QSizePolicy::SizeType)e.attribute("vsizetype").toInt());
#if (QT_VERSION >= 300)
if (e.hasAttribute("horstretch"))
sp.setHorStretch(e.attribute("horstretch").toInt());
if (e.hasAttribute("verstretch"))
sp.setHorStretch(e.attribute("verstretch").toInt());
#endif
v = QVariant(sp);
ok = true;
}
else if (e.tagName() == "cursor")
{
if (e.hasAttribute("shape"))
v = QVariant(QCursor(e.attribute("shape").toInt(&ok, 10)));
else
qWarning("%s element without value!", (const char*)e.tagName());
}
else if (e.tagName() == "stringlist")
{
QDomNodeList stringNodeList = e.elementsByTagName("string");
QStringList stringList;
QDomElement stringElement;
for (uint i = 0; i < stringNodeList.length(); i++)
{
stringElement = stringNodeList.item(i).toElement();
if (!stringElement.hasAttribute("value"))
{
qWarning("%s element in %s without value! Ignoring!",
(const char*)stringElement.tagName(),
(const char*)e.tagName());
continue;
}
示例7: elementToVariant
/*!
Interprets element \a e as variant and returns the result of the interpretation.
*/
QVariant DomTool::elementToVariant( const QDomElement& e, const QVariant& defValue, QString &comment )
{
QVariant v;
if ( e.tagName() == "rect" ) {
QDomElement n3 = e.firstChild().toElement();
int x = 0, y = 0, w = 0, h = 0;
while ( !n3.isNull() ) {
if ( n3.tagName() == "x" )
x = n3.firstChild().toText().data().toInt();
else if ( n3.tagName() == "y" )
y = n3.firstChild().toText().data().toInt();
else if ( n3.tagName() == "width" )
w = n3.firstChild().toText().data().toInt();
else if ( n3.tagName() == "height" )
h = n3.firstChild().toText().data().toInt();
n3 = n3.nextSibling().toElement();
}
v = QVariant( QRect( x, y, w, h ) );
} else if ( e.tagName() == "point" ) {
QDomElement n3 = e.firstChild().toElement();
int x = 0, y = 0;
while ( !n3.isNull() ) {
if ( n3.tagName() == "x" )
x = n3.firstChild().toText().data().toInt();
else if ( n3.tagName() == "y" )
y = n3.firstChild().toText().data().toInt();
n3 = n3.nextSibling().toElement();
}
v = QVariant( QPoint( x, y ) );
} else if ( e.tagName() == "size" ) {
QDomElement n3 = e.firstChild().toElement();
int w = 0, h = 0;
while ( !n3.isNull() ) {
if ( n3.tagName() == "width" )
w = n3.firstChild().toText().data().toInt();
else if ( n3.tagName() == "height" )
h = n3.firstChild().toText().data().toInt();
n3 = n3.nextSibling().toElement();
}
v = QVariant( QSize( w, h ) );
} else if ( e.tagName() == "color" ) {
v = QVariant( readColor( e ) );
} else if ( e.tagName() == "font" ) {
QDomElement n3 = e.firstChild().toElement();
QFont f( defValue.toFont() );
while ( !n3.isNull() ) {
if ( n3.tagName() == "family" )
f.setFamily( n3.firstChild().toText().data() );
else if ( n3.tagName() == "pointsize" )
f.setPointSize( n3.firstChild().toText().data().toInt() );
else if ( n3.tagName() == "bold" )
f.setBold( n3.firstChild().toText().data().toInt() );
else if ( n3.tagName() == "italic" )
f.setItalic( n3.firstChild().toText().data().toInt() );
else if ( n3.tagName() == "underline" )
f.setUnderline( n3.firstChild().toText().data().toInt() );
else if ( n3.tagName() == "strikeout" )
f.setStrikeOut( n3.firstChild().toText().data().toInt() );
n3 = n3.nextSibling().toElement();
}
v = QVariant( f );
} else if ( e.tagName() == "string" ) {
v = QVariant( e.firstChild().toText().data() );
QDomElement n = e;
n = n.nextSibling().toElement();
if ( n.tagName() == "comment" )
comment = n.firstChild().toText().data();
} else if ( e.tagName() == "cstring" ) {
v = QVariant( QCString( e.firstChild().toText().data() ) );
} else if ( e.tagName() == "number" ) {
bool ok = TRUE;
v = QVariant( e.firstChild().toText().data().toInt( &ok ) );
if ( !ok )
v = QVariant( e.firstChild().toText().data().toDouble() );
} else if ( e.tagName() == "bool" ) {
QString t = e.firstChild().toText().data();
v = QVariant( t == "true" || t == "1", 0 );
} else if ( e.tagName() == "pixmap" ) {
v = QVariant( e.firstChild().toText().data() );
} else if ( e.tagName() == "iconset" ) {
v = QVariant( e.firstChild().toText().data() );
} else if ( e.tagName() == "image" ) {
v = QVariant( e.firstChild().toText().data() );
} else if ( e.tagName() == "enum" ) {
v = QVariant( e.firstChild().toText().data() );
} else if ( e.tagName() == "set" ) {
v = QVariant( e.firstChild().toText().data() );
} else if ( e.tagName() == "sizepolicy" ) {
QDomElement n3 = e.firstChild().toElement();
QSizePolicy sp;
while ( !n3.isNull() ) {
if ( n3.tagName() == "hsizetype" )
sp.setHorData( (QSizePolicy::SizeType)n3.firstChild().toText().data().toInt() );
else if ( n3.tagName() == "vsizetype" )
sp.setVerData( (QSizePolicy::SizeType)n3.firstChild().toText().data().toInt() );
else if ( n3.tagName() == "horstretch" )
sp.setHorStretch( n3.firstChild().toText().data().toInt() );
//.........这里部分代码省略.........
示例8: elementToVariant
/*!
Interprets element \a e as variant and returns the result of the interpretation.
*/
QVariant DomTool::elementToVariant( const QDomElement& e, const QVariant& defValue, QString *comment )
{
QVariant v;
if ( e.tagName() == "rect" ) {
QDomElement n3 = e.firstChild().toElement();
int x = 0, y = 0, w = 0, h = 0;
while ( !n3.isNull() ) {
if ( n3.tagName() == "x" )
x = n3.firstChild().toText().data().toInt();
else if ( n3.tagName() == "y" )
y = n3.firstChild().toText().data().toInt();
else if ( n3.tagName() == "width" )
w = n3.firstChild().toText().data().toInt();
else if ( n3.tagName() == "height" )
h = n3.firstChild().toText().data().toInt();
n3 = n3.nextSibling().toElement();
}
v = QVariant( QRect( x, y, w, h ) );
} else if ( e.tagName() == "point" ) {
QDomElement n3 = e.firstChild().toElement();
int x = 0, y = 0;
while ( !n3.isNull() ) {
if ( n3.tagName() == "x" )
x = n3.firstChild().toText().data().toInt();
else if ( n3.tagName() == "y" )
y = n3.firstChild().toText().data().toInt();
n3 = n3.nextSibling().toElement();
}
v = QVariant( QPoint( x, y ) );
} else if ( e.tagName() == "size" ) {
QDomElement n3 = e.firstChild().toElement();
int w = 0, h = 0;
while ( !n3.isNull() ) {
if ( n3.tagName() == "width" )
w = n3.firstChild().toText().data().toInt();
else if ( n3.tagName() == "height" )
h = n3.firstChild().toText().data().toInt();
n3 = n3.nextSibling().toElement();
}
v = QVariant( QSize( w, h ) );
} else if ( e.tagName() == "color" ) {
v = QVariant( readColor( e ) );
} else if ( e.tagName() == "font" ) {
QDomElement n3 = e.firstChild().toElement();
QFont f( defValue.toFont() );
while ( !n3.isNull() ) {
if ( n3.tagName() == "family" )
f.setFamily( n3.firstChild().toText().data() );
else if ( n3.tagName() == "pointsize" )
f.setPointSize( n3.firstChild().toText().data().toInt() );
else if ( n3.tagName() == "bold" )
f.setBold( n3.firstChild().toText().data().toInt() );
else if ( n3.tagName() == "italic" )
f.setItalic( n3.firstChild().toText().data().toInt() );
else if ( n3.tagName() == "underline" )
f.setUnderline( n3.firstChild().toText().data().toInt() );
else if ( n3.tagName() == "strikeout" )
f.setStrikeOut( n3.firstChild().toText().data().toInt() );
n3 = n3.nextSibling().toElement();
}
v = QVariant( f );
} else if ( e.tagName() == "string" ) {
v = QVariant( e.firstChild().toText().data() );
QDomElement n = e;
n = n.nextSibling().toElement();
if ( comment && n.tagName() == "comment" )
*comment = n.firstChild().toText().data();
} else if ( e.tagName() == "cstring" ) {
v = QVariant( QCString( e.firstChild().toText().data() ) );
} else if ( e.tagName() == "number" ) {
v = QVariant( e.firstChild().toText().data().toInt() );
} else if ( e.tagName() == "bool" ) {
QString t = e.firstChild().toText().data();
v = QVariant( t == "true" || t == "1", 0 );
} else if ( e.tagName() == "pixmap" ) {
v = QVariant( e.firstChild().toText().data() );
} else if ( e.tagName() == "iconset" ) {
v = QVariant( e.firstChild().toText().data() );
} else if ( e.tagName() == "image" ) {
v = QVariant( e.firstChild().toText().data() );
} else if ( e.tagName() == "enum" ) {
v = QVariant( e.firstChild().toText().data() );
} else if ( e.tagName() == "set" ) {
v = QVariant( e.firstChild().toText().data() );
} else if ( e.tagName() == "sizepolicy" ) {
QDomElement n3 = e.firstChild().toElement();
QSizePolicy sp;
while ( !n3.isNull() ) {
if ( n3.tagName() == "hsizetype" )
sp.setHorData( (QSizePolicy::SizeType)n3.firstChild().toText().data().toInt() );
else if ( n3.tagName() == "vsizetype" )
sp.setVerData( (QSizePolicy::SizeType)n3.firstChild().toText().data().toInt() );
n3 = n3.nextSibling().toElement();
}
v = QVariant( sp );
} else if ( e.tagName() == "cursor" ) {
v = QVariant( QCursor( e.firstChild().toText().data().toInt() ) );
//.........这里部分代码省略.........
示例9: elementToVariant
//.........这里部分代码省略.........
else if (e.tagName() == "key")
{
int key;
if (e.hasAttribute("sequence"))
{
key = QAccel::stringToKey(e.attribute("sequence"));
// fix the key code (deal with Qt brain death)
key &= ~Qt::UNICODE_ACCEL;
#if QT_VERSION >= 300
v = QVariant(QKeySequence(key));
#else
v = QVariant(key);
#endif
ok = true;
}
}
else if (e.tagName() == "font")
{
QFont f;
bool boolOk;
if (e.hasAttribute("family"))
f.setFamily(e.attribute("family"));
if (e.hasAttribute("pointsize"))
f.setPointSize(e.attribute("pointsize").toInt());
if (e.hasAttribute("bold"))
f.setBold(getBoolFromString(e.attribute("bold"), boolOk));
if (e.hasAttribute("italic"))
f.setItalic(getBoolFromString(e.attribute("italic"), boolOk));
if (e.hasAttribute("strikeout"))
f.setStrikeOut(getBoolFromString(e.attribute("strikeout"), boolOk));
v = QVariant(f);
ok = true;
}
else if (e.tagName() == "sizepolicy")
{
QSizePolicy sp;
if (e.hasAttribute("hsizetype"))
sp.setHorData((QSizePolicy::SizeType)e.attribute("hsizetype").toInt());
if (e.hasAttribute("vsizetype"))
sp.setVerData((QSizePolicy::SizeType)e.attribute("vsizetype").toInt());
#if (QT_VERSION >= 300)
if (e.hasAttribute("horstretch"))
sp.setHorStretch(e.attribute("horstretch").toInt());
if (e.hasAttribute("verstretch"))
sp.setHorStretch(e.attribute("verstretch").toInt());
#endif
v = QVariant(sp);
ok = true;
}
else if (e.tagName() == "cursor")
{
if (e.hasAttribute("shape"))
v = QVariant(QCursor(e.attribute("shape").toUInt(&ok, 10)));
else
qWarning("%s element without value!", (const char*)e.tagName());
}
else if (e.tagName() == "stringlist")
{
QDomNodeList stringNodeList = e.elementsByTagName("string");
QStringList stringList;
QDomElement stringElement;
for (uint i = 0; i < stringNodeList.length(); i++)
{
stringElement = stringNodeList.item(i).toElement();
if (!stringElement.hasAttribute("value"))
{
qWarning("%s element in %s without value! Ignoring!",
(const char*)stringElement.tagName(),
(const char*)e.tagName());
continue;
}
stringList.append(e.attribute("value"));
}
v = stringList;
ok = true;
}
else if (e.tagName() == "list")
{
qWarning("Unimplemented tag: %s", (const char*)e.tagName());
}
else if (e.tagName() == "map")
{
qWarning("Unimplemented tag: %s", (const char*)e.tagName());
}
else
{
qWarning("Unknown tag: %s", (const char*)e.tagName());
}
return ok;
}