void InfoWidget::updateFieldLabel(IInfoWidget::InfoField AField) { switch (AField) { case AccountName: { QString name = field(AField).toString(); ui.lblAccount->setText(Qt::escape(name)); ui.lblAccount->setVisible(isFieldVisible(AField) && !name.isEmpty()); break; } case ContactName: { QString name = field(AField).toString(); IRosterItem ritem = FRoster ? FRoster->rosterItem(FContactJid) : IRosterItem(); if (isFiledAutoUpdated(AField) && ritem.name.isEmpty()) ui.lblName->setText(Qt::escape(FContactJid.full())); else ui.lblName->setText(QString("<big><b>%1</b></big> - %2").arg(Qt::escape(name)).arg(Qt::escape(FContactJid.full()))); ui.lblName->setVisible(isFieldVisible(AField)); break; } case ContactStatus: { QString status = field(AField).toString(); ui.lblStatus->setText(Qt::escape(status)); ui.lblStatus->setVisible(isFieldVisible(AField) && !status.isEmpty()); break; } case ContactAvatar: { if (ui.lblAvatar->movie()!=NULL) ui.lblAvatar->movie()->deleteLater(); QString fileName = field(AField).toString(); if (!fileName.isEmpty()) { QMovie *movie = new QMovie(fileName,QByteArray(),ui.lblAvatar); QSize size = QImageReader(fileName).size(); size.scale(QSize(32,32),Qt::KeepAspectRatio); movie->setScaledSize(size); ui.lblAvatar->setMovie(movie); movie->start(); } else { ui.lblAvatar->setMovie(NULL); } ui.lblAvatar->setVisible(isFieldVisible(AField) && !fileName.isEmpty()); break; } default: break; } }
void InfoWidget::setFieldVisible(IInfoWidget::InfoField AField, bool AVisible) { if (isFieldVisible(AField) != AVisible) { AVisible ? FVisibleFields |= AField : FVisibleFields &= ~AField; updateFieldLabel(AField); } }
void MailFieldsWidget::showBccControls(bool show) { /** Check if field placed at previous position is displayed, if not decrease position to avoid field order violation. */ int preferredPosition = 3; if(show) { if(isFieldVisible(TVisibleFields::FROM_FIELD) == false) --preferredPosition; if(isFieldVisible(TVisibleFields::CC_FIELD) == false) --preferredPosition; } showChildLayout(ui->bccLayout, show, preferredPosition, TVisibleFields::BCC_FIELDS); }
void QtRPT::fillListOfValue(QDomNode n) { //В качестве параметра подается нод бэнда QDomNode c = n.firstChild(); while(!c.isNull()) { QDomElement e = c.toElement(); // try to convert the node to an element. if ((!e.isNull()) && (e.tagName() == "TContainerField")) { if (isFieldVisible(e)) { if (e.attribute("type","label") == "label") { //NOT Proccess if field set as ImageField QString txt = sectionField(e.attribute("value"),false,true); } } } c = c.nextSibling(); } }
void Enemy::updateAction(Landscape* landscape, Point playerPosition) { _AStarFields.clear(); _AStarAimField = -1; _AStarBestField = -1; // reset all setAccelerating(false); setDecelerating(false); setAcceleratingLeft(false); setAcceleratingRight(false); setIncreasingElevation(false); setDecreasingElevation(false); setIncreasingAzimuth(false); setDecreasingAzimuth(false); setIncreasingPower(false); setDecreasingPower(false); setShootingMG(false); setShootingGrenade(false); // get surrounding of this enemy TerrainType** surroundings = landscape->getMap(_position, AI_VIEW_DISTANCE); // make sure Point.w is 1 for _position and playerPosition _position.x /= _position.w; _position.y /= _position.w; _position.z /= _position.w; _position.w = 1.0f; playerPosition.x /= playerPosition.w; playerPosition.y /= playerPosition.w; playerPosition.z /= playerPosition.w; playerPosition.w = 1.0f; // field of this enemy int x = (int)_position.x + FIELD_SIZE / 2; int z = (int)_position.z + FIELD_SIZE / 2; //// if this enemy is facing a building, just go backwards and do nothing else //TerrainType t11 = surroundings[AI_VIEW_DISTANCE + 1][AI_VIEW_DISTANCE]; //TerrainType t21 = surroundings[AI_VIEW_DISTANCE][AI_VIEW_DISTANCE - 1]; //TerrainType t31 = surroundings[AI_VIEW_DISTANCE - 1][AI_VIEW_DISTANCE]; //TerrainType t41 = surroundings[AI_VIEW_DISTANCE][AI_VIEW_DISTANCE + 1]; //TerrainType t12 = surroundings[AI_VIEW_DISTANCE + 2][AI_VIEW_DISTANCE]; //TerrainType t22 = surroundings[AI_VIEW_DISTANCE][AI_VIEW_DISTANCE - 2]; //TerrainType t32 = surroundings[AI_VIEW_DISTANCE - 2][AI_VIEW_DISTANCE]; //TerrainType t42 = surroundings[AI_VIEW_DISTANCE][AI_VIEW_DISTANCE + 2]; //if (_speed >= 0.0f && ((_angle < 45.0f || 315.0f <= _angle) && (surroundings[AI_VIEW_DISTANCE + 1][AI_VIEW_DISTANCE] == BUILDING || surroundings[AI_VIEW_DISTANCE + 2][AI_VIEW_DISTANCE] == BUILDING) // || 45.0f <= _angle && _angle < 135.0f && (surroundings[AI_VIEW_DISTANCE][AI_VIEW_DISTANCE - 1] == BUILDING || surroundings[AI_VIEW_DISTANCE][AI_VIEW_DISTANCE - 2] == BUILDING) // || 135.0f <= _angle && _angle < 225.0f && (surroundings[AI_VIEW_DISTANCE - 1][AI_VIEW_DISTANCE] == BUILDING || surroundings[AI_VIEW_DISTANCE - 2][AI_VIEW_DISTANCE] == BUILDING) // || 225.0f <= _angle && _angle < 315.0f && (surroundings[AI_VIEW_DISTANCE][AI_VIEW_DISTANCE + 1] == BUILDING || surroundings[AI_VIEW_DISTANCE][AI_VIEW_DISTANCE + 2] == BUILDING))) //{ // setDecelerating(true); // return; //} // field of player int x_player = (int)playerPosition.x + FIELD_SIZE / 2; int z_player = (int)playerPosition.z + FIELD_SIZE / 2; // calculate aim vector = vector from this enemy's position to player's position Vector3D aim = Vector3D(playerPosition.x - _position.x, 0.0f, playerPosition.z - _position.z); float aimAngle = TO_DEGREE(atan2f(-aim.z, aim.x)); if (aimAngle >= 360.0f) aimAngle -= 360.0f; else if (aimAngle < 0.0f) aimAngle += 360.0f; float aimDist = sqrtf(aim.x * aim.x + aim.z * aim.z); // find and store all fields in surrounding having a building (used for visibility check) IntVector buildingFieldsOfSurrounding; for (int ii = 0; ii < 2 * AI_VIEW_DISTANCE + 1; ii++) { for (int jj = 0; jj < 2 * AI_VIEW_DISTANCE + 1; jj++) { if (surroundings[ii][jj] == BUILDING) buildingFieldsOfSurrounding.push_back((z + jj - AI_VIEW_DISTANCE) * FIELD_SIZE + (x + ii - AI_VIEW_DISTANCE)); } } // check if player is within surrounding bool inSurrounding = x - AI_VIEW_DISTANCE <= x_player && x_player <= x + AI_VIEW_DISTANCE && z - AI_VIEW_DISTANCE <= z_player && z_player <= z + AI_VIEW_DISTANCE; bool visible = false; if (inSurrounding) { // PLAYER IS IN SURROUNDING // check if player is directly visible visible = isVisible(_position.x, _position.z, playerPosition.x, playerPosition.z, buildingFieldsOfSurrounding); if (visible) { // PLAYER IS DIRECTLY VISIBLE -> aim at player and shoot (do not drive) // aim at player if (_angle < aimAngle && aimAngle - _angle <= 180.0f || _angle > aimAngle && _angle - aimAngle > 180.0f) setAcceleratingLeft(true); else setAcceleratingRight(true); // shoot with machine gun setShootingMG(true); } // shoot grenade if player tank is near (or aim grenade launcher if not ready) if (aimDist <= AI_GRENADE_DIST && _hasGrenadeLauncherEnabled) { if (_firingStateGrenade == READY) setShootingGrenade(true); else { float totalAngle = _angle + _azimuth; if (totalAngle >= 360.0f) totalAngle -= 360.0f; else if (totalAngle < 0.0f) totalAngle += 360.0f; if (totalAngle < aimAngle && aimAngle - totalAngle <= 180.0f || totalAngle > aimAngle && totalAngle - aimAngle > 180.0f) setIncreasingAzimuth(true); else setDecreasingAzimuth(true); if (_elevation > 20.0f) setDecreasingElevation(true); } } } if (!inSurrounding || !visible) { // PLAYER IS OUTSIDE OF SURROUNDING OR NOT DIRECTLY VISIBLE -> try to get as near as possible to player (do not shoot) // find goal state ( = field within surroundings which is closest to player position) int i_goal = AI_VIEW_DISTANCE; int j_goal = AI_VIEW_DISTANCE; float d, min_dist = dist(x, z, playerPosition); for (int ii = 0; ii < 2 * AI_VIEW_DISTANCE + 1; ii++) { for (int jj = 0; jj < 2 * AI_VIEW_DISTANCE + 1; jj++) { if (surroundings[ii][jj] != BUILDING) { d = dist(x + ii - AI_VIEW_DISTANCE, z + jj - AI_VIEW_DISTANCE, playerPosition); if (d < min_dist) { min_dist = d; i_goal = ii; j_goal = jj; } } } } // variables needed in A* search Fringe fringe; unsigned int step = 0; AStarNode *node = new AStarNode(0.0f, aimDist, AI_VIEW_DISTANCE, AI_VIEW_DISTANCE, AI_VIEW_DISTANCE, AI_VIEW_DISTANCE, true, NULL); int i, j; bool fieldVisible; // add initial state to fringe fringe.push(node); // do actual A* search while (step < AI_MAX_STEPS && !fringe.empty()) { node = fringe.top(); fringe.pop(); i = node->i; j = node->j; if (DEBUG_ENEMY) _AStarFields.push_back((z + j - AI_VIEW_DISTANCE) * FIELD_SIZE + (x + i - AI_VIEW_DISTANCE)); // goal test (stop iteration when goal is reached) if (i == i_goal && j == j_goal) break; // expand node if (0 <= i - 1 && surroundings[i - 1][j] != BUILDING && !node->hasVisited(i - 1, j)) { if (node->isVisible) fieldVisible = isFieldVisible(_position.x, _position.z, i - 1, j, x, z, surroundings); else fieldVisible = false; //fringe.push(AStarNode(node.cost_so_far + 1.0f, dist(x + i - 1 - AI_VIEW_DISTANCE, z + j - AI_VIEW_DISTANCE, playerPosition), // i - 1, j, fieldVisible ? i - 1 : node.i_aim, fieldVisible ? j : node.j_aim, fieldVisible)); fringe.push(new AStarNode(fieldVisible ? dist(x + i - 1 - AI_VIEW_DISTANCE, z + j - AI_VIEW_DISTANCE, _position) : node->cost_so_far + 1.0f, dist(x + i - 1 - AI_VIEW_DISTANCE, z + j - AI_VIEW_DISTANCE, playerPosition), i - 1, j, fieldVisible ? i - 1 : node->i_aim, fieldVisible ? j : node->j_aim, fieldVisible, node)); } if (i + 1 < 2 * AI_VIEW_DISTANCE + 1 && surroundings[i + 1][j] != BUILDING && !node->hasVisited(i + 1, j)) { if (node->isVisible) fieldVisible = isFieldVisible(_position.x, _position.z, i + 1, j, x, z, surroundings); else fieldVisible = false; fringe.push(new AStarNode(fieldVisible ? dist(x + i + 1 - AI_VIEW_DISTANCE, z + j - AI_VIEW_DISTANCE, _position) : node->cost_so_far + 1.0f, dist(x + i + 1 - AI_VIEW_DISTANCE, z + j - AI_VIEW_DISTANCE, playerPosition), i + 1, j, fieldVisible ? i + 1 : node->i_aim, fieldVisible ? j : node->j_aim, fieldVisible, node)); } if (0 <= j - 1 && surroundings[i][j - 1] != BUILDING && !node->hasVisited(i, j - 1)) { if (node->isVisible) fieldVisible = isFieldVisible(_position.x, _position.z, i, j - 1, x, z, surroundings); else fieldVisible = false; fringe.push(new AStarNode(fieldVisible ? dist(x + i - AI_VIEW_DISTANCE, z + j - 1 - AI_VIEW_DISTANCE, _position) : node->cost_so_far + 1.0f, dist(x + i - AI_VIEW_DISTANCE, z + j - 1 - AI_VIEW_DISTANCE, playerPosition), i, j - 1, fieldVisible ? i : node->i_aim, fieldVisible ? j - 1 : node->j_aim, fieldVisible, node)); } if (j + 1 < 2 * AI_VIEW_DISTANCE + 1 && surroundings[i][j + 1] != BUILDING && !node->hasVisited(i, j + 1)) { if (node->isVisible) fieldVisible = isFieldVisible(_position.x, _position.z, i, j + 1, x, z, surroundings); else fieldVisible = false; fringe.push(new AStarNode(fieldVisible ? dist(x + i - AI_VIEW_DISTANCE, z + j + 1 - AI_VIEW_DISTANCE, _position) : node->cost_so_far + 1.0f, dist(x + i - AI_VIEW_DISTANCE, z + j + 1 - AI_VIEW_DISTANCE, playerPosition), i, j + 1, fieldVisible ? i : node->i_aim, fieldVisible ? j + 1 : node->j_aim, fieldVisible, node)); } step++; } if (DEBUG_ENEMY) { _AStarAimField = (z + node->j_aim - AI_VIEW_DISTANCE) * FIELD_SIZE + (x + node->i_aim - AI_VIEW_DISTANCE); _AStarBestField = (z + node->j - AI_VIEW_DISTANCE) * FIELD_SIZE + (x + node->i - AI_VIEW_DISTANCE); std::cout << step << std::endl; } // set new aim according to A* search (aim at farthest visible field in path to the chosen node) aim = Vector3D(x + node->i_aim - AI_VIEW_DISTANCE - FIELD_SIZE / 2 + 0.5f - _position.x, 0.0f, z + node->j_aim - AI_VIEW_DISTANCE - FIELD_SIZE / 2 + 0.5f - _position.z); aimAngle = TO_DEGREE(atan2f(-aim.z, aim.x)); if (aimAngle >= 360.0f) aimAngle -= 360.0f; else if (aimAngle < 0.0f) aimAngle += 360.0f; aimDist = sqrtf(aim.x * aim.x + aim.z * aim.z); // calculate angle difference alpha and steer in the desired direction to reach aim float alpha; if (_angle < aimAngle) { alpha = aimAngle - _angle; if (alpha <= 180.0f) setAcceleratingLeft(true); else { alpha = 360.0f - alpha; setAcceleratingRight(true); } } else { alpha = _angle - aimAngle; if (alpha <= 180.0f) setAcceleratingRight(true); else { alpha = 360.0f - alpha; setAcceleratingLeft(true); } } //// if this enemy is facing a building, go backwards, no matter where the aim is //if (/*_speed >= 0.0f &&*/ ((_angle < 45.0f || 315.0f <= _angle) && surroundings[AI_VIEW_DISTANCE + 1][AI_VIEW_DISTANCE] == BUILDING /*|| surroundings[AI_VIEW_DISTANCE + 2][AI_VIEW_DISTANCE] == BUILDING*/ // || 45.0f <= _angle && _angle < 135.0f && surroundings[AI_VIEW_DISTANCE][AI_VIEW_DISTANCE - 1] == BUILDING /*|| surroundings[AI_VIEW_DISTANCE][AI_VIEW_DISTANCE - 2] == BUILDING*/ // || 135.0f <= _angle && _angle < 225.0f && surroundings[AI_VIEW_DISTANCE - 1][AI_VIEW_DISTANCE] == BUILDING /*|| surroundings[AI_VIEW_DISTANCE - 2][AI_VIEW_DISTANCE] == BUILDING*/ // || 225.0f <= _angle && _angle < 315.0f && surroundings[AI_VIEW_DISTANCE][AI_VIEW_DISTANCE + 1] == BUILDING /*|| surroundings[AI_VIEW_DISTANCE][AI_VIEW_DISTANCE + 2] == BUILDING*/)) //{ // setDecelerating(true); //} //else //{ // else: using alpha, maximum turn speed and distance to aim to adapt speed to reach aim if (alpha != 0.0f) { float v_optimal = AI_SPEED_FACTOR * omega_max * aimDist / 2.0f / std::sin(TO_RADIAN(alpha) / 2.0f); if (_speed < v_optimal) setAccelerating(true); else setDecelerating(true); } else setAccelerating(true); //} // delete nodes while (!fringe.empty()) { delete fringe.top(); fringe.pop(); } } // if this enemy is facing a building, go backwards TerrainType t11 = surroundings[AI_VIEW_DISTANCE + 1][AI_VIEW_DISTANCE]; TerrainType t11l = surroundings[AI_VIEW_DISTANCE + 1][AI_VIEW_DISTANCE - 1]; TerrainType t11r = surroundings[AI_VIEW_DISTANCE + 1][AI_VIEW_DISTANCE + 1]; TerrainType t12 = surroundings[AI_VIEW_DISTANCE + 2][AI_VIEW_DISTANCE]; TerrainType t12l = surroundings[AI_VIEW_DISTANCE + 2][AI_VIEW_DISTANCE - 1]; TerrainType t12r = surroundings[AI_VIEW_DISTANCE + 2][AI_VIEW_DISTANCE + 1]; TerrainType t21 = surroundings[AI_VIEW_DISTANCE][AI_VIEW_DISTANCE - 1]; TerrainType t21l = surroundings[AI_VIEW_DISTANCE - 1][AI_VIEW_DISTANCE - 1]; TerrainType t21r = surroundings[AI_VIEW_DISTANCE + 1][AI_VIEW_DISTANCE - 1]; TerrainType t22 = surroundings[AI_VIEW_DISTANCE][AI_VIEW_DISTANCE - 2]; TerrainType t22l = surroundings[AI_VIEW_DISTANCE - 1][AI_VIEW_DISTANCE - 2]; TerrainType t22r = surroundings[AI_VIEW_DISTANCE + 1][AI_VIEW_DISTANCE - 2]; TerrainType t31 = surroundings[AI_VIEW_DISTANCE - 1][AI_VIEW_DISTANCE]; TerrainType t31l = surroundings[AI_VIEW_DISTANCE - 1][AI_VIEW_DISTANCE - 1]; TerrainType t31r = surroundings[AI_VIEW_DISTANCE - 1][AI_VIEW_DISTANCE + 1]; TerrainType t32 = surroundings[AI_VIEW_DISTANCE - 2][AI_VIEW_DISTANCE]; TerrainType t32l = surroundings[AI_VIEW_DISTANCE - 2][AI_VIEW_DISTANCE - 1]; TerrainType t32r = surroundings[AI_VIEW_DISTANCE - 2][AI_VIEW_DISTANCE + 1]; TerrainType t41 = surroundings[AI_VIEW_DISTANCE][AI_VIEW_DISTANCE + 1]; TerrainType t41l = surroundings[AI_VIEW_DISTANCE - 1][AI_VIEW_DISTANCE + 1]; TerrainType t41r = surroundings[AI_VIEW_DISTANCE + 1][AI_VIEW_DISTANCE + 1]; TerrainType t42 = surroundings[AI_VIEW_DISTANCE][AI_VIEW_DISTANCE + 2]; TerrainType t42l = surroundings[AI_VIEW_DISTANCE - 1][AI_VIEW_DISTANCE + 2]; TerrainType t42r = surroundings[AI_VIEW_DISTANCE + 1][AI_VIEW_DISTANCE + 2]; if (/*_speed >= 0.0f &&*/ ((_angle < 45.0f || 315.0f <= _angle) && (t11 == BUILDING /*|| t11l == BUILDING || t11r == BUILDING*/ || t12 == BUILDING /*|| t12l == BUILDING || t12r == BUILDING*/) || 45.0f <= _angle && _angle < 135.0f && (t21 == BUILDING /*|| t21l == BUILDING || t21r == BUILDING */|| t22 == BUILDING /*|| t22l == BUILDING || t22r == BUILDING*/) || 135.0f <= _angle && _angle < 225.0f && (t31 == BUILDING /*|| t31l == BUILDING || t31r == BUILDING */|| t32 == BUILDING /*|| t32l == BUILDING || t32r == BUILDING*/) || 225.0f <= _angle && _angle < 315.0f && (t41 == BUILDING /*|| t41l == BUILDING || t41r == BUILDING */|| t42 == BUILDING /*|| t42l == BUILDING || t42r == BUILDING*/))) { setAccelerating(false); setDecelerating(true); } // delete surroundings for (int s = 0; s < 2 * AI_VIEW_DISTANCE + 1; s++) delete[] surroundings[s]; delete[] surroundings; // random movement /*setAccelerating(rand()%2==0); setDecelerating(rand()%2==0); setAcceleratingLeft(rand()%2==0); setAcceleratingRight(rand()%5==0); setIncreasingElevation(rand()%2==0); setDecreasingElevation(rand()%2==0); setIncreasingAzimuth(rand()%2==0); setDecreasingAzimuth(rand()%2==0); setIncreasingPower(rand()%2==0); setDecreasingPower(rand()%2==0);*/ /*if(rand()%10==0) shoot();*/ }
void QtRPT::drawField(QDomNode n, int bandTop) { //В качестве параметра подается нод бэнда QDomNode c = n.firstChild(); while(!c.isNull()) { QDomElement e = c.toElement(); // try to convert the node to an element. if ((!e.isNull()) && (e.tagName() == "TContainerField")) { if (isFieldVisible(e)) { QFont font(e.attribute("fontFamily"),e.attribute("fontSize").toInt()); font.setBold(processHighligthing(e, FontBold).toInt()); font.setItalic(processHighligthing(e, FontItalic).toInt()); font.setUnderline(processHighligthing(e, FontUnderline).toInt()); painter.setFont(font); painter.setPen(Qt::black); int left_ = e.attribute("left").toInt()*koefRes_w; int top_ = (bandTop+e.attribute("top").toInt())*koefRes_h; int width_ = (e.attribute("width").toInt()-1)*koefRes_w;; int height_ = e.attribute("height").toInt()*koefRes_h; int cor = QFontMetrics(font).height() * koefRes_h; QRect textRect(left_, top_-height_, width_, height_); textRect.translate(0, cor ); QPen pen = painter.pen(); Qt::Alignment al; Qt::Alignment alH, alV; if (e.attribute("aligmentH") == "hRight") alH = Qt::AlignRight; if (e.attribute("aligmentH") == "hLeft") alH = Qt::AlignLeft; if (e.attribute("aligmentH") == "hCenter") alH = Qt::AlignHCenter; if (e.attribute("aligmentH") == "hJustify") alH = Qt::AlignJustify; if (e.attribute("aligmentV") == "vTop") alV = Qt::AlignTop; if (e.attribute("aligmentV") == "vBottom") alV = Qt::AlignBottom; if (e.attribute("aligmentV") == "vCenter") alV = Qt::AlignVCenter; al = alH | alV; if ( colorFromString(processHighligthing(e, BgColor).toString() ) != QColor(255,255,255,0)) painter.fillRect(left_+1,top_+1,width_-2,height_-2,colorFromString(processHighligthing(e, BgColor).toString())); /*if ( colorFromString(e.attribute("backgroundColor")) != QColor(255,255,255,0)) painter.fillRect(left_+1,top_+1,width_-2,height_-2,colorFromString(e.attribute("backgroundColor")));*/ //Set border width pen.setWidth(e.attribute("borderWidth","1").replace("px","").toInt()*5); //Set border style QString borderStyle = e.attribute("borderStyle","solid"); if (borderStyle == "dashed") pen.setStyle(Qt::DashLine); else if (borderStyle == "dotted") pen.setStyle(Qt::DotLine); else if (borderStyle == "dot-dash") pen.setStyle(Qt::DashDotLine); else if (borderStyle == "dot-dot-dash") pen.setStyle(Qt::DashDotDotLine); else pen.setStyle(Qt::SolidLine); if ( colorFromString(e.attribute("borderTop")) != QColor(255,255,255,0) ) { pen.setColor(colorFromString(e.attribute("borderTop"))); painter.setPen(pen); painter.drawLine(left_, top_, left_ + width_, top_); } if ( colorFromString(e.attribute("borderBottom")) != QColor(255,255,255,0) ) { pen.setColor(colorFromString(e.attribute("borderBottom"))); painter.setPen(pen); painter.drawLine(left_, top_ + height_, left_ + width_, top_ + height_); } if ( colorFromString(e.attribute("borderLeft")) != QColor(255,255,255,0) ) { pen.setColor(colorFromString(e.attribute("borderLeft"))); painter.setPen(pen); painter.drawLine(left_, top_, left_, top_ + height_); } if ( colorFromString(e.attribute("borderRight")) != QColor(255,255,255,0) ) { pen.setColor(colorFromString(e.attribute("borderRight"))); painter.setPen(pen); painter.drawLine(left_ + width_, top_, left_ + width_, top_ + height_); } if (e.attribute("type","label") == "label") { //NOT Proccess if field set as ImageField QString txt = sectionField(e.attribute("value"),false); //pen.setColor(colorFromString(e.attribute("fontColor"))); pen.setColor(colorFromString(processHighligthing(e, FontColor).toString())); painter.setPen(pen); painter.drawText(left_+10,top_,width_-10,height_, al | Qt::TextDontClip | Qt::TextWordWrap, txt); } if (e.attribute("type","label") == "labelImage") { //Proccess field as ImageField QImage image = sectionFieldImage(e.attribute("value")); if (!image.isNull()) { QRectF target(left_, top_, width_, height_); painter.drawImage(target,image); } } if (e.attribute("type","label") == "image") { //Proccess as static ImageField QByteArray byteArray; byteArray = QByteArray::fromBase64(e.attribute("picture","text").toLatin1()); QPixmap pixmap = QPixmap::fromImage(QImage::fromData(byteArray, "PNG")); painter.drawPixmap(left_,top_,width_,height_,pixmap); } } } c = c.nextSibling(); } }