本文整理汇总了C++中setZValue函数的典型用法代码示例。如果您正苦于以下问题:C++ setZValue函数的具体用法?C++ setZValue怎么用?C++ setZValue使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setZValue函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AbstractConfig_TYPE
AbstractConfig::AbstractConfig(AbstractContent * content, AbstractConfig_PARENT * parent)
: AbstractConfig_TYPE(parent)
, m_content(content)
, m_commonUi(new Ui::AbstractConfig())
#if !defined(MOBILE_UI)
, m_closeButton(0)
, m_okButton(0)
#endif
, m_frame(FrameFactory::defaultPanelFrame())
{
#if !defined(MOBILE_UI)
// close button
m_closeButton = new StyledButtonItem(tr(" x "), font(), this);//this, ":/data/button-close.png", ":/data/button-close-hovered.png", ":/data/button-close-pressed.png");
connect(m_closeButton, SIGNAL(clicked()), this, SIGNAL(requestClose()));
// WIDGET setup (populate contents and set base palette (only) to transparent)
QWidget * widget = new QWidget();
m_commonUi->setupUi(widget);
QPalette pal;
QColor oldColor = pal.window().color();
pal.setBrush(QPalette::Window, Qt::transparent);
widget->setPalette(pal);
pal.setBrush(QPalette::Window, oldColor);
m_commonUi->tab->setPalette(pal);
#else
m_commonUi->setupUi(this);
#endif
populateFrameList();
// select the frame
quint32 frameClass = m_content->frameClass();
if (frameClass != Frame::NoFrame) {
for (int i = 0; i < m_commonUi->framesList->count(); ++i) {
QListWidgetItem * item = m_commonUi->framesList->item(i);
if (item->data(Qt::UserRole).toUInt() == frameClass) {
item->setSelected(true);
break;
}
}
}
// read other properties
m_commonUi->reflection->setChecked(m_content->mirrored());
m_commonUi->contentLocked->setChecked(m_content->locked());
m_commonUi->fixedPosition->setChecked(m_content->fixedPosition());
m_commonUi->fixedRotation->setChecked(m_content->fixedRotation());
m_commonUi->fixedPerspective->setChecked(m_content->fixedPerspective());
connect(m_commonUi->front, SIGNAL(clicked()), m_content, SLOT(slotStackFront()));
connect(m_commonUi->raise, SIGNAL(clicked()), m_content, SLOT(slotStackRaise()));
connect(m_commonUi->lower, SIGNAL(clicked()), m_content, SLOT(slotStackLower()));
connect(m_commonUi->back, SIGNAL(clicked()), m_content, SLOT(slotStackBack()));
connect(m_commonUi->save, SIGNAL(clicked()), m_content, SLOT(slotSaveAs()));
connect(m_commonUi->background, SIGNAL(clicked()), m_content, SIGNAL(requestBackgrounding()));
connect(m_commonUi->del, SIGNAL(clicked()), m_content, SIGNAL(requestRemoval()));
connect(m_commonUi->contentLocked, SIGNAL(stateChanged(int)), m_content, SLOT(slotSetLocked(int)));
connect(m_commonUi->fixedPosition, SIGNAL(stateChanged(int)), m_content, SLOT(slotSetFixedPosition(int)));
connect(m_commonUi->fixedRotation, SIGNAL(stateChanged(int)), m_content, SLOT(slotSetFixedRotation(int)));
connect(m_commonUi->fixedPerspective, SIGNAL(stateChanged(int)), m_content, SLOT(slotSetFixedPerspective(int)));
connect(m_commonUi->newFrame, SIGNAL(clicked()), this, SLOT(slotAddFrame()));
connect(m_commonUi->removeFrame, SIGNAL(clicked()), this, SLOT(slotRemoveFrame()));
connect(m_commonUi->lookApplyAll, SIGNAL(clicked()), this, SLOT(slotLookApplyAll()));
connect(m_commonUi->framesList, SIGNAL(itemSelectionChanged()), this, SLOT(slotFrameSelectionChanged()));
connect(m_commonUi->reflection, SIGNAL(toggled(bool)), this, SLOT(slotReflectionToggled(bool)));
// ITEM setup
#if !defined(MOBILE_UI)
setFlag(QGraphicsItem::ItemIgnoresTransformations, true);
setWidget(widget);
static qreal s_propZBase = 99999;
setZValue(s_propZBase++);
#endif
#if !defined(MOBILE_UI) && QT_VERSION >= 0x040600
// fade in animation
QPropertyAnimation * ani = new QPropertyAnimation(this, "opacity");
ani->setEasingCurve(QEasingCurve::OutCubic);
ani->setDuration(400);
ani->setStartValue(0.0);
ani->setEndValue(1.0);
ani->start(QPropertyAnimation::DeleteWhenStopped);
#endif
}
示例2: vaunu_
Akseli::Akseli(Vaunu *vaunu) :
vaunu_(vaunu), toinenAkseli_(0), kytkettyAkseli_(0),
kiskolla_(0), sijaintiKiskolla_(0), suuntaKiskolla_(RaiteenPaa::Virhe)
{
setZValue(200); // debug: jotta nähdään missä akseli on...
}
示例3: calcEndPoint
void RelationItem::update(const Style *style)
{
QPointF endBPos = calcEndPoint(m_relation->endBUid(), m_relation->endAUid(), m_relation->intermediatePoints().size() - 1);
QPointF endAPos = calcEndPoint(m_relation->endAUid(), endBPos, 0);
setPos(endAPos);
QList<QPointF> points;
points << (endAPos - endAPos);
foreach (const DRelation::IntermediatePoint &point, m_relation->intermediatePoints()) {
points << (point.pos() - endAPos);
}
points << (endBPos - endAPos);
ArrowConfigurator visitor(m_diagramSceneModel, m_arrow, points);
m_relation->accept(&visitor);
m_arrow->update(style);
if (!m_relation->name().isEmpty()) {
if (!m_name) {
m_name = new QGraphicsSimpleTextItem(this);
}
m_name->setFont(style->smallFont());
m_name->setBrush(style->textBrush());
m_name->setText(m_relation->name());
m_name->setPos(m_arrow->calcPointAtPercent(0.5) + QPointF(-m_name->boundingRect().width() * 0.5, 4.0));
} else if (m_name) {
m_name->scene()->removeItem(m_name);
delete m_name;
m_name = 0;
}
if (!m_relation->stereotypes().isEmpty()) {
if (!m_stereotypes) {
m_stereotypes = new StereotypesItem(this);
}
m_stereotypes->setFont(style->smallFont());
m_stereotypes->setBrush(style->textBrush());
m_stereotypes->setStereotypes(m_relation->stereotypes());
m_stereotypes->setPos(m_arrow->calcPointAtPercent(0.5) + QPointF(-m_stereotypes->boundingRect().width() * 0.5, -m_stereotypes->boundingRect().height() - 4.0));
} else if (m_stereotypes) {
m_stereotypes->scene()->removeItem(m_stereotypes);
delete m_stereotypes;
m_stereotypes = 0;
}
if (isSelected() || isSecondarySelected()) {
if (!m_selectionHandles) {
m_selectionHandles = new PathSelectionItem(this, this);
}
m_selectionHandles->setPoints(points);
m_selectionHandles->setSecondarySelected(isSelected() ? false : isSecondarySelected());
} else if (m_selectionHandles) {
if (m_selectionHandles->scene()) {
m_selectionHandles->scene()->removeItem(m_selectionHandles);
}
delete m_selectionHandles;
m_selectionHandles = 0;
}
setZValue((isSelected() || isSecondarySelected()) ? RELATION_ITEMS_ZVALUE_SELECTED : RELATION_ITEMS_ZVALUE);
}
示例4: setZValue
void ContentWindowGraphicsItem::setZToFront()
{
zCounter_ = zCounter_ + 1;
setZValue(zCounter_);
}
示例5: setZValue
void AbstractCardItem::setRealZValue(qreal _zValue)
{
realZValue = _zValue;
setZValue(_zValue);
}
示例6: QgsMapCanvasItem
QgsMapCanvasMap::QgsMapCanvasMap( QgsMapCanvas* canvas )
: QgsMapCanvasItem( canvas )
{
setZValue( -10 );
}
示例7: UMLWidget
/**
* Constructs a NodeWidget.
*
* @param scene The parent of this NodeWidget.
* @param n The UMLNode this will be representing.
*/
NodeWidget::NodeWidget(UMLScene * scene, UMLNode *n)
: UMLWidget(scene, WidgetBase::wt_Node, n)
{
setSize(100, 30);
setZValue(1); // above box but below UMLWidget because may embed widgets
}
示例8: setZValue
SceneWidgetCloseButton::SceneWidgetCloseButton()
{
setZValue(zValue()+0.5);
setFlag(ItemIsSelectable, false);
}
示例9: parseAreaElement
GraphicsMidiInputItem::GraphicsMidiInputItem(QDomElement controlNode, const PixmapMap& pixmapMap)
{
// map a midi message to a
m_inputMidiMessages.append(MidiMessage(controlNode));
m_name = controlNode.attribute(CONTROL_NAME, "");
m_groupName = controlNode.attribute(CONTROL_GROUP, "");
QString debugColor = controlNode.attribute("debug");
GraphicsMidiArea area = parseAreaElement(controlNode);
if (area.isNull())
return;
QString mask = parsePixmapMask(controlNode);
setSceneRect(area.rect);
bool hasRanged = false;
// get states
QDomElement stateNode = controlNode.firstChildElement("state");
int rangeMarker;
QPixmap backgroundPixmap = pixmapFromMap(GuiUtils::background, m_sceneRect, pixmapMap, mask);
ushort minRangeId, maxRangeId;
while (!stateNode.isNull())
{
QString state = stateNode.text();
QString stateValue = stateNode.attribute("value").trimmed();
// map range to m_state2Pixmap
rangeMarker = stateValue.indexOf(INPUT_STATE_RANGEMARKER);
if (rangeMarker > 0)
{
hasRanged = true;
bool ok = false;
//qDebug() << state << stateValue << rangeMarker << stateValue.left(rangeMarker) << stateValue.mid(rangeMarker + 1);
minRangeId = stateValue.left(rangeMarker).toUShort(&ok, 0);
if (ok)
maxRangeId = stateValue.mid(rangeMarker + 1).toUShort(&ok, 0);
if (!ok)
{
qCritical() << "error parsing:" << stateValue << "; line:" << stateNode.lineNumber();
return;
}
QPixmap pixmap = pixmapFromState(stateNode, backgroundPixmap, m_sceneRect, pixmapMap, mask);
if (!pixmap.isNull())
{
checkDebug(debugColor, pixmap, area);
// map range to m_state2Pixmap
m_state2Pixmap.insert(maxRangeId, pixmap);
m_range2State.insert(minRangeId, maxRangeId); // add ranged value
}
}
else
{
bool ok = false;
ushort stateId = stateValue.toUShort(&ok, 0);
if (pixmapMap.contains(state) && ok)
{
// QPixmap pixmap = pixmapMap.value(state).copy(rect);
QPixmap pixmap = pixmapFromState(stateNode, backgroundPixmap, m_sceneRect, pixmapMap, mask);
checkDebug(debugColor, pixmap, area);
m_state2Pixmap.insert(stateId, pixmap);
m_range2State.insert(stateId, stateId); // support for ranged values
if (GuiUtils::isBackground(state))
{
m_offState = stateId;
setPixmap(pixmap);
}
}
}
stateNode = stateNode.nextSiblingElement("state");
}
if (!hasRanged)
m_range2State.clear(); // no ranged values after all...
/* QPixmap pixmap = pixmapMap[GuiUtils::background];
if (0) {
setPixmap(pixmap.copy(rect));
} else {
QPixmap tmp = pixmap.copy(rect);
QPainter dc(&tmp);
dc.setPen(Qt::green);
dc.drawRect(0,0,rect.width()-1, rect.height()-1);
setPixmap(tmp);
}
*/
setPos(m_sceneRect.topLeft());
setZValue(2);
m_hasInput = true;
}
示例10: setZValue
//virtual
QVariant AbstractGroupItem::itemChange(GraphicsItemChange change, const QVariant &value)
{
if (change == QGraphicsItem::ItemSelectedChange) {
if (value.toBool()) setZValue(3);
else setZValue(1);
}
CustomTrackScene *scene = NULL;
if (change == ItemPositionChange && parentItem() == 0) {
scene = projectScene();
}
if (scene) {
// calculate new position.
if (scene->isZooming) {
// For some reason, mouse wheel on selected itm sometimes triggered
// a position change event corrupting timeline, so discard it
return pos();
}
// calculate new position.
const int trackHeight = KdenliveSettings::trackheight();
QPointF start = sceneBoundingRect().topLeft();
QPointF newPos = value.toPointF();
int xpos = projectScene()->getSnapPointForPos((int)(start.x() + newPos.x() - pos().x()), KdenliveSettings::snaptopoints());
xpos = qMax(xpos, 0);
////qDebug()<<"GRP XPOS:"<<xpos<<", START:"<<start.x()<<",NEW:"<<newPos.x()<<"; SCENE:"<<scenePos().x()<<",POS:"<<pos().x();
newPos.setX((int)(pos().x() + xpos - (int) start.x()));
QStringList lockedTracks = property("locked_tracks").toStringList();
int proposedTrack = trackForPos(property("y_absolute").toInt() + newPos.y());
// Check if top item is a clip or a transition
int offset = 0;
int topTrack = -1;
QList<int> groupTracks;
QList<QGraphicsItem *> children = childItems();
for (int i = 0; i < children.count(); ++i) {
int currentTrack = 0;
if (children.at(i)->type() == AVWidget || children.at(i)->type() == TransitionWidget) {
currentTrack = static_cast <AbstractClipItem*> (children.at(i))->track();
if (!groupTracks.contains(currentTrack)) groupTracks.append(currentTrack);
}
else if (children.at(i)->type() == GroupWidget) {
currentTrack = static_cast <AbstractGroupItem*> (children.at(i))->track();
}
else continue;
if (children.at(i)->type() == AVWidget) {
if (topTrack == -1 || currentTrack >= topTrack) {
offset = 0;
topTrack = currentTrack;
}
} else if (children.at(i)->type() == TransitionWidget) {
if (topTrack == -1 || currentTrack > topTrack) {
offset = (int)(trackHeight / 3 * 2 - 1);
topTrack = currentTrack;
}
} else if (children.at(i)->type() == GroupWidget) {
QList<QGraphicsItem *> subchildren = children.at(i)->childItems();
bool clipGroup = false;
for (int j = 0; j < subchildren.count(); ++j) {
if (subchildren.at(j)->type() == AVWidget || subchildren.at(j)->type() == TransitionWidget) {
int subTrack = static_cast <AbstractClipItem*> (subchildren.at(j))->track();
if (!groupTracks.contains(subTrack)) groupTracks.append(subTrack);
clipGroup = true;
}
}
if (clipGroup) {
if (topTrack == -1 || currentTrack >= topTrack) {
offset = 0;
topTrack = currentTrack;
}
} else {
if (topTrack == -1 || currentTrack > topTrack) {
offset = (int)(trackHeight / 3 * 2 - 1);
topTrack = currentTrack;
}
}
}
}
// Check no clip in the group goes outside of existing tracks
int maximumTrack = projectScene()->tracksCount();
int groupHeight = 0;
for (int i = 0; i < groupTracks.count(); ++i) {
int offset = groupTracks.at(i) - topTrack;
if (offset > groupHeight) groupHeight = offset;
}
maximumTrack -= groupHeight;
proposedTrack = qMin(proposedTrack, maximumTrack);
proposedTrack = qMax(proposedTrack, groupTracks.count());
int groupOffset = proposedTrack - topTrack;
if (!lockedTracks.isEmpty()) {
for (int i = 0; i < groupTracks.count(); ++i) {
if (lockedTracks.contains(QString::number(groupTracks.at(i) + groupOffset))) {
return pos();
}
}
}
newPos.setY(posForTrack(proposedTrack) + offset);
//if (newPos == start) return start;
//.........这里部分代码省略.........
示例11: boundingRect
void
GraphicsMovieItem::paintRect( QPainter* painter, const QStyleOptionGraphicsItem* option )
{
QRectF drawRect;
bool drawRound;
// Disable the matrix transformations
painter->setWorldMatrixEnabled( false );
painter->setRenderHint( QPainter::Antialiasing );
// Get the transformations required to map the text on the viewport
QTransform viewPortTransform = Timeline::getInstance()->tracksView()->viewportTransform();
// Determine if a drawing optimization can be used
if ( option->exposedRect.left() > AbstractGraphicsItem::RounderRectRadius &&
option->exposedRect.right() < boundingRect().right() - AbstractGraphicsItem::RounderRectRadius )
{
// Optimized: paint only the exposed (horizontal) area
drawRect = QRectF( option->exposedRect.left(),
boundingRect().top(),
option->exposedRect.right(),
boundingRect().bottom() );
drawRound = false;
}
else
{
// Unoptimized: the item must be fully repaint
drawRect = boundingRect();
drawRound = true;
}
// Do the transformation
QRectF mapped = deviceTransform( viewPortTransform ).mapRect( drawRect );
QLinearGradient gradient( mapped.topLeft(), mapped.bottomLeft() );
gradient.setColorAt( 0, QColor::fromRgb( 78, 78, 78 ) );
gradient.setColorAt( 0.4, QColor::fromRgb( 72, 72, 72 ) );
gradient.setColorAt( 0.4, QColor::fromRgb( 50, 50, 50 ) );
gradient.setColorAt( 1, QColor::fromRgb( 45, 45, 45 ) );
painter->setPen( Qt::NoPen );
painter->setBrush( QBrush( gradient ) );
if ( drawRound )
painter->drawRoundedRect( mapped, AbstractGraphicsItem::RounderRectRadius,
AbstractGraphicsItem::RounderRectRadius );
else
painter->drawRect( mapped );
if ( itemColor().isValid() )
{
QRectF mediaColorRect = mapped.adjusted( 3, 2, -3, -2 );
painter->setPen( QPen( itemColor(), 2 ) );
painter->drawLine( mediaColorRect.topLeft(), mediaColorRect.topRight() );
}
if ( isSelected() )
{
setZValue( zSelected() );
painter->setPen( Qt::yellow );
painter->setBrush( Qt::NoBrush );
mapped.adjust( 0, 0, 0, -1 );
if ( drawRound )
painter->drawRoundedRect( mapped, AbstractGraphicsItem::RounderRectRadius,
AbstractGraphicsItem::RounderRectRadius);
else
painter->drawRect( mapped );
}
else
setZValue( zNotSelected() );
}
示例12: m_pdfCropping
PdfFrameHandle::PdfFrameHandle (QGraphicsScene &scene,
QGraphicsView &view,
const QPointF &pointReference,
int orientationFlags,
PdfCropping &pdfCropping,
int zValue) :
m_pdfCropping (pdfCropping),
m_orientationFlags (orientationFlags),
m_disableEventsWhileMovingAutomatically (false),
m_scene (scene),
m_view (view)
{
const double SUBTLE_OPACITY = 0.2;
// Advantages of using ItemIgnoresTransformations:
// 1) handles do not get bigger or smaller depending on the size of the image
// 2) handles never get ugly when zoomed in
// 3) handles never get too tiny when zoomed out
// Disadvantages of using ItemIgnoresTransformation:
// 1) Resizing the preview window with ItemIgnoresTransformations moves the handles out of position
// 2) More conversions back and forth between untransformed and transformed coordinates. This was the deal breaker since
// the transformations were undocumented and ultimately too difficult
// The solution is to have constant-size handles WITHOUT ItemIgnoresTransformations. This means resizing the window
// also involves resizing the handles, but everything else is pretty easy
//
// ItemIgnoresTransformations flag must agree with the QGraphicsRectItem used for the frame box by PdfCropping
setFlags (QGraphicsItem::ItemIsMovable |
QGraphicsItem::ItemIsSelectable |
QGraphicsItem::ItemSendsScenePositionChanges);
// Fill with nice color for better visibility. Note that the pen is disabled by overriding the paint method
setBrush (QBrush (Qt::blue));
setVisible (true);
setZValue (zValue);
setOpacity (SUBTLE_OPACITY);
setPos (pointReference); // Point position is handled in scene/view coordinates
// Add to scene
scene.addItem (this);
QSize handleSize = m_pdfCropping.windowSize() / HANDLE_SIZE_AS_FRACTION_OF_WINDOW_SIZE;
// Adjust positions of handles that are not at the top left so handles are laid out symmetrically
QPointF pointPos = pointReference;
if ((orientationFlags && PdfCropping::PDF_CROPPING_LEFT) != 0) {
pointPos.setX (pointPos.x() - handleSize.width() / 2.0);
} else if ((orientationFlags && PdfCropping::PDF_CROPPING_RIGHT) != 0) {
pointPos.setX (pointPos.x() + handleSize.width() / 2.0);
}
if ((orientationFlags && PdfCropping::PDF_CROPPING_TOP) != 0) {
pointPos.setY (pointPos.y() - handleSize.height() / 2.0);
} else if ((orientationFlags && PdfCropping::PDF_CROPPING_BOTTOM) != 0) {
pointPos.setY (pointPos.y() + handleSize.height() / 2.0);
}
// Start with geometry. Since point positions are handled in scene/view coordinates, we have to convert
// to local coordinates for the rectangle
QPointF topLeftLocal = mapFromScene (pointPos);
setRect (QRectF (topLeftLocal,
handleSize));
}
示例13: setZValue
Widget_WarpControlPaint::Widget_WarpControlPaint()
{
boundRect.setCoords(0, 0, 0, 0);
setZValue(1);
setColorScheme(1);
}
示例14: while
void PixmapItem::loadPixmap(QDomElement text )
{
QDomNode node = text.firstChild();
qreal posX = 0;
qreal posY = 0;
qreal zValue = 0;
while(!node.isNull())
{
if(node.toElement().tagName() == "name")
{
name = node.toElement().text();
}
if(node.toElement().tagName() == "source")
{
source = node.toElement().text().toInt();
}
if(node.toElement().tagName() == "file")
{
file = node.toElement().text();
}
if(node.toElement().tagName() == "posX")
{
posX = node.toElement().text().toInt();
}
if(node.toElement().tagName() == "posY")
{
posY = node.toElement().text().toInt();
}
if(node.toElement().tagName() == "zValue")
{
zValue = node.toElement().text().toFloat();
}
if(node.toElement().tagName() == "width")
{
size.setWidth( node.toElement().text().toInt() );
}
if(node.toElement().tagName() == "height")
{
size.setHeight(node.toElement().text().toInt());
}
if(node.toElement().tagName() == "isLocked")
{
isLocked = node.toElement().text().toInt();
if(isLocked) {
setFlag(QGraphicsItem::ItemIsMovable, false);
}
}
node = node.nextSibling();
}
setZValue(zValue);
if(source==0)
{
QPixmap p(file);
p = p.scaledToWidth(size.width(),Qt::SmoothTransformation);
setPos(posX, posY);
setPixmap(p);
}
else
{
setPos(posX, posY);
QFile unknown(":/images/unknown.jpg");
if(unknown.open(QIODevice::ReadOnly)) {
pictureBufferUnknown.setData(unknown.readAll());
setHoruxPixmap(pictureBufferUnknown.data());
}
}
}
示例15: QGraphicsTextItem
ToolTipItem::ToolTipItem(QString txt, QGraphicsItem* parent)
: QGraphicsTextItem(txt, parent)
{
setDefaultTextColor(Colors::base03);
setZValue(10);
}