本文整理汇总了C++中setHeight函数的典型用法代码示例。如果您正苦于以下问题:C++ setHeight函数的具体用法?C++ setHeight怎么用?C++ setHeight使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setHeight函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setWidth
void TextPopup::show(const int x, const int y, const std::string &str1,
const std::string &str2, const std::string &str3)
{
mText[0]->setCaption(str1);
mText[1]->setCaption(str2);
mText[2]->setCaption(str3);
int minWidth = 0;
for (int f = 0; f < TEXTPOPUPCOUNT; f ++)
{
Label *const label = mText[f];
label->adjustSize();
const int width = label->getWidth();
if (width > minWidth)
minWidth = width;
}
const int pad2 = 2 * mPadding;
minWidth += pad2;
setWidth(minWidth);
int cnt = 1;
if (!str2.empty())
cnt ++;
if (!str3.empty())
cnt ++;
setHeight(pad2 + mText[0]->getFont()->getHeight() * cnt);
const int distance = 20;
const Rect &rect = mDimension;
int posX = std::max(0, x - rect.width / 2);
int posY = y + distance;
if (posX + rect.width > mainGraphics->mWidth)
posX = mainGraphics->mWidth - rect.width;
if (posY + rect.height > mainGraphics->mHeight)
posY = y - rect.height - distance;
setPosition(posX, posY);
setVisible(true);
requestMoveToTop();
}
示例2: loadTemplateData
void CreatureImplementation::loadTemplateDataForBaby(CreatureTemplate* templateData) {
loadTemplateData(templateData);
setCustomObjectName(getDisplayedName() + " (baby)", false);
setHeight(templateData->getScale() * 0.46, false);
int newLevel = level / 10;
if (newLevel < 1)
newLevel = 1;
setLevel(newLevel, false);
setBaby(true);
clearPvpStatusBit(CreatureFlag::AGGRESSIVE, false);
clearPvpStatusBit(CreatureFlag::ENEMY, false);
setCreatureBitmask(getCreatureBitmask() + CreatureFlag::BABY);
}
示例3: initVertexBuffer
VOID JCDisplayObject::setTexture(IDirect3DTexture9* texture)
{
m_lpTexture = texture;
initVertexBuffer();
if(m_lpTexture != NULL)
{
D3DSURFACE_DESC dest;
m_lpTexture->GetLevelDesc(0, &dest);
m_widthOriginal = (FLOAT)dest.Width;
m_heightOriginal = (FLOAT)dest.Height;
}
else
{
m_widthOriginal = 0.0f;
m_heightOriginal = 0.0f;
setWidth(0.0f);
setHeight(0.0f);
}
}
示例4: clearList
void CurrentRecord::setRecord(QStringList header, QStringList record) {
clearList();
// Make listView generic control function.
QStandardItemModel *headModel = new QStandardItemModel(0);
for (int i = 0; i < header.size(); ++i) {
QStandardItem *item;
item = new QStandardItem(header.at(i));
headModel->appendRow(item);
}
ui->headerView->setModel(headModel);
ui->listWidget->insertItems(0,record);
ui->hbox->setAlignment(Qt::AlignLeft);
ui->vbox->setAlignment(Qt::AlignLeft);
setWidth(header,record);
setHeight(header.size(),record.size());
this->layout()->setAlignment(this,Qt::AlignLeft);
this->adjustSize();
}
示例5: ASSERT
void RenderReplaced::layout()
{
StackStats::LayoutCheckPoint layoutCheckPoint;
ASSERT(needsLayout());
LayoutRepainter repainter(*this, checkForRepaintDuringLayout());
setHeight(minimumReplacedHeight());
updateLogicalWidth();
updateLogicalHeight();
m_overflow.clear();
addVisualEffectOverflow();
updateLayerTransform();
repainter.repaintAfterLayout();
setNeedsLayout(false);
}
示例6: DocumentPage
void Document::init() {
if (m_doc) {
delete m_doc;
}
QList<BackendPage *> backends;
m_doc = m_loader->releaseBackend(backends);
if (!m_doc) {
return;
}
qreal width = 0;
qreal height = 0;
int pages = backends.size();
for (int x = 0; x < pages; x++) {
BackendPage *backend = backends[x];
DocumentPage *page = new DocumentPage(backend, x, QPointF(0, height), this);
m_pages << page;
QSizeF size = page->size();
qreal rectWidth = size.width();
qreal rectHeight = size.height();
width = qMax(width, rectWidth);
height += rectHeight;
}
backends.clear();
qDebug() << "width" << width << "height" << height;
setWidth(width);
setHeight(height);
setState(Document::Loaded);
stopLoader();
emit pageCountChanged();
}
示例7: terrain_file
void GeometryTerrain::loadHeightmapFromFile(const std::string& filename)
{
std::fstream terrain_file (filename.c_str(), std::ios::in | std::ios::binary);
data t_data;
for(int z = 0; z < GetLength(); z++)
{
for(int x = 0; x < GetWidth(); x++)
{
terrain_file.read((char*)&t_data, sizeof (data));
setHeight(x, z, t_data.height);
}
}
terrain_file.close();
m_pVertices = new flx_Vertex[m_nVertexCount];
m_pTexCoords = new flx_TexCoord[m_nVertexCount];
m_pNormals = new flx_Normal[m_nVertexCount];
for(int z = 0; z <= GetLength(); z++)
{
for(int x = 0; x <= GetWidth(); x++)
{
//fill Vertex array with data
m_pVertices[x + z * (GetWidth()+1)].x = (float)x;
m_pVertices[x + z * (GetWidth()+1)].y = getHeight(x, z);
m_pVertices[x + z * (GetWidth()+1)].z = (float)z;
//fill TexCoord array with data
m_pTexCoords[x + z * (GetWidth()+1)].u = (float)((float)x/(GetWidth()+1));
m_pTexCoords[x + z * (GetWidth()+1)].v = (float)((float)z/(GetWidth()+1));
}
}
//Let's compute the normals for each vertex
computeNormals();
buildPatches(1);
}
示例8: prepareGeometryChange
void TextLabel::calculateTextSize()
{
int tmp;
prepareGeometryChange();
QFontMetrics fm(font);
lineHeight = fm.height();
textSize.setWidth(0);
textSize.setHeight(lineHeight * value.count());
QStringList::Iterator it = value.begin();
while (it != value.end()) {
tmp = fm.width(*it);
if (tmp > textSize.width())
textSize.setWidth(tmp);
++it;
}
if ((getWidth() <= 0) || !m_sizeGiven) {
setWidth(textSize.width());
}
if ((getHeight() <= 0) || !m_sizeGiven) {
setHeight(textSize.height());
}
if (!m_sizeGiven) {
if (alignment == Qt::AlignLeft) {
setX(origPoint.x());
}
else if (alignment == Qt::AlignRight) {
setX(origPoint.x() - textSize.width());
}
else if (alignment == Qt::AlignHCenter) {
setX(origPoint.x() - textSize.width() / 2);
}
}
update();
}
示例9: UIElement
FindBar::FindBar() : UIElement() {
barBg = new UIRect(30,30);
barBg->setAnchorPoint(-1.0, -1.0, 0.0);
barBg->color.setColorHexFromString(CoreServices::getInstance()->getConfig()->getStringValue("Polycode", "uiHeaderBgColor"));
addChild(barBg);
setHeight(30);
UILabel *findLabel = new UILabel("FIND", 18, "section");
addChild(findLabel);
findLabel->setColor(1.0, 1.0, 1.0, 0.6);
findLabel->setPosition(10,3);
UILabel *replaceLabel = new UILabel("REPLACE", 18, "section");
addChild(replaceLabel);
replaceLabel->setColor(1.0, 1.0, 1.0, 0.6);
replaceLabel->setPosition(200,3);
processInputEvents = true;
findInput = new UITextInput(false, 120, 12);
addFocusChild(findInput);
findInput->setPosition(60, 4);
replaceInput = new UITextInput(false, 120, 12);
addFocusChild(replaceInput);
replaceInput->setPosition(280, 4);
replaceAllButton = new UIButton("Replace All", 100);
addFocusChild(replaceAllButton);
replaceAllButton->setPosition(420, 3);
UIImage *functionIcon = new UIImage("main/function_icon.png", 11, 17);
addChild(functionIcon);
functionIcon->setPosition(540, 6);
functionList = new UIComboBox(globalMenu, 200);
addChild(functionList);
functionList->setPosition(560, 4);
closeButton = new UIImageButton("main/barClose.png", 1.0, 17, 17);
addChild(closeButton);
}
示例10: clear
void Object::load(xml::Xml &xml)
{
clear();
/* Set attribute defaults */
xml.setDefaultString("");
xml.setDefaultInteger(0);
xml.setDefaultFloat(0);
/* Attributes ('type' is not forced to be set) */
if(xml.isInteger("x") && xml.isInteger("y"))
{
name = xml.getString("name");
type = xml.getString("type");
setX(xml.getInteger("x"));
setY(xml.getInteger("y"));
setWidth(xml.getInteger("width"));
setHeight(xml.getInteger("height"));
}
else
{
/* Throw */
throw Exception() << "Missing or wrong typed attribute";
}
/* Properties */
if(xml.toSubBlock("properties"))
{
try
{
properties.load(xml);
}
catch(Exception &exception)
{
xml.toBaseBlock();
throw Exception() << "Error whilst loading properties: " << exception.getDescription();
}
xml.toBaseBlock();
}
}
示例11: setX
Label::Label(string lText, int x_, int y_, int width_, int height_, const Font *font_, bool animation_, float animationSpeed_, int indent_, bool align_)
{
// Coords
setX(x_);
setY(y_);
// Width / Height
setWidth(width_);
setHeight(height_);
// Texts
setText(lText);
// Indent
setIndent(indent_);
// Animation
setAnimation(animation_);
// Invisible
setAnimatonValue(0.0f);
if(animation_)
{
// Speed
setAnimationSpeed(animationSpeed_);
}
else
{
// Speed
setAnimationSpeed(0.0f);
}
// Align
setAlign(align_);
// Font Id
font = (Font*)font_;
// Timer
animationTimer = new Timer(animationSpeed_);
}
示例12: term
pxError pxOffscreen::init(int32_t width, int32_t height)
{
term();
pxError e = PX_FAIL;
data = (char*) new unsigned char[width * height * 4];
if (data)
{
setBase(data);
setWidth(width);
setHeight(height);
setStride(width*4);
setUpsideDown(false);
e = PX_OK;
}
return e;
}
示例13: setY
void CComponentType::resize()
{
int attribsCount = this->getNoOfAttribs();
int newWidth = COMPONENTTYPE_WIDTH;
int newHeight = COMPONENTTYPE_HEIGHT;
if( attribsCount >= 1 )
{
newWidth++;
}
newHeight += (attribsCount+1)/2;
if( getHeight() < newHeight )
setY( getY()-1 );
else if( getHeight() > newHeight )
setY( getY()+1 );
setWidth( newWidth );
setHeight( newHeight );
}
示例14: setLeftTopX
/**
* Update the robot values from the blob
*
* @param b The blob to update our object from.
*/
void VisualRobot::updateRobot(Blob b)
{
setLeftTopX(b.getLeftTopX());
setLeftTopY(b.getLeftTopY());
setLeftBottomX(b.getLeftBottomX());
setLeftBottomY(b.getLeftBottomY());
setRightTopX(b.getRightTopX());
setRightTopY(b.getRightTopY());
setRightBottomX(b.getRightBottomX());
setRightBottomY(b.getRightBottomY());
setX(b.getLeftTopX());
setY(b.getLeftTopY());
setWidth(dist(b.getRightTopX(), b.getRightTopY(), b.getLeftTopX(),
b.getLeftTopY()));
setHeight(dist(b.getLeftTopX(), b.getLeftTopY(), b.getLeftBottomX(),
b.getLeftBottomY()));
setCenterX(getLeftTopX() + ROUND2(getWidth() / 2));
setCenterY(getRightTopY() + ROUND2(getHeight() / 2));
setDistance(1);
}
示例15: setWidth
void ImageItem::updateItemSize(DataSourceManager* dataManager, RenderPass pass, int maxHeight)
{
if (!m_datasource.isEmpty() && !m_field.isEmpty() && m_picture.isNull()){
IDataSource* ds = dataManager->dataSource(m_datasource);
if (ds) {
QVariant data = ds->data(m_field);
if (data.isValid()){
if (data.type()==QVariant::Image){
m_picture = data.value<QImage>();
} else
m_picture.loadFromData(data.toByteArray());
}
}
}
if (m_autoSize){
setWidth(m_picture.width());
setHeight(m_picture.height());
}
BaseDesignIntf::updateItemSize(dataManager, pass, maxHeight);
}