本文整理汇总了C++中setZValue函数的典型用法代码示例。如果您正苦于以下问题:C++ setZValue函数的具体用法?C++ setZValue怎么用?C++ setZValue使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setZValue函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
}
开发者ID:arntanguy,项目名称:fotowall,代码行数:86,代码来源:AbstractConfig.cpp
示例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...
}
开发者ID:artoh,项目名称:ratapiha-kauko,代码行数:6,代码来源:akseli.cpp
示例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);
}
开发者ID:mbenelli,项目名称:qt-creator,代码行数:62,代码来源:relationitem.cpp
示例4: setZValue
void ContentWindowGraphicsItem::setZToFront()
{
zCounter_ = zCounter_ + 1;
setZValue(zCounter_);
}
开发者ID:biddisco,项目名称:DisplayCluster,代码行数:5,代码来源:ContentWindowGraphicsItem.cpp
示例5: setZValue
void AbstractCardItem::setRealZValue(qreal _zValue)
{
realZValue = _zValue;
setZValue(_zValue);
}
开发者ID:glacials,项目名称:Cockatrice,代码行数:5,代码来源:abstractcarditem.cpp
示例6: QgsMapCanvasItem
QgsMapCanvasMap::QgsMapCanvasMap( QgsMapCanvas* canvas )
: QgsMapCanvasItem( canvas )
{
setZValue( -10 );
}
开发者ID:wongjimsan,项目名称:QGIS,代码行数:5,代码来源:qgsmapcanvasmap.cpp
示例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
}
开发者ID:KDE,项目名称:umbrello,代码行数:12,代码来源:nodewidget.cpp
示例8: setZValue
SceneWidgetCloseButton::SceneWidgetCloseButton()
{
setZValue(zValue()+0.5);
setFlag(ItemIsSelectable, false);
}
开发者ID:github11,项目名称:MindTree,代码行数:5,代码来源:scenewidgetcontainer.cpp
示例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;
}
开发者ID:amilcarsantos,项目名称:maemo-midij,代码行数:95,代码来源:GraphicsMidiInputItem.cpp
示例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;
//.........这里部分代码省略.........
开发者ID:dreamsxin,项目名称:kdenlive,代码行数:101,代码来源:abstractgroupitem.cpp
示例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() );
}
开发者ID:Giladx,项目名称:vlmc,代码行数:72,代码来源:GraphicsMovieItem.cpp
示例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));
}
开发者ID:TobiasWinchen,项目名称:engauge-digitizer,代码行数:62,代码来源:PdfFrameHandle.cpp
示例13: setZValue
Widget_WarpControlPaint::Widget_WarpControlPaint()
{
boundRect.setCoords(0, 0, 0, 0);
setZValue(1);
setColorScheme(1);
}
开发者ID:peter-wwj,项目名称:faceworkshop,代码行数:6,代码来源:widget_warpcontrolpaint.cpp
示例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());
}
}
}
开发者ID:BackupTheBerlios,项目名称:horux-svn,代码行数:78,代码来源:pixmapitem.cpp
示例15: QGraphicsTextItem
ToolTipItem::ToolTipItem(QString txt, QGraphicsItem* parent)
: QGraphicsTextItem(txt, parent)
{
setDefaultTextColor(Colors::base03);
setZValue(10);
}
开发者ID:denji,项目名称:antimony,代码行数:6,代码来源:tooltip.cpp
示例16: ProcessorObserver
ProcessorGraphicsItem::ProcessorGraphicsItem(Processor* processor)
: ProcessorObserver()
, LabelGraphicsItemObserver()
, processor_(processor)
, processorMeta_(nullptr)
, progressItem_(nullptr)
, statusItem_(nullptr)
, linkItem_(nullptr)
, highlight_(false)
#if IVW_PROFILING
, processCount_(0)
, countLabel_(nullptr)
, maxEvalTime_(0.0)
, evalTime_(0.0)
, totEvalTime_(0.0)
#endif
{
setZValue(PROCESSORGRAPHICSITEM_DEPTH);
setFlags(ItemIsMovable | ItemIsSelectable | ItemIsFocusable | ItemSendsGeometryChanges);
setCacheMode(QGraphicsItem::DeviceCoordinateCache);
setRect(-width / 2, -height / 2, width, height);
QGraphicsDropShadowEffect* processorShadowEffect = new QGraphicsDropShadowEffect();
processorShadowEffect->setOffset(3.0);
processorShadowEffect->setBlurRadius(3.0);
setGraphicsEffect(processorShadowEffect);
nameLabel_ = new LabelGraphicsItem(this);
nameLabel_->setCrop(9, 8);
nameLabel_->setPos(-width / 2.0 + labelHeight, -height / 2.0 + 0.6 * labelHeight);
nameLabel_->setDefaultTextColor(Qt::white);
QFont nameFont("Segoe", labelHeight, QFont::Black, false);
nameFont.setPixelSize(pointSizeToPixelSize(labelHeight));
nameLabel_->setFont(nameFont);
LabelGraphicsItemObserver::addObservation(nameLabel_);
classLabel_ = new LabelGraphicsItem(this);
classLabel_->setCrop(9, 8);
classLabel_->setPos(-width / 2.0 + labelHeight, -height / 2.0 + labelHeight * 2.0);
classLabel_->setDefaultTextColor(Qt::lightGray);
QFont classFont("Segoe", labelHeight, QFont::Normal, true);
classFont.setPixelSize(pointSizeToPixelSize(labelHeight));
classLabel_->setFont(classFont);
nameLabel_->setText(QString::fromStdString(processor_->getIdentifier()));
classLabel_->setText(QString::fromStdString(processor_->getDisplayName() + " "
+ processor_->getTags().getString()));
processor_->ProcessorObservable::addObserver(this);
processorMeta_ = processor->getMetaData<ProcessorMetaData>(ProcessorMetaData::CLASS_IDENTIFIER);
processorMeta_->addObserver(this);
linkItem_ = new ProcessorLinkGraphicsItem(this);
std::vector<Inport*> inports = processor_->getInports();
std::vector<Outport*> outports = processor_->getOutports();
inportX = rect().left() + 12.5f;
inportY = rect().top() + 4.5f;
outportX = rect().left() + 12.5f;
outportY = rect().bottom() - 4.5f;
for (auto& inport : inports) {
addInport(inport);
}
for (auto& outport : outports) {
addOutport(outport);
}
statusItem_ = new ProcessorStatusGraphicsItem(this, processor_);
if (auto progressBarOwner = dynamic_cast<ProgressBarOwner*>(processor_)) {
progressItem_ =
new ProcessorProgressGraphicsItem(this, &(progressBarOwner->getProgressBar()));
progressBarOwner->getProgressBar().ActivityIndicator::addObserver(statusItem_);
}
if (auto activityInd = dynamic_cast<ActivityIndicatorOwner*>(processor_)){
activityInd->getActivityIndicator().addObserver(statusItem_);
}
#if IVW_PROFILING
countLabel_ = new LabelGraphicsItem(this);
countLabel_->setCrop(9,8);
countLabel_->setPos(rect().left() + labelHeight, height / 2 - labelHeight*2.5);
countLabel_->setDefaultTextColor(Qt::lightGray);
countLabel_->setFont(classFont);
countLabel_->setTextWidth(width - 2*labelHeight);
#endif
setVisible(processorMeta_->isVisible());
setSelected(processorMeta_->isSelected());
setPos(QPointF(processorMeta_->getPosition().x, processorMeta_->getPosition().y));
}
开发者ID:Ojaswi,项目名称:inviwo,代码行数:96,代码来源:processorgraphicsitem.cpp
示例17: setZValue
void Item::setItemZValue(int zValue)
{
mZValue = zValue;
setZValue(zValue);
}
开发者ID:ArtemKopylov,项目名称:qreal,代码行数:5,代码来源:item.cpp
示例18: Q_UNUSED
bool QgsComposerItem::_readXML( const QDomElement& itemElem, const QDomDocument& doc )
{
Q_UNUSED( doc );
if ( itemElem.isNull() )
{
return false;
}
//rotation
setItemRotation( itemElem.attribute( "itemRotation", "0" ).toDouble() );
//uuid
mUuid = itemElem.attribute( "uuid", QUuid::createUuid().toString() );
// temporary for groups imported from templates
mTemplateUuid = itemElem.attribute( "templateUuid" );
//id
QString id = itemElem.attribute( "id", "" );
setId( id );
//frame
QString frame = itemElem.attribute( "frame" );
if ( frame.compare( "true", Qt::CaseInsensitive ) == 0 )
{
mFrame = true;
}
else
{
mFrame = false;
}
//frame
QString background = itemElem.attribute( "background" );
if ( background.compare( "true", Qt::CaseInsensitive ) == 0 )
{
mBackground = true;
}
else
{
mBackground = false;
}
//position lock for mouse moves/resizes
QString positionLock = itemElem.attribute( "positionLock" );
if ( positionLock.compare( "true", Qt::CaseInsensitive ) == 0 )
{
setPositionLock( true );
}
else
{
setPositionLock( false );
}
//position
int page;
double x, y, pagex, pagey, width, height;
bool xOk, yOk, pageOk, pagexOk, pageyOk, widthOk, heightOk, positionModeOK;
x = itemElem.attribute( "x" ).toDouble( &xOk );
y = itemElem.attribute( "y" ).toDouble( &yOk );
page = itemElem.attribute( "page" ).toInt( &pageOk );
pagex = itemElem.attribute( "pagex" ).toDouble( &pagexOk );
pagey = itemElem.attribute( "pagey" ).toDouble( &pageyOk );
width = itemElem.attribute( "width" ).toDouble( &widthOk );
height = itemElem.attribute( "height" ).toDouble( &heightOk );
mLastUsedPositionMode = ( ItemPositionMode )itemElem.attribute( "positionMode" ).toInt( &positionModeOK );
if ( !positionModeOK )
{
mLastUsedPositionMode = UpperLeft;
}
if ( pageOk && pagexOk && pageyOk )
{
xOk = true;
yOk = true;
x = pagex;
y = ( page - 1 ) * ( mComposition->paperHeight() + composition()->spaceBetweenPages() ) + pagey;
}
if ( !xOk || !yOk || !widthOk || !heightOk )
{
return false;
}
mLastValidViewScaleFactor = itemElem.attribute( "lastValidViewScaleFactor", "-1" ).toDouble();
setSceneRect( QRectF( x, y, width, height ) );
setZValue( itemElem.attribute( "zValue" ).toDouble() );
//pen
QDomNodeList frameColorList = itemElem.elementsByTagName( "FrameColor" );
if ( frameColorList.size() > 0 )
{
QDomElement frameColorElem = frameColorList.at( 0 ).toElement();
bool redOk, greenOk, blueOk, alphaOk, widthOk;
int penRed, penGreen, penBlue, penAlpha;
double penWidth;
penWidth = itemElem.attribute( "outlineWidth" ).toDouble( &widthOk );
penRed = frameColorElem.attribute( "red" ).toDouble( &redOk );
//.........这里部分代码省略.........
开发者ID:VladimirZhandarov,项目名称:QGIS,代码行数:101,代码来源:qgscomposeritem.cpp
示例19: qDebug
void GMWMarker::calculatePixmap()
{
// qDebug() << "calculating pixmap for:" << d->m_item->name();
bool booked = false;
int timeLeft;
if(d->m_item->objectType() == GMWItem::TypeVehicle) {
GMWVehicle *vehicle = qobject_cast<GMWVehicle*>(d->m_item);
if(vehicle->booking()->isValid()) {
booked = true;
timeLeft = vehicle->booking()->timeLeft();
}
}
if (d->m_highlight || booked) {
QPixmap pixmap = d->m_item->imageL();
if(booked) {
qDebug() << "car is booked:" << d->m_item->name();
QImage image = pixmap.toImage();
QPainter painter(&image);
QPixmap overlay;
#ifdef MEEGO
if(timeLeft > 900) {
overlay = QPixmap("/usr/share/themes/blanco/meegotouch/icons/icon-s-common-presence-online.png");
} else if(timeLeft > 0){
overlay = QPixmap("/usr/share/themes/blanco/meegotouch/icons/icon-s-common-presence-away.png");
} else {
overlay = QPixmap("/usr/share/themes/blanco/meegotouch/icons/icon-s-common-presence-busy.png");
}
#elif defined Q_WS_S60
if(timeLeft > 900) {
overlay = QPixmap("qml/symbian/images/bookingstate_green_s.png");
} else if(timeLeft > 0){
overlay = QPixmap("qml/symbian/images/bookingstate_yellow_s.png");
} else {
overlay = QPixmap("qml/symbian/images/bookingstate_red_s.png");
}
#endif
painter.drawPixmap(image.width() - overlay.width() - 5, 5, overlay);
pixmap = QPixmap::fromImage(image);
}
setPixmap(pixmap);
setOffset(QPoint(-pixmap.width()/2, -pixmap.height()));
setZValue(1);
} else {
setPixmap(d->m_item->image());
setOffset(QPoint(-pixmap().width()/2, -pixmap().height()));
setZValue(0);
}
if(d->m_count > 1 && !booked) {
QImage image = pixmap().toImage();
QPainter painter(&image);
QPixmap overlay = QPixmap(":qml/getmewheels2/harmattan/images/squircle_s_gray.png");
painter.drawPixmap(image.width() - overlay.width(), 0, overlay);
QPen pen(Qt::white);
painter.setPen(pen);
QFont font = painter.font();
font.setPixelSize(14);
painter.setFont(font);
painter.drawText(image.width() - 13, 14, QString::number(d->m_count));
setPixmap(QPixmap::fromImage(image));
}
}
开发者ID:mzanetti,项目名称:getmewheels,代码行数:67,代码来源:gmwmarker.cpp
示例20: QGraphicsWidget
ZoneViewWidget::ZoneViewWidget(Player *_player, CardZone *_origZone, int numberCards, bool _revealZone, bool _writeableRevealZone, const QList<const ServerInfo_Card *> &cardList)
: QGraphicsWidget(0, Qt::Tool | Qt::FramelessWindowHint), player(_player)
{
setAcceptHoverEvents(true);
setAttribute(Qt::WA_DeleteOnClose);
setZValue(2000000006);
setFlag(ItemIgnoresTransformations);
QGraphicsLinearLayout *hbox = new QGraphicsLinearLayout(Qt::Horizontal);
titleLabel = new TitleLabel;
connect(titleLabel, SIGNAL(mouseMoved(QPointF)), this, SLOT(moveWidget(QPointF)));
closeButton = new QPushButton("X");
connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
closeButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
QGraphicsProxyWidget *closeButtonProxy = new QGraphicsProxyWidget;
closeButtonProxy->setWidget(closeButton);
hbox->addItem(titleLabel);
hbox->addItem(closeButtonProxy);
QGraphicsLinearLayout *vbox = new QGraphicsLinearLayout(Qt::Vertical);
vbox->addItem(hbox);
if (numberCards < 0) {
QGraphicsProxyWidget *sortByNameProxy = new QGraphicsProxyWidget;
sortByNameProxy->setWidget(&sortByNameCheckBox);
vbox->addItem(sortByNameProxy);
QGraphicsProxyWidget *sortByTypeProxy = new QGraphicsProxyWidget;
sortByTypeProxy->setWidget(&sortByTypeCheckBox);
vbox->addItem(sortByTypeProxy);
QGraphicsProxyWidget *lineProxy = new QGraphicsProxyWidget;
QFrame *line = new QFrame;
line->setFrameShape(QFrame::HLine);
line->setFrameShadow(QFrame::Sunken);
lineProxy->setWidget(line);
vbox->addItem(lineProxy);
QGraphicsProxyWidget *pileViewProxy = new QGraphicsProxyWidget;
pileViewProxy->setWidget(&pileViewCheckBox);
vbox->addItem(pileViewProxy);
}
if (_origZone->getIsShufflable() && (numberCards == -1)) {
shuffleCheckBox.setChecked(settingsCache->getZoneViewShuffle());
QGraphicsProxyWidget *shuffleProxy = new QGraphicsProxyWidget;
shuffleProxy->setWidget(&shuffleCheckBox);
vbox->addItem(shuffleProxy);
}
extraHeight = vbox->sizeHint(Qt::PreferredSize).height();
resize(150, 150);
QGraphicsLinearLayout *zoneHBox = new QGraphicsLinearLayout(Qt::Horizontal);
zoneContainer = new QGraphicsWidget(this);
zoneContainer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
zoneContainer->setFlag(QGraphicsItem::ItemClipsChildrenToShape);
zoneHBox->addItem(zoneContainer);
scrollBar = new QScrollBar(Qt::Vertical);
scrollBar->setMinimum(0);
scrollBar->setSingleStep(50);
connect(scrollBar, SIGNAL(valueChanged(int)), this, SLOT(handleScrollBarChange(int)));
QGraphicsProxyWidget *scrollBarProxy = new QGraphicsProxyWidget;
scrollBarProxy->setWidget(scrollBar);
zoneHBox->addItem(scrollBarProxy);
vbox->addItem(zoneHBox);
zone = new ZoneViewZone(player, _origZone, numberCards, _revealZone, _writeableRevealZone, zoneContainer);
connect(zone, SIGNAL(wheelEventReceived(QGraphicsSceneWheelEvent *)), this, SLOT(handleWheelEvent(QGraphicsSceneWheelEvent *)));
// numberCard is the num of cards we want to reveal from an ar
|
请发表评论