当前位置: 首页>>代码示例>>C++>>正文


C++ setHeight函数代码示例

本文整理汇总了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();
}
开发者ID:KaneHart,项目名称:Elmlor-Client,代码行数:43,代码来源:textpopup.cpp

示例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);
}
开发者ID:Chilastra-Reborn,项目名称:Chilastra-source-code,代码行数:19,代码来源:CreatureImplementation.cpp

示例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);
	}
}
开发者ID:chengkehan,项目名称:lab,代码行数:19,代码来源:JCDisplayObject.cpp

示例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();
}
开发者ID:CCi-BClark,项目名称:NERD,代码行数:19,代码来源:currentrecord.cpp

示例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);
}
开发者ID:fatman2021,项目名称:webkitgtk,代码行数:19,代码来源:RenderReplaced.cpp

示例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();
}
开发者ID:deztructor,项目名称:harbour-documents,代码行数:43,代码来源:document.cpp

示例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);
}
开发者ID:grimtraveller,项目名称:fluxengine,代码行数:42,代码来源:flx_geometry_terrain.cpp

示例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();
}
开发者ID:KDE,项目名称:superkaramba,代码行数:42,代码来源:textlabel.cpp

示例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);
}
开发者ID:carlosmarti,项目名称:Polycode,代码行数:42,代码来源:PolycodeTextEditor.cpp

示例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();
      }
  }
开发者ID:mrzzzrm,项目名称:shootet,代码行数:42,代码来源:Object.cpp

示例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_);
}
开发者ID:CoolONEOfficial,项目名称:Character-Quest,代码行数:42,代码来源:label.cpp

示例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;
}
开发者ID:madanagopalt,项目名称:pxCore,代码行数:20,代码来源:pxOffscreenNative.cpp

示例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 ); 
}
开发者ID:dapel,项目名称:AbstractSwarm,代码行数:20,代码来源:ComponentType.cpp

示例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);
}
开发者ID:WangHanbin,项目名称:nbites,代码行数:25,代码来源:VisualRobot.cpp

示例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);
}
开发者ID:BigLeb32,项目名称:diplomprog,代码行数:20,代码来源:lrimageitem.cpp


注:本文中的setHeight函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。