本文整理汇总了C++中QRectF::setTopRight方法的典型用法代码示例。如果您正苦于以下问题:C++ QRectF::setTopRight方法的具体用法?C++ QRectF::setTopRight怎么用?C++ QRectF::setTopRight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QRectF
的用法示例。
在下文中一共展示了QRectF::setTopRight方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void WidgetStyle::WidgetScene::mouseMoveEvent(QGraphicsSceneMouseEvent* event)
{
if(m_mouseButton == Qt::LeftButton)
{
QRectF rect = m_rectItem->rect();
QPointF point = event->scenePos();
if(point.x() >= m_topLeftRect.x() && point.y() >= m_topLeftRect.y())
{
rect.setTopLeft(m_topLeftRect);
rect.setBottomRight(point);
}
else if(point.x() >= m_topLeftRect.x() && point.y() <= m_topLeftRect.y())
{
rect.setBottomLeft(m_topLeftRect);
rect.setTopRight(point);
}
else if(point.x() <= m_topLeftRect.x() && point.y() >= m_topLeftRect.y())
{
rect.setTopRight(m_topLeftRect);
rect.setBottomLeft(point);
}
else if(point.x() <= m_topLeftRect.x() && point.y() <= m_topLeftRect.y())
{
rect.setBottomRight(m_topLeftRect);
rect.setTopLeft(point);
}
m_rectItem->setRect(rect);
m_wgtStyle->distinguishRect(rect);
}
QGraphicsScene::mouseMoveEvent(event);
}
示例2: eraseRegionObjectGroup
void eraseRegionObjectGroup(MapDocument *mapDocument,
ObjectGroup *layer,
const QRegion &where)
{
QUndoStack *undo = mapDocument->undoStack();
const auto objects = layer->objects();
for (MapObject *obj : objects) {
// TODO: we are checking bounds, which is only correct for rectangles and
// tile objects. polygons and polylines are not covered correctly by this
// erase method (we are in fact deleting too many objects)
// TODO2: toAlignedRect may even break rects.
// Convert the boundary of the object into tile space
const QRectF objBounds = obj->boundsUseTile();
QPointF tl = mapDocument->renderer()->pixelToTileCoords(objBounds.topLeft());
QPointF tr = mapDocument->renderer()->pixelToTileCoords(objBounds.topRight());
QPointF br = mapDocument->renderer()->pixelToTileCoords(objBounds.bottomRight());
QPointF bl = mapDocument->renderer()->pixelToTileCoords(objBounds.bottomLeft());
QRectF objInTileSpace;
objInTileSpace.setTopLeft(tl);
objInTileSpace.setTopRight(tr);
objInTileSpace.setBottomRight(br);
objInTileSpace.setBottomLeft(bl);
const QRect objAlignedRect = objInTileSpace.toAlignedRect();
if (where.intersects(objAlignedRect))
undo->push(new RemoveMapObject(mapDocument, obj));
}
}
示例3: mapFromItem
void core::Connector::setEndObject(GraphicObject *end)
{
if(!end) return;
endObject = end;
// qDebug() << currentMousePos;
//we use currentMousePos instead internal currentMousePos from "end" object due update mouse position problems
//there are conflicts when moving mouse so using this currentMousePos ensures mouse pos is always updated
// qDebug() << portRect;
endPoint = mapFromItem(end, end->getCurrentPortPos(mapToItem(end, currentMousePos)));
isBuildingConector = false;
// qDebug() << portCenter;
QRectF container = getContainerRect();
if(currentMousePos.x() < 0 && currentMousePos.y() < 0){
container.setTopLeft(endPoint );
}else if(currentMousePos.x() < 0 && currentMousePos.y() >= 0){
container.setBottomLeft(endPoint );
}else if(currentMousePos.x() >= 0 && currentMousePos.y() < 0){
container.setTopRight(endPoint );
}else if(currentMousePos.x() >= 0 && currentMousePos.y() >= 0){
container.setBottomRight(endPoint );
}else{
container= QRectF(0, 0, 0, 0);
}
setContainerRect(container);
}
示例4: eventFilter
bool core::Connector::eventFilter(QObject *sender, QEvent *event)
{
// qDebug () << event->type();
if(event->type() == QEvent::MouseMove){
QMouseEvent *hEvent = (QMouseEvent*)event;
GraphicDetailedView *gdv = (GraphicDetailedView*)sender;
QPointF pos = mapFromScene(gdv->mapToScene(hEvent->pos()));
currentMousePos = pos;
// qDebug() << currentMousePos << "<< currentMousePos";
QRectF container = getContainerRect();
if(pos.x() < 0 && pos.y() < 0){
container.setTopLeft(pos);
container.setBottomRight(QPointF(0, 0));
}else if(pos.x() < 0 && pos.y() >= 0){
container.setBottomLeft(pos);
container.setTopRight(QPointF(0, 0));
}else if(pos.x() >= 0 && pos.y() < 0){
container.setTopRight(pos);
container.setBottomLeft(QPointF(0, 0));
}else if(pos.x() >= 0 && pos.y() >= 0){
container.setBottomRight(pos);
container.setTopLeft(QPointF(0, 0));
}else{
container= QRectF(0, 0, 0, 0);
}
setContainerRect(container);
if(isBuildingConector){
updateConectorLine(beginPoint, pos);
}
return true;
}
return GraphicObject::eventFilter(sender, event);
}
示例5: updateDragging
void PrintTool::updateDragging(MapCoordF mouse_pos_map)
{
QPointF delta = QPointF(mouse_pos_map - click_pos_map);
QRectF area = map_printer->getPrintArea();
switch (region)
{
case Inside:
area.moveTopLeft(area.topLeft() + delta);
break;
case LeftBorder:
area.setLeft(area.left() + delta.rx());
break;
case TopLeftCorner:
area.setTopLeft(area.topLeft() + delta);
break;
case TopBorder:
area.setTop(area.top() + delta.ry());
break;
case TopRightCorner:
area.setTopRight(area.topRight() + delta);
break;
case RightBorder:
area.setRight(area.right() + delta.rx());
break;
case BottomRightCorner:
area.setBottomRight(area.bottomRight() + delta);
break;
case BottomBorder:
area.setBottom(area.bottom() + delta.ry());
break;
case BottomLeftCorner:
area.setBottomLeft(area.bottomLeft() + delta);
break;
case Outside:
Q_ASSERT(false); // Handled outside.
case Unknown:
; // Nothing
}
if (area.left() < area.right() && area.top() < area.bottom())
{
map_printer->setPrintArea(area);
click_pos_map = mouse_pos_map;
}
}
示例6: mouseMoveEvent
void ResizingGrip::mouseMoveEvent(QGraphicsSceneMouseEvent* event)
{
// ==========================================================================================
// VERSION 1: Resize AreaItem and then move it to 0,0
// ==========================================================================================
QRectF resizableZone = _areaItem->getRect().translated(_areaItem->scenePos());
QPointF scenePos = event->scenePos();
switch(_position)
{
case TOPLEFT:
resizableZone.setTopLeft(scenePos);
break;
case TOPCENTER:
resizableZone.setTop(scenePos.y());
break;
case TOPRIGHT:
resizableZone.setTopRight(scenePos);
break;
case LEFTCENTER:
resizableZone.setLeft(scenePos.x());
break;
case RIGHTCENTER:
resizableZone.setRight(scenePos.x());
break;
case BOTTOMLEFT:
resizableZone.setBottomLeft(scenePos);
break;
case BOTTOMCENTER:
resizableZone.setBottom(scenePos.y());
break;
case BOTTOMRIGHT:
resizableZone.setBottomRight(scenePos);
break;
default:
Q_ASSERT(false);
}
//resizableZone.moveTopLeft(QPointF(0, 0));
_areaItem->updateMainDiagram(resizableZone);
event->accept();
}
示例7: mouseMoveEvent
//! Takes care of handle resizing on mouse move event.
void Painting::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
if(m_activeHandle == Caneda::NoHandle) {
GraphicsItem::mouseMoveEvent(event);
Q_ASSERT(scene()->mouseGrabberItem() == this);
return;
}
if(event->buttons().testFlag(Qt::LeftButton)) {
QRectF rect = m_paintingRect;
QPointF point = event->pos();
switch(m_activeHandle) {
case Caneda::TopLeftHandle:
rect.setTopLeft(point);
break;
case Caneda::TopRightHandle:
rect.setTopRight(point);
break;
case Caneda::BottomLeftHandle:
rect.setBottomLeft(point);
break;
case Caneda::BottomRightHandle:
rect.setBottomRight(point);
break;
case Caneda::NoHandle:
break;
}
setPaintingRect(rect);
}
}
示例8: mouseMoveEvent
void NodeElement::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
if (event->button() == Qt::RightButton) {
event->accept();
return;
}
// Folded elements can't be resized.
// So drag state isn't important.
if (mIsFolded) {
mDragState = None;
}
QRectF newContents = mContents;
QPointF newPos = mPos;
// expanding containers are turned off
// TODO: bring them back (but not their bugs =))
bool needResizeParent = false;
if (mDragState == None) {
if (!(flags() & ItemIsMovable)) {
return;
}
recalculateHighlightedNode(event->scenePos());
// it is needed for sendEvent() to every isSelected element thro scene
event->setPos(event->lastPos());
Element::mouseMoveEvent(event);
mGrid->mouseMoveEvent(event);
newPos = pos();
} else if (mElementImpl->isResizeable()) {
setVisibleEmbeddedLinkers(false);
needResizeParent = true;
QPointF parentPos = QPointF(0, 0);
QGraphicsItem *parItem = parentItem();
if (parItem) {
parentPos = parItem->scenePos();
}
qreal newX = event->pos().x();
qreal newY = event->pos().y();
switch (mDragState) {
case TopLeft: {
newContents.setTopLeft(event->pos() - event->lastPos());
newPos = event->scenePos() - parentPos;
break;
}
case Top: {
newContents.setTop(newY);
newPos = QPoint(pos().x(), event->scenePos().y() - parentPos.y());
break;
}
case TopRight: {
newContents.setTopRight(QPoint(newX, event->pos().y() - event->lastPos().y()));
newPos = QPoint(newPos.x(), event->scenePos().y() - parentPos.y());
break;
}
case Left: {
newContents.setLeft(newX);
newPos = QPoint(event->scenePos().x() - parentPos.x(), pos().y());
break;
}
case Right: {
newContents.setRight(newX);
break;
}
case BottomLeft: {
newContents.setBottomLeft(QPoint(event->pos().x() - event->lastPos().x(), newY));
newPos = QPoint(event->scenePos().x() - parentPos.x(), pos().y());
break;
}
case Bottom: {
newContents.setBottom(newY);
break;
}
case BottomRight: {
newContents.setBottomRight(QPoint(newX, newY));
break;
}
case None:
break;
}
if (event->modifiers() & Qt::ShiftModifier) {
const qreal size = qMax(newContents.width(), newContents.height());
newContents.setWidth(size);
newContents.setHeight(size);
}
}
resize(newContents, newPos, needResizeParent);
}
示例9: updateTopRight
void AbstractGraphicsRectItem::updateTopRight(const QPointF &newPos)
{
QRectF r = rect();
r.setTopRight(mapFromScene(newPos));
updateRect(r);
}
示例10: mouseMoveEvent
void OverlayEditorScene::mouseMoveEvent(QGraphicsSceneMouseEvent *e) {
QGraphicsScene::mouseMoveEvent(e);
if (e->isAccepted())
return;
if (qgpiSelected && (e->buttons() & Qt::LeftButton)) {
e->accept();
if (wfsHover == Qt::NoSection)
return;
QPointF delta = e->scenePos() - e->buttonDownScenePos(Qt::LeftButton);
bool square = e->modifiers() & Qt::ShiftModifier;
QRectF orig = selectedRect();
switch (wfsHover) {
case Qt::TitleBarArea:
orig.translate(delta);
break;
case Qt::TopSection:
orig.setTop(orig.top() + delta.y());
if (orig.height() < 8.0f)
orig.setTop(orig.bottom() - 8.0f);
if (square)
orig.setRight(orig.left() + orig.height());
break;
case Qt::BottomSection:
orig.setBottom(orig.bottom() + delta.y());
if (orig.height() < 8.0f)
orig.setBottom(orig.top() + 8.0f);
if (square)
orig.setRight(orig.left() + orig.height());
break;
case Qt::LeftSection:
orig.setLeft(orig.left() + delta.x());
if (orig.width() < 8.0f)
orig.setLeft(orig.right() - 8.0f);
if (square)
orig.setBottom(orig.top() + orig.width());
break;
case Qt::RightSection:
orig.setRight(orig.right() + delta.x());
if (orig.width() < 8.0f)
orig.setRight(orig.left() + 8.0f);
if (square)
orig.setBottom(orig.top() + orig.width());
break;
case Qt::TopLeftSection:
orig.setTopLeft(orig.topLeft() + delta);
if (orig.height() < 8.0f)
orig.setTop(orig.bottom() - 8.0f);
if (orig.width() < 8.0f)
orig.setLeft(orig.right() - 8.0f);
if (square) {
qreal size = qMin(orig.width(), orig.height());
QPointF sz(-size, -size);
orig.setTopLeft(orig.bottomRight() + sz);
}
break;
case Qt::TopRightSection:
orig.setTopRight(orig.topRight() + delta);
if (orig.height() < 8.0f)
orig.setTop(orig.bottom() - 8.0f);
if (orig.width() < 8.0f)
orig.setRight(orig.left() + 8.0f);
if (square) {
qreal size = qMin(orig.width(), orig.height());
QPointF sz(size, -size);
orig.setTopRight(orig.bottomLeft() + sz);
}
break;
case Qt::BottomLeftSection:
orig.setBottomLeft(orig.bottomLeft() + delta);
if (orig.height() < 8.0f)
orig.setBottom(orig.top() + 8.0f);
if (orig.width() < 8.0f)
orig.setLeft(orig.right() - 8.0f);
if (square) {
qreal size = qMin(orig.width(), orig.height());
QPointF sz(-size, size);
orig.setBottomLeft(orig.topRight() + sz);
}
break;
case Qt::BottomRightSection:
orig.setBottomRight(orig.bottomRight() + delta);
if (orig.height() < 8.0f)
orig.setBottom(orig.top() + 8.0f);
if (orig.width() < 8.0f)
orig.setRight(orig.left() + 8.0f);
if (square) {
qreal size = qMin(orig.width(), orig.height());
QPointF sz(size, size);
orig.setBottomRight(orig.topLeft() + sz);
}
break;
case Qt::NoSection:
// Handled above, but this makes the compiler happy.
return;
//.........这里部分代码省略.........
示例11: mouseMoveEvent
void Node::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
QPointF newPos(event->scenePos());
if (k->notChange) {
k->notChange = false;
} else {
if (k->action == Scale) {
QRectF rect = k->parent->sceneBoundingRect();
QRectF parentRect = k->parent->sceneBoundingRect();
QRectF parentSquare = k->parent->boundingRect();
// SQA: Lines for debugging purposes
/*
scene()->addRect(rect, QPen(Qt::red));
scene()->addRect(parentRect, QPen(Qt::green));
*/
switch (k->typeNode) {
case TopLeft:
{
k->manager->setAnchor(parentSquare.bottomRight());
rect.setTopLeft(newPos);
break;
}
case TopRight:
{
k->manager->setAnchor(parentSquare.bottomLeft());
rect.setTopRight(newPos);
break;
}
case BottomRight:
{
k->manager->setAnchor(parentSquare.topLeft());
rect.setBottomRight(newPos);
break;
}
case BottomLeft:
{
k->manager->setAnchor(parentSquare.topRight());
rect.setBottomLeft(newPos);
break;
}
case Center:
{
break;
}
};
float sx = 1, sy = 1;
sx = static_cast<float>(rect.width()) / static_cast<float>(parentRect.width());
sy = static_cast<float>(rect.height()) / static_cast<float>(parentRect.height());
if (k->manager->proportionalScale()) {
k->manager->scale(sx, sx);
} else {
if (sx > 0 && sy > 0) {
k->manager->scale(sx, sy);
} else {
if (sx > 0)
k->manager->scale(sx, 1);
if (sy > 0)
k->manager->scale(1, sy);
}
}
} else if (k->action == Rotate) {
QPointF p1 = newPos;
QPointF p2 = k->parent->sceneBoundingRect().center();
k->manager->setAnchor(k->parent->boundingRect().center());
double a = (180 * TupGraphicalAlgorithm::angleForPos(p1, p2)) / M_PI;
k->manager->rotate(a-45);
}
}
if (k->typeNode == Center) {
k->parent->moveBy(event->scenePos().x() - scenePos().x() , event->scenePos().y() - scenePos().y());
event->accept();
}
}
示例12: LoadData
void EnvRoomTemplate::LoadData(const QString & filename)
{
QFile file( filename );
if (!file.open( QIODevice::ReadOnly | QIODevice::Text )) {
return;
}
//set base path (for loading resources in same dir)
QTextStream ifs(&file);
//get num colliders
QStringList eachline = ifs.readLine().split(" ");
const int nColliders = eachline.last().toInt();
//read rectangular colliders
for (int i=0; i<nColliders; ++i) {
eachline = ifs.readLine().split(" ");
if (eachline[0].compare("CIRCLE") == 0) {
CircCollider c;
c.pos = QPointF(eachline[1].toFloat(), eachline[2].toFloat());
c.rad = eachline[3].toFloat();
if (eachline[4].compare("IN") == 0) {
c.rad -= 1.0f;
c.stay_inside = true;
}
else {
c.rad += 1.0f;
c.stay_inside = false;
}
circ_colliders.push_back(c);
}
else {
const float x1 = eachline[0].toFloat();
const float y1 = eachline[1].toFloat();
const float x2 = eachline[2].toFloat();
const float y2 = eachline[3].toFloat();
//NOTE: colliders are padded by 1 unit to enforce player's size and prevent viewplane clipping
QRectF c;
c.setBottomLeft(QPointF(qMin(x1, x2) - 1, qMin(y1, y2) - 1));
c.setTopRight(QPointF(qMax(x1, x2) + 1, qMax(y1, y2) + 1));
colliders.push_back(c);
}
}
//read mount points
eachline = ifs.readLine().split(" ");
const int nMounts = eachline.last().toInt();
for (int i=0; i<nMounts; ++i) {
eachline = ifs.readLine().split(" ");
const float px = eachline[0].toFloat();
const float py = eachline[1].toFloat();
const float pz = eachline[2].toFloat();
const float dx = eachline[3].toFloat();
const float dy = eachline[4].toFloat();
const float dz = eachline[5].toFloat();
mount_pts.push_back(QVector3D(px, py, pz));
mount_dirs.push_back(QVector3D(dx, dy, dz));
}
file.close();
}
示例13: slotMouseMove
//.........这里部分代码省略.........
else if(pos == KResizeFocus::NORTH_EAST)
{
QPointF topLeft = dashRect->rect().topLeft();
QPointF bottomRight = dashRect->rect().bottomRight();
qreal distx = Util::GetPointDistLine(oppositePos,topLeft,curPointItem);
qreal disty = Util::GetPointDistLine(oppositePos,bottomRight,curPointItem);
if (distx < 20 || flagx != flagx1)
{
if (flagx)
{
curPointItem.setX(oppositePos.x() + 20);
}
else
{
curPointItem.setX(oppositePos.x() - 20);
}
distx = 20;
}
if (disty < 20 || flagy != flagy1)
{
if (flagy)
{
curPointItem.setY(oppositePos.y() + 20);
}
else
{
curPointItem.setY(oppositePos.y() - 20);
}
disty = 20;
}
rectf.setTopRight(curPointItem);
}
else if(pos == KResizeFocus::SOUTH_EAST)
{
QPointF topRight = dashRect->rect().topRight();
QPointF bottomLeft = dashRect->rect().bottomLeft();
qreal disty = Util::GetPointDistLine(oppositePos,topRight,curPointItem);
qreal distx = Util::GetPointDistLine(oppositePos,bottomLeft,curPointItem);
if (distx < 20 || flagx != flagx1)
{
if (flagx)
{
curPointItem.setX(oppositePos.x() + 20);
}
else
{
curPointItem.setX(oppositePos.x() - 20);
}
distx = 20;
}
if (disty < 20 || flagy != flagy1)
{
if (flagy)
{
curPointItem.setY(oppositePos.y() + 20);
}
else
{
curPointItem.setY(oppositePos.y() - 20);
}
disty = 20;
示例14: qDebug
//.........这里部分代码省略.........
}
//TODO: this is sooooo lazy,
for(QVariant v:mLevelActorMapping){
QMap<QString,QVariant> tmp = v.toMap();
qDebug() << " Mapped LevelActorrr " << tmp;
mLevelActorMap.insert(tmp.firstKey(),tmp.first().toString());
}
Engine* engine = Engine::getInstance();
QQmlEngine* qmlEngine = engine->getQmlEngine();
// Check if bodies are referenced in the Actor Mapping Category
Body* b = nullptr;
std::string actorTypeString;
b2Body* body = mWorld->GetBodyList();
while(body){
actorTypeString = mBox2dJson.getCustomString(body,"actorType");
if(actorTypeString.empty() || actorTypeString == "none"){
b = Body::BodyFromb2Body(body);
if(b) b->setParent(this);
}else{
actorFromMapping(body,actorTypeString,qmlEngine);
}
body = body->GetNext();
}
// Use Nodes for parsing the specific type of node
//QList<LevelNode*> nodes = findChildren<LevelNode*>();
for(LevelNode* node: findChildren<LevelNode*>()) {
switch(node->type()) {
case LevelNode::BODY_REFERENCE:{
actorReferenceBody(node);
}break;
case LevelNode::ACTOR_COMPONENT_W_BODY:{
actorComponentWithBody(node,qmlEngine);
}break;
default:{
qDebug() << " unknown LevelNode type = " << node->type();
}
}
}
//check for images associated with the body.
int imageCount = 0;
body = nullptr;
b = nullptr;
QString image_path;
Actor* actor = nullptr;
ImageRenderer* img_renderer = nullptr;
std::vector<b2dJsonImage*> world_images;
imageCount = mBox2dJson.getAllImages(world_images);
for(b2dJsonImage* img: world_images)
{
if((body = img->body))
{
b = static_cast<Body*>(img->body->GetUserData());
if(b)
{
image_path = Util::getPathToLevel(QString::fromStdString(img->file));
actor = new Actor(b);
actor->setPosition(b->getPosition());
actor->setParent(this);
actor->setParentItem(this);
img_renderer = new ImageRenderer(actor);
img_renderer->setSource(image_path);
img_renderer->setSizeScale(img->scale);
img_renderer->setVisible(true);
img_renderer->setCacheRenderParams(body->GetType() == Body::StaticBody);
QRectF c;
c.setTopLeft(Box2dUtil::toQPointF(img->corners[0]));
c.setTopRight(Box2dUtil::toQPointF(img->corners[1]));
c.setBottomRight(Box2dUtil::toQPointF(img->corners[2]));
c.setBottomLeft(Box2dUtil::toQPointF(img->corners[3]));
img_renderer->setCustomLocalBox(c);
#ifdef D_PARSE
qDebug() << image_path << " box2d " << Box2dUtil::toQPointF(img->corners[0]);
qDebug() << image_path << " box2d " << Box2dUtil::toQPointF(img->corners[1]);
qDebug() << image_path << " box2d " << Box2dUtil::toQPointF(img->corners[2]);
qDebug() << image_path << " box2d " << Box2dUtil::toQPointF(img->corners[3]);
qDebug() << image_path << " render localbox " << c;
//TODO: fixe the scale ratio, to match box2d.
b2AABB aabb = img->getAABB();
qDebug() <<"Image aabb = " << Box2dUtil::toQRectF(aabb);
// img_renderer->setPosition(QPointF(img->center.x,img->center.y ));
qDebug() << "Image pos = " <<img_renderer->position();
#endif
}
}
}
}else{
qDebug() << "World null, Error Reading jsonfile: \n\t " << errorstring.c_str();
}
w = nullptr;
}
示例15: configureObject
void SchemaView::configureObject(void)
{
Schema *schema=dynamic_cast<Schema *>(this->getSourceObject());
this->fetchChildren();
/* Only configures the schema view if the rectangle is visible and there are
children objects. Otherwise the schema view is hidden */
if(schema->isRectVisible() && !children.isEmpty())
{
QColor color;
QRectF rect;
QFont font;
float sp_h=0, sp_v=0, txt_h=0;
float x1=1000000, y1=1000000, x2=-1000000, y2=-1000000, width=0;
QList<BaseObjectView *>::Iterator itr=children.begin();
//Configures the bounding rect based upon the children dimension
while(itr!=children.end())
{
rect.setTopLeft((*itr)->pos());
rect.setSize((*itr)->boundingRect().size());
if(rect.left() < x1)
x1 = rect.left();
if(rect.right() > x2)
x2 = rect.right();
if(rect.top() < y1)
y1 = rect.top();
if(rect.bottom() > y2)
y2 = rect.bottom();
itr++;
}
//Configures the schema name at the top
sch_name->setText(/*Utf8String::create(*/schema->getName());
font=BaseObjectView::getFontStyle(ParsersAttributes::GLOBAL).font();
font.setItalic(true);
font.setBold(true);
font.setPointSizeF(font.pointSizeF() * 1.3f);
sch_name->setFont(font);
sch_name->setPos(HORIZ_SPACING, VERT_SPACING);
txt_h=sch_name->boundingRect().height() + (2 * VERT_SPACING);
//Configures the box with the points calculated above
sp_h=(3 * HORIZ_SPACING);
sp_v=(3 * VERT_SPACING) + txt_h;
width=(x2-x1) + 1;
if(width < sch_name->boundingRect().width())
width=sch_name->boundingRect().width();
rect.setTopLeft(QPointF(-sp_h, 0));
rect.setTopRight(QPointF(width + sp_h, 0));
rect.setBottomRight(QPointF(width + sp_h, y2-y1 + sp_v));
rect.setBottomLeft(QPointF(-sp_h, y2-y1 + sp_v));
box->setRect(rect);
//Sets the schema view position
this->setFlag(ItemSendsGeometryChanges, false);
this->moveBy(-this->pos().x(),-this->pos().y());
this->setPos(QPointF(x1, y1 - txt_h));
schema->setPosition(this->mapToScene(rect.topLeft()));
this->setFlag(ItemSendsGeometryChanges, true);
color=schema->getFillColor();
color.setAlpha(80);
box->setBrush(color);
color=QColor(color.red()/3,color.green()/3,color.blue()/3, 80);
box->setPen(QPen(color, 1, Qt::DashLine));
this->bounding_rect=rect;
this->setVisible(true);
this->setToolTip(/*Utf8String::create(*/schema->getName(true) + QString(" (") + schema->getTypeName() + QString(")"));
sch_name->setToolTip(this->toolTip());
this->protected_icon->setPos(QPointF( sch_name->boundingRect().width() + sp_h,
sch_name->pos().y() + VERT_SPACING ));
this->configureObjectSelection();
this->configureProtectedIcon();
this->configurePositionInfo(this->pos());
this->configureSQLDisabledInfo();
}
else
this->setVisible(false);
}