• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ setHeight函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中setHeight函数的典型用法代码示例。如果您正苦于以下问题:C++ setHeight函数的具体用法?C++ setHeight怎么用?C++ setHeight使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了setHeight函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: ASSERT

void RenderReplaced::layout()
{
    StackStats::LayoutCheckPoint layoutCheckPoint;
    ASSERT(needsLayout());
    
    LayoutRepainter repainter(*this, checkForRepaintDuringLayout());
    
    setHeight(minimumReplacedHeight());

    updateLogicalWidth();
    updateLogicalHeight();

    clearOverflow();
    addVisualEffectOverflow();
    updateLayerTransform();
    invalidateBackgroundObscurationStatus();

    repainter.repaintAfterLayout();
    clearNeedsLayout();
}
开发者ID:ZeusbaseWeb,项目名称:webkit,代码行数:20,代码来源:RenderReplaced.cpp


示例17: Balance

AVL* Balance(AVL* root){
    if (root != NULL){
        if (getHeight(root->lchild) - 1 > getHeight(root->rchild)){
            if (getHeight(root->lchild->lchild) > getHeight(root->lchild->rchild)){
                root = LL_Rotate(root);
            } else {
                root = LR_Rotate(root);
            }
        } else if (getHeight(root->rchild) - 1 > getHeight(root->lchild)){
            if (getHeight(root->rchild->rchild) > getHeight(root->rchild->lchild)){
                root = RR_Rotate(root);
            } else {
                root = RL_Rotate(root);
            }
        } else {
        root->height = setHeight(root); 
        }
    }
    return root;
}
开发者ID:Davidlx,项目名称:Learn-Algorithm,代码行数:20,代码来源:la-1-2.c


示例18: setX

PainterBezier::PainterBezier(QQuickItem  *parent)
:QQuickPaintedItem (parent)
,m_p1(QPointF(0.f,0.f))
,m_p2(QPointF(0.f,0.f))
,m_p3(QPointF(0.f,0.f))
,m_p4(QPointF(0.f,0.f))
,m_OutlineColor(Qt::black)
,m_FillColor(QColor(177,189,180))
,m_OutlineWidth(1.f)
,m_FillWidth(3.f)
{
    setX(0);
    setY(0);
    setWidth(1);
    setHeight(1);
    setFlag(ItemHasContents, true);
    //setAntialiasing(true);
    setRenderTarget(QQuickPaintedItem::FramebufferObject);
    setSmooth(true);
}
开发者ID:cadet,项目名称:UberQuick,代码行数:20,代码来源:PainterBezier.cpp


示例19: setWidth

void FlowContainer::widgetResized(const gcn::Event &event)
{
    if (getWidth() < mBoxWidth)
    {
        setWidth(mBoxWidth);
        return;
    }

    int itemCount = mWidgets.size();

    mGridWidth = getWidth() / mBoxWidth;

    if (mGridWidth < 1)
        mGridWidth = 1;

    mGridHeight = itemCount / mGridWidth;

    if (itemCount % mGridWidth != 0 || mGridHeight < 1)
        ++mGridHeight;

    int height = mGridHeight * mBoxHeight;

    if (getHeight() != height)
    {
        setHeight(height);
        return;
    }

    int i = 0;
    height = 0;
    for (WidgetList::iterator it = mWidgets.begin(); it != mWidgets.end(); it++)
    {
        int x = i % mGridWidth * mBoxWidth;
        (*it)->setPosition(x, height);

        i++;

        if (i % mGridWidth == 0)
            height += mBoxHeight;
    }
}
开发者ID:mekolat,项目名称:elektrogamesvn,代码行数:41,代码来源:flowcontainer.cpp


示例20: Q_UNUSED

void TableRowElement::layout( const AttributeManager* am )
{
    Q_UNUSED( am )
    // Get the parent table to query width/ height values
    TableElement* parentTable = static_cast<TableElement*>( parentElement() );
    setHeight( parentTable->rowHeight( this ) );

    // Get alignment for every table data
    QList<Align> verticalAlign = alignments( Qt::Vertical );
    QList<Align> horizontalAlign = alignments( Qt::Horizontal );

    // align the row's entries
    QPointF origin;
    qreal hOffset = 0.0;
    for ( int i = 0; i < m_data.count(); i++ ) {
//         origin = QPointF();
        hOffset = 0.0;
        if( verticalAlign[ i ] == Bottom )
            origin.setY( height() - m_data[ i ]->height() );
        else if( verticalAlign[ i ] == Center || verticalAlign[ i ] == BaseLine )
            origin.setY( ( height() - m_data[ i ]->height() ) / 2 );
            // Baseline is treated like Center for the moment until someone also refines
            // TableElement::determineDimensions so that it pays attention to baseline.
            // Axis as alignment option is ignored as it is tought to be an option for
            // the table itsself.
//         kDebug() << horizontalAlign[ i ]<<","<<Axis;
        if( horizontalAlign[ i ] == Center ) {
            hOffset = ( parentTable->columnWidth( i ) - m_data[ i ]->width() ) / 2;
        }
        else if( horizontalAlign[ i ] == Right ) {
            hOffset = parentTable->columnWidth( i ) - m_data[ i ]->width();
        }

        m_data[ i ]->setOrigin( origin + QPointF( hOffset, 0.0 ) );
        origin += QPointF( parentTable->columnWidth( i ), 0.0 );
    }

    setWidth( origin.x() );
    // setting of the baseline should not be needed as the table row will only occur
    // inside a table where it does not matter if a table row has a baseline or not
}
开发者ID:KDE,项目名称:calligra-history,代码行数:41,代码来源:TableRowElement.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ setHelp函数代码示例发布时间:2022-05-30
下一篇:
C++ setHeaderHidden函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap