예제 #1
0
void
KDatePicker::setCloseButton( bool enable )
{
    if ( enable == (d->closeButton != 0L) )
        return;

    if ( enable ) {
        d->closeButton = new QToolButton( this );
        d->closeButton->setAutoRaise(true);
        d->navigationLayout->addSpacing(KDialog::spacingHint());
        d->navigationLayout->addWidget(d->closeButton);
        d->closeButton->setToolTip(i18n("Close"));
        d->closeButton->setIcon( SmallIcon("list-remove") );
        connect( d->closeButton, SIGNAL( clicked() ),
                 topLevelWidget(), SLOT( close() ) );
    }
    else {
        delete d->closeButton;
        d->closeButton = 0L;
    }

    updateGeometry();
}
예제 #2
0
void FaceModel::simulate(float deltaTime, bool fullUpdate) {
    updateGeometry();
    Avatar* owningAvatar = static_cast<Avatar*>(_owningHead->_owningAvatar);
    glm::vec3 neckPosition;
    if (!owningAvatar->getSkeletonModel().getNeckPosition(neckPosition)) {
        neckPosition = owningAvatar->getPosition();
    }
    setTranslation(neckPosition);
    glm::quat neckParentRotation;
    if (!owningAvatar->getSkeletonModel().getNeckParentRotationFromDefaultOrientation(neckParentRotation)) {
        neckParentRotation = owningAvatar->getOrientation();
    }
    setRotation(neckParentRotation);
    setScale(glm::vec3(1.0f, 1.0f, 1.0f) * _owningHead->getScale());
    
    setPupilDilation(_owningHead->getPupilDilation());
    setBlendshapeCoefficients(_owningHead->getBlendshapeCoefficients());
    
    if (isActive()) {
        setOffset(-_geometry->getFBXGeometry().neckPivot);
        Model::simulateInternal(deltaTime);
    }
}
void MFreestyleLayoutPolicy::moveItemTo(QGraphicsLayoutItem *item, const QRectF &geom)
{
    Q_D(MFreestyleLayoutPolicy);

    int index = indexOf(item);
    if (index < 0)
        return; //Item not found

    QPointF topLeft = contentsArea().topLeft();
    QList<QRectF> new_geometries;

    const int size = count();
    for (int i = 0; i < size; ++i)
        new_geometries << itemGeometry(i);

    new_geometries[index] = geom;

    d->placeItem(index, new_geometries, topLeft, contentsArea().width());

    for (int i = 0; i < size; ++i)
        setItemGeometry(i, new_geometries.at(i));
    updateGeometry();
}
예제 #4
0
/* Function has to be called by the parent
   Parent has to care about resizing itself */
void VideoWidget::setSize( unsigned int w, unsigned int h )
{
    /* If the size changed, resizeEvent will be called, otherwise not,
     * in which case we need to tell the vout what the size actually is
     */
    if( (unsigned)size().width() == w && (unsigned)size().height() == h )
    {
        if( p_window != NULL )
            vout_window_ReportSize( p_window, w, h );
        return;
    }

    resize( w, h );
    emit sizeChanged( w, h );
    /* Work-around a bug?misconception? that would happen when vout core resize
       twice to the same size and would make the vout not centered.
       This cause a small flicker.
       See #3621
     */
    if( (unsigned)size().width() == w && (unsigned)size().height() == h )
        updateGeometry();
    sync();
}
예제 #5
0
void
GNEDetectorExit::setAttribute(SumoXMLAttr key, const std::string& value) {
    switch (key) {
        case SUMO_ATTR_ID:
            changeAdditionalID(value);
            break;
        case SUMO_ATTR_LANE:
            myLane = changeLane(myLane, value);
            break;
        case SUMO_ATTR_POSITION:
            myPositionOverLane = parse<double>(value);
            break;
        case SUMO_ATTR_FRIENDLY_POS:
            myFriendlyPosition = parse<bool>(value);
            break;
        case GNE_ATTR_BLOCK_MOVEMENT:
            myBlockMovement = parse<bool>(value);
            break;
        case GNE_ATTR_PARENT:
            changeFirstAdditionalParent(value);
            break;
        case GNE_ATTR_SELECTED:
            if(parse<bool>(value)) {
                selectAttributeCarrier();
            } else {
                unselectAttributeCarrier();
            }
            break;
        case GNE_ATTR_GENERIC:
            setGenericParametersStr(value);
            break;
        default:
            throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'");
    }
    // After setting attribute always update Geometry
    updateGeometry();
}
예제 #6
0
void FadingMultilineLabel::positionLayouts()
{
	QFontMetricsF fm = fontMetrics();
	qreal lineHeight = fm.height();

	delete textLayout_;
	textLayout_ = 0;

	textLayout_ = new QTextLayout(text_, font());
	textLayout_->setTextOption(textOption_);
	// textLayout_->setAdditionalFormats(formats[p]);
	textLayout_->beginLayout();

	qreal x = 0.0;
	qreal y = 0.0;
	qreal ymax = 0.0;

	fadeOuts_.clear();
	QTextLine line = textLayout_->createLine();

	while (line.isValid()) {
		line.setPosition(QPointF(x, y));
		line.setLineWidth(width());

		if (line.naturalTextWidth() > width()) {
			fadeOuts_ << QRect(x, y, width(), lineHeight);
		}

		y += line.height();
		line = textLayout_->createLine();
	}

	textLayout_->endLayout();

	sizeHint_ = QSize(width(), y);
	updateGeometry();
}
예제 #7
0
void MD5Surface::updateToDefaultPose(const MD5Joints& joints)
{
	if (_vertices.size() != _mesh->vertices.size())
	{
		_vertices.resize(_mesh->vertices.size());
	}

	for (std::size_t j = 0; j < _mesh->vertices.size(); ++j)
	{
		MD5Vert& vert = _mesh->vertices[j];

		Vector3 skinned(0, 0, 0);

		for (std::size_t k = 0; k != vert.weight_count; ++k)
		{
			MD5Weight& weight = _mesh->weights[vert.weight_index + k];
			const MD5Joint& joint = joints[weight.joint];

			Vector3 rotatedPoint = joint.rotation.transformPoint(weight.v);
			skinned += (rotatedPoint + joint.position) * weight.t;
		}

		_vertices[j].vertex = skinned;
		_vertices[j].texcoord = TexCoord2f(vert.u, vert.v);
		_vertices[j].normal = Normal3f(0,0,0);
	}

	// Ensure the index array is ok
	if (_indices.empty())
	{
		buildIndexArray();
	}

	buildVertexNormals();

	updateGeometry();
}
예제 #8
0
void MainWidget::delRows(int place, int n) {
    if (n <= 0)
        return;
    place = qBound(0, place, yasc);
    n = qMin(n, yasc);

    QList<QList<QRgb> > bg, fg;
    for (int j = 0; j < yasc; ++j) {
        QList<QRgb> a, b;
        for (int i = 0; i < xasc; ++i) {
            a << background.pixel(i,j);
            b << foreground.pixel(i,j);
        }
        bg << a;
        fg << b;
    }
    for (int i = 0; i < n; ++i) {
        text.removeAt(place);
        bg.removeAt(place);
        fg.removeAt(place);
    }
    QImage newbg(xasc, yasc-n, QImage::Format_RGB32);
    QImage newfg(xasc, yasc-n, QImage::Format_RGB32);
    for (int j = 0; j < yasc-n; ++j) {
        for (int i = 0; i < xasc; ++i) {
            newbg.setPixel(i, j, bg[j][i]);
            newfg.setPixel(i, j, fg[j][i]);
        }
    }
    background = newbg;
    foreground = newfg;
    yasc -= n;
    update();
    updateGeometry();
    adjustSize();
    emit somethingChanged(true);
}
void TrackerFiltersList::removeItem(const QString &tracker, const QString &hash)
{
    QString host = getHost(tracker);
    QListWidgetItem *trackerItem = nullptr;
    QStringList tmp = m_trackers.value(host);
    int row = 0;

    if (tmp.empty())
        return;
    tmp.removeAll(hash);

    if (!host.isEmpty()) {
        // Remove from 'Error' and 'Warning' view
        trackerSuccess(hash, tracker);
        row = rowFromTracker(host);
        trackerItem = item(row);
        if (tmp.empty()) {
            if (currentRow() == row)
                setCurrentRow(0, QItemSelectionModel::SelectCurrent);
            delete trackerItem;
            m_trackers.remove(host);
            updateGeometry();
            return;
        }
        if (trackerItem != nullptr)
            trackerItem->setText(QString("%1 (%2)").arg(host).arg(tmp.size()));
    }
    else {
        row = 1;
        trackerItem = item(1);
        trackerItem->setText(tr("Trackerless (%1)").arg(tmp.size()));
    }

    m_trackers.insert(host, tmp);
    if (currentRow() == row)
        applyFilter(row);
}
예제 #10
0
bool KURLBar::editItem(KURLBarItem *item)
{
    if(!item || !item->isPersistent()) // should never happen tho
        return false;

    KURL url = item->url();
    QString description = item->description();
    QString icon = item->icon();
    bool appLocal = item->applicationLocal();

    if(KURLBarItemDialog::getInformation(m_useGlobal, url, description, icon, appLocal, m_iconSize, this))
    {
        item->setURL(url);
        item->setDescription(description);
        item->setIcon(icon);
        item->setApplicationLocal(appLocal);
        m_listBox->triggerUpdate(true);
        m_isModified = true;
        updateGeometry();
        return true;
    }

    return false;
}
예제 #11
0
void QButton::setText(const QString &text)
{
  if (btext == text)
    return;
  btext = text;
#ifndef QT_NO_ACCEL
  setAccel(QAccel::shortcutKey(text));
#endif

  if (bpixmap) {
    delete bpixmap;
    bpixmap = 0;
  }

  if (autoresize)
    adjustSize();

  update();
  updateGeometry();

#if defined(QT_ACCESSIBILITY_SUPPORT)
  QAccessible::updateAccessibility( this, 0, QAccessible::NameChanged );
#endif
}
예제 #12
0
void ProposalListView::reset()
{
	/*
	 * Unset all custom delegates. This is not possible in 5.3.3.
	 * Anyway this should be done by QListView::reset(); [ See QTBUG-42391 ]
	 */
	for (int i : _customDelegateRows)
		setItemDelegateForRow(i, nullptr);
	_customDelegateRows.clear();

	// Reset the  views state
	QListView::reset();

	// Make the size of this widget be adjusted (size hint changed)
	updateGeometry();

	// Show if not empty and make first item current
	if ( model()->rowCount() > 0 ){
		show();
		setCurrentIndex(model()->index(0,0));
	}
	else
		hide();
}
예제 #13
0
/**
 * Set the main body of text to display.
 *
 * @param t The text to display.
 */
void FloatingTextWidget::setText(const QString &t)
{
    if (m_textRole == Uml::TextRole::Seq_Message || m_textRole == Uml::TextRole::Seq_Message_Self) {
        QString op;
        if (m_linkWidget)
            op = m_linkWidget->lwOperationText();
        if (op.length() > 0) {
            if (!m_scene->showOpSig())
                op.replace(QRegExp(QLatin1String("\\(.*\\)")), QLatin1String("()"));
            m_Text = op;
        }
        else
            m_Text = t;
    }
    else {
        m_Text = t;
    }

    QSizeF s = minimumSize();
    setSize(s.width(), s.height());

    updateGeometry();
    update();
}
Foam::tmp<Foam::Field<Type> >
Foam::sampledIsoSurface::interpolateField
(
    const interpolation<Type>& interpolator
) const
{
    // Get fields to sample. Assume volPointInterpolation!
    const GeometricField<Type, fvPatchField, volMesh>& volFld =
        interpolator.psi();

    // Recreate geometry if time has changed
    updateGeometry();

    if (subMeshPtr_.valid())
    {
        tmp<GeometricField<Type, fvPatchField, volMesh> > tvolSubFld =
            subMeshPtr_().interpolate(volFld);

        const GeometricField<Type, fvPatchField, volMesh>& volSubFld =
            tvolSubFld();

        tmp<GeometricField<Type, pointPatchField, pointMesh> > tpointSubFld =
            volPointInterpolation::New(volSubFld.mesh()).interpolate(volSubFld);

        // Sample.
        return surface().interpolate(volSubFld, tpointSubFld());
    }
    else
    {
        tmp<GeometricField<Type, pointPatchField, pointMesh> > tpointFld =
            volPointInterpolation::New(volFld.mesh()).interpolate(volFld);

        // Sample.
        return surface().interpolate(volFld, tpointFld());
    }
}
예제 #15
0
void WidgetSelection::setWidget( QWidget *w, bool updateDict )
{
    if ( !w ) {
	hide();
	if ( updateDict )
	    selectionDict->remove( wid );
	wid = 0;
	return;
    }

    wid = w;
    bool active = !wid->parentWidget() || WidgetFactory::layoutType( wid->parentWidget() ) == WidgetFactory::NoLayout;
    for ( int i = SizeHandle::LeftTop; i <= SizeHandle::Left; ++i ) {
	SizeHandle *h = handles[ i ];
	if ( h ) {
	    h->setWidget( wid );
	    h->setActive( active );
	}
    }
    updateGeometry();
    show();
    if ( updateDict )
	selectionDict->insert( w, this );
}
예제 #16
0
//**************************************************************************************************
bool ossimScaleFilter::loadState(const ossimKeywordlist& kwl,
                                 const char* prefix)
{
   ossimString scalex  = kwl.find(prefix,
                                 ossimKeywordNames::SCALE_X_KW);
   ossimString scaley  = kwl.find(prefix,
                                  ossimKeywordNames::SCALE_Y_KW);
   ossimString minify  = kwl.find(prefix,
                                  "minify_type");
   ossimString magnify = kwl.find(prefix,
                                  "magnify_type");
   
   m_ScaleFactor.x = scalex.toDouble();
   m_ScaleFactor.y = scaley.toDouble();

   if(fabs(m_ScaleFactor.x) <= FLT_EPSILON)
   {
      m_ScaleFactor.x = 1.0;
   }
   if(fabs(m_ScaleFactor.y) <= FLT_EPSILON)
   {
      m_ScaleFactor.y = 1.0;
   }

   m_InverseScaleFactor.x = 1.0/m_ScaleFactor.x;
   m_InverseScaleFactor.y = 1.0/m_ScaleFactor.y;
   
   setFilterType(getFilterType(minify),
                 getFilterType(magnify));
   
   // A change in the scale factor implies a change to the image geometry. If one has been created
   // it needs to be modified:
   updateGeometry();

   return ossimImageSourceFilter::loadState(kwl, prefix);
}
예제 #17
0
bool QwtLegend::eventFilter(QObject *o, QEvent *e)
{
    if ( o == d_data->view->contentsWidget )
    {
        switch(e->type())
        {
            case QEvent::ChildRemoved:
            {   
                const QChildEvent *ce = (const QChildEvent *)e;
                if ( ce->child()->isWidgetType() )
                    d_data->map.remove((QWidget *)ce->child());
                break;
            }
#if QT_VERSION < 0x040000
            case QEvent::LayoutHint:
#else
            case QEvent::LayoutRequest:
#endif
            {
                layoutContents();
                break;
            }
#if QT_VERSION < 0x040000
            case QEvent::Resize:
            {
                updateGeometry();
                break;
            }
#endif
            default:
                break;
        }
    }
    
    return QFrame::eventFilter(o, e);
}
예제 #18
0
void FaceModel::simulate(float deltaTime, bool fullUpdate) {
    updateGeometry();

    Avatar* owningAvatar = static_cast<Avatar*>(_owningHead->_owningAvatar);
    glm::vec3 neckPosition;
    if (!owningAvatar->getSkeletonModel().getNeckPosition(neckPosition)) {
        neckPosition = owningAvatar->getPosition();
    }
    setTranslation(neckPosition);
    glm::quat neckParentRotation = owningAvatar->getOrientation();
    setRotation(neckParentRotation);
    setScale(glm::vec3(1.0f, 1.0f, 1.0f) * _owningHead->getScale());

    setPupilDilation(_owningHead->getPupilDilation());
    setBlendshapeCoefficients(_owningHead->getBlendshapeCoefficients());

    // FIXME - this is very expensive, we shouldn't do it if we don't have to
    //invalidCalculatedMeshBoxes();

    if (isActive()) {
        setOffset(-_geometry->getFBXGeometry().neckPivot);
        Model::simulateInternal(deltaTime);
    }
}
void PaintArea::setImage(const QImage &image)
{
    theImage = image.convertToFormat(QImage::Format_RGB32);
    update();
    updateGeometry();
}
예제 #20
0
void ExpandingTextEdit::updateHeight(const QSizeF &documentSize)
{
    m_minimumHeight = qRound(documentSize.height()) + frameWidth() * 2;
    updateGeometry();
}
예제 #21
0
void ChatbarTextEdit::doResize() {
	updateGeometry();
	QTimer::singleShot(0, this, SLOT(doScrollbar()));
}
예제 #22
0
/**
 * Sets the type of activity.
 */
void ActivityWidget::setActivityType(ActivityType activityType)
{
    m_activityType = activityType;
    updateGeometry();
    UMLWidget::m_resizable = true;
}
예제 #23
0
/**
 * This method set the name of the postText attribute
 */
void ActivityWidget::setPostconditionText(const QString& aPostText)
{
    m_postconditionText = aPostText;
    updateGeometry();
    adjustAssocs(x(), y());
}
void StreamPostWidget::gotNetworkReply(QNetworkReply *reply) {

    RequestType t = m_outstandingNetworkRequests.take(reply);

    if (reply->error() == QNetworkReply::NoError)
    {
        if (t == AppIcon)
        {
            QPixmap p;
            p.loadFromData(reply->readAll());
            QLabel *l = new QLabel();
            l->setPixmap(p);
            m_ageLineLayout->insertWidget(0,l,0);

        }
        else if (t == PosterPixmap)
        {
            QPixmap p;
            p.loadFromData(reply->readAll());
            QLabel *l = new QLabel();
            l->setPixmap(p);
            l->setMinimumWidth(p.width());

            QString uid;
            QUrl url;

            if (m_post->isFromUser())
            {
                uid = m_post->getPoster().getUID();
                url = m_post->getPoster().getPicBig();
            }
            else
            {
                uid = m_post->getPage().getPageId();
                url = m_post->getPage().getPicBig();
            }

            UTIL::FbUserPicCache *cache = UTIL::FbUserPicCache::getInstance();
            cache->cachePixmap(uid, UTIL::FbUserPicCache::PicBig,
                               url, p);

            ((QHBoxLayout *)layout())->insertWidget(0,l,0,Qt::AlignTop);
            updateGeometry();
            gotContentUpdate();
            update();
        }
    }
    else
    {
        qDebug() << reply->errorString();
        qDebug() << reply->request().url().toEncoded();

        if (t == AppIcon && !m_triedBothIcons)
        {
            m_triedBothIcons = true;
            if (m_post->getAppInfo().getIconUrl() != "")
            {
                QNetworkRequest nr;
                nr.setUrl(QUrl(m_post->getAppInfo().getIconUrl()));
                QNetworkReply *reply2 = m_nam->get(nr);
                m_outstandingNetworkRequests.insert(reply2, AppIcon);
            }

        }

    }

    reply->deleteLater();

}
void EdgeWidgetLayoutBox::relayout()
{
    _layout->invalidate();
    updateGeometry();
}
예제 #26
0
void DiagramItem::update()
{
    prepareGeometryChange();
    updateStereotypeIconDisplay();

    const Style *style = adaptedStyle(stereotypeIconId());

    // custom icon
    if (stereotypeIconDisplay() == StereotypeIcon::DisplayIcon) {
        if (!m_customIcon)
            m_customIcon = new CustomIconItem(diagramSceneModel(), this);
        m_customIcon->setStereotypeIconId(stereotypeIconId());
        m_customIcon->setBaseSize(stereotypeIconMinimumSize(m_customIcon->stereotypeIcon(), CUSTOM_ICON_MINIMUM_AUTO_WIDTH, CUSTOM_ICON_MINIMUM_AUTO_HEIGHT));
        m_customIcon->setBrush(style->fillBrush());
        m_customIcon->setPen(style->outerLinePen());
        m_customIcon->setZValue(SHAPE_ZVALUE);
    } else if (m_customIcon) {
        m_customIcon->scene()->removeItem(m_customIcon);
        delete m_customIcon;
        m_customIcon = 0;
    }

    // shape
    if (!m_customIcon) {
        if (!m_body)
            m_body = new QGraphicsPolygonItem(this);
        m_body->setBrush(style->fillBrush());
        m_body->setPen(style->outerLinePen());
        m_body->setZValue(SHAPE_ZVALUE);
        if (!m_fold)
            m_fold = new QGraphicsPolygonItem(this);
        m_fold->setBrush(style->extraFillBrush());
        m_fold->setPen(style->outerLinePen());
        m_fold->setZValue(SHAPE_DETAILS_ZVALUE);
    } else {
        if (m_fold) {
            m_fold->scene()->removeItem(m_fold);
            delete m_fold;
            m_fold = 0;
        }
        if (m_body) {
            m_body->scene()->removeItem(m_body);
            delete m_body;
            m_body = 0;
        }
    }

    // stereotypes
    updateStereotypes(stereotypeIconId(), stereotypeIconDisplay(), style);

    // diagram name
    if (!m_diagramName)
        m_diagramName = new QGraphicsSimpleTextItem(this);
    m_diagramName->setFont(style->headerFont());
    m_diagramName->setBrush(style->textBrush());
    m_diagramName->setText(object()->name());

    updateSelectionMarker(m_customIcon);
    updateAlignmentButtons();
    updateGeometry();
}
/*!
    Updates child graphics items to represent current state and content. 

    \note It is a good habit to reuse child items as much as possible as this improves
    performance, especially when item recycling is used. 

    Most of the HbAbstractViewItem derived classes inside Hb library are optimised for performance.
    Layout files are loaded only if child items are created or deleted. Loading layout
    files is triggered by calling HbWidget::repolish(). 
    Classes deriving from HbAbstractViewItem outside Hb, should either always call explicitly
    repolish() or if they are also optimised for performance only when child items are created or deleted
    in the custom view item.

    Here is an example of custom view item that reuses its child items. The custom view item does not
    create or delete child items.

    \snippet{ultimatecodesnippet/customlistviewitem.cpp,2}

    \sa HbWidget::polish()
*/
void HbAbstractViewItem::updateChildItems()
{
    HB_SDD(HbAbstractViewItem);

    int itemType = d->modelItemType();
    if (itemType != d->mModelItemType) {
        d->mModelItemType = itemType;
        d->mItemsChanged = true;
        d->themingPending = true;
    }

    /* Summary of background and frame handling:
         d->mBackground is read from Qt::BackgroundRole of model
         d->mBackgroundItem is created from d-mBackground (Qt::BackgroundRole), if this is HbIcon or QBrush.

         If d->mBackgroundItem does not exist, d->mFrame is created from d-mBackground (Qt::BackgroundRole), 
         if this is HbFrameBackground otherwise it either is created from sd->mDefaultFrame, 
         not created at all or from system default.
    */
 
    // background
    QVariant currentBackground = d->mIndex.data(Qt::BackgroundRole);
    if (currentBackground != d->mBackground) {
        d->mBackground = currentBackground;
        if (currentBackground.canConvert<HbIcon>() 
            || currentBackground.canConvert<QBrush>()) {
            if (!d->mBackgroundItem) {  
                d->mItemsChanged = true;
                d->mBackgroundItem = style()->createPrimitive(HbStyle::P_ItemViewItem_background, this);
                delete d->mFrame;
                d->mFrame = 0;
            }
        } else if (currentBackground.canConvert<HbFrameBackground>()) {
            if (!d->mFrame) {
                d->mItemsChanged = true;
                d->mFrame = style()->createPrimitive(HbStyle::P_ItemViewItem_frame, this);
                delete d->mBackgroundItem;
                d->mBackgroundItem = 0;
            }
        } else if (d->mBackgroundItem) {
            d->mItemsChanged = true;
            delete d->mBackgroundItem;
            d->mBackgroundItem = 0;
        }
    }

    // frame
    if (!d->mBackgroundItem) {
        if (    d->mModelItemType == Hb::ParentItem
            ||  d->mModelItemType == Hb::SeparatorItem
            ||  (   d->mModelItemType == Hb::StandardItem
                &&  (   d->mBackground.canConvert<HbFrameBackground>()
                    ||  sd->mDefaultFrame.frameGraphicsName().length() > 0    
                    ||  sd->mDefaultFrame.isNull()))) { 
            if (!d->mFrame) {
                d->mItemsChanged = true;
                d->mFrame = style()->createPrimitive(HbStyle::P_ItemViewItem_frame, this);
            }
        } else if (d->mFrame) {
            d->mItemsChanged = true;
            delete d->mFrame;
            d->mFrame = 0;
        }
    } 

    GraphicsItemFlags itemFlags = flags();
    Qt::ItemFlags indexFlags = d->mIndex.flags();

    if ((indexFlags & Qt::ItemIsEnabled) && sd->mItemView && sd->mItemView->isEnabled()) {
        if (!(itemFlags & QGraphicsItem::ItemIsFocusable)) {
            itemFlags |= QGraphicsItem::ItemIsFocusable;
            setFocusPolicy(sd->mPrototype->focusPolicy());
            setProperty("state", "normal");
            grabGesture(Qt::TapGesture);
        }
    } else {
        if (itemFlags & QGraphicsItem::ItemIsFocusable) {
            itemFlags &= ~QGraphicsItem::ItemIsFocusable;
            setFocusPolicy(Qt::NoFocus);
            setProperty("state", "disabled");
            ungrabGesture(Qt::TapGesture);
        }
    }

    // selection
    HbAbstractItemView::SelectionMode selectionMode = HbAbstractItemView::NoSelection;
    if (sd->mItemView) {
        selectionMode = sd->mItemView->selectionMode();
    }

    bool previousSelectable = itemFlags & QGraphicsItem::ItemIsSelectable;
    bool itemSelectable = false;

    if (indexFlags & Qt::ItemIsSelectable 
        && selectionMode != HbAbstractItemView::NoSelection
        && indexFlags & Qt::ItemIsEnabled) {
        itemFlags |= QGraphicsItem::ItemIsSelectable;
        itemSelectable = true;
    } else {
        itemFlags &= ~QGraphicsItem::ItemIsSelectable;
    }

    if (previousSelectable != itemSelectable) {
        if (itemSelectable) {
            if (!d->mSelectionItem) {
                d->mItemsChanged = true;
                d->mSelectionItem = style()->createPrimitive(HbStyle::P_ItemViewItem_selection, this);
            }
        } else {
            d->mItemsChanged = true;
            delete d->mSelectionItem;
            d->mSelectionItem = 0;
        }
    }

    setFlags(itemFlags);

    // multiselection area
    if (    itemSelectable 
        &&  selectionMode == HbAbstractItemView::MultiSelection) {
        if (!d->mMultiSelectionTouchArea) {
            d->mItemsChanged = true;
            d->mMultiSelectionTouchArea = style()->createPrimitive(HbStyle::P_ItemViewItem_touchmultiselection, this);
        }
    } else if (d->mMultiSelectionTouchArea) {
        d->mItemsChanged = true;
        delete d->mMultiSelectionTouchArea;
        d->mMultiSelectionTouchArea = 0;
    }

    // items visibility or items content has really changed
    updatePrimitives();
    if (!d->mContentChangedSupported
        || d->mItemsChanged) {
        updateGeometry();   // ensures that sizehint is calculated again in case items have been created or deleted
        d->mRepolishRequested = true;
        // handle QEvent::Polish & QEvent::LayoutRequest event itself in ::sizeHint() as our performance is slightly better
        // (saving a layoutrequest and going event loop through twice)
        if (sd->mItemView && sd->mItemView->isScrolling()) {
            d->mHandlingRepolishSynchronously = true;
        }
        repolish();
        d->mHandlingRepolishSynchronously = false;
    }
    d->mItemsChanged = false;
}
예제 #28
0
void MapView::optimizeForSize(const Size& visibleSize)
{
    updateGeometry(m_visibleDimension, visibleSize);
}
예제 #29
0
void MapView::setAutoViewMode(bool enable)
{
    m_autoViewMode = enable;
    if(enable)
        updateGeometry(m_visibleDimension, m_optimizedSize);
}
예제 #30
0
void QWidgetWindow::handleMoveEvent(QMoveEvent *event)
{
    updateGeometry();
    QGuiApplication::sendSpontaneousEvent(m_widget, event);
}