예제 #1
0
void GrowingLimb::updateBoneTransform(sf::Vector2f pos, sf::Vector2f scale, sf::Vector2f origin, float angle)
{
	//	boneTransform() overrides anything done to the regular Enity transform
	pos += limbTransform.getPosition();
	if (parent)
	{
		pos += je::lengthdir(scale.x * TreeSize * parent->length, -angle);
	}
	scale.x *= limbTransform.getScale().x;
	scale.y *= limbTransform.getScale().y;
	origin += limbTransform.getOrigin();
	angle += limbTransform.getRotation();

	transform().setPosition(pos);
	transform().setScale(scale);
	transform().setOrigin(origin);
	transform().setRotation(angle);

	updateMask();

	for (GrowingLimb *child : children)
	{
		child->updateBoneTransform(pos, scale, origin, angle);
	}
}
예제 #2
0
void Stack::resizeEvent(QResizeEvent* event)
{
	updateMask();
	m_resize_timer->start();
	updateBackground();
	QWidget::resizeEvent(event);
}
예제 #3
0
void QSlider::setTickInterval( int i )
{
    tickInt = QMAX( 0, i );
    update();
    if ( autoMask() )
	updateMask();
}
예제 #4
0
/*!\reimp
*/
void QSlider::resizeEvent( QResizeEvent * )
{
    rangeChange();
    initTicks();
    if ( autoMask() )
	updateMask();
}
예제 #5
0
void QButton::setPixmap( const QPixmap &pixmap )
{
    if ( bpixmap && bpixmap->serialNumber() == pixmap.serialNumber() )
	return;

    bool newSize;
    if ( bpixmap ) {
	newSize = pixmap.width() != bpixmap->width() ||
		  pixmap.height() != bpixmap->height();
	*bpixmap = pixmap;
    } else {
	newSize = TRUE;
	bpixmap = new QPixmap( pixmap );
	CHECK_PTR( bpixmap );
    }
    if ( bpixmap->depth() == 1 && !bpixmap->mask() )
	bpixmap->setMask( *((QBitmap *)bpixmap) );
    if ( !btext.isNull() )
	btext = QString::null;
    if ( autoresize && newSize )
	adjustSize();
    setAccel( 0 );
    if ( autoMask() )
	updateMask();
    update();
    updateGeometry();
}
예제 #6
0
void ThinSplitterHandle::resizeEvent(QResizeEvent *event)
{
    updateMask();
    if (event->size()!=size()) {
        QSplitterHandle::resizeEvent(event);
    }
}
예제 #7
0
/*!
  Set up the layout.
 */
void QTabWidget::setUpLayout( bool onlyCheck )
{
    if ( onlyCheck && !d->dirty )
	return; // nothing to do

    if ( !isVisible() ) {
	d->dirty = TRUE;
	return; // we'll do it later
    }
    QSize t( d->tabs->sizeHint() );
    if ( t.width() > width() )
	t.setWidth( width() );
    int lw = d->stack->lineWidth();
    if ( d->pos == Bottom ) {
	d->tabs->setGeometry( QMAX(0, lw-2), height() - t.height() - lw, t.width(), t.height() );
	d->stack->setGeometry( 0, 0, width(), height()-t.height()+QMAX(0, lw-2) );
    }
    else { // Top
	d->tabs->setGeometry( QMAX(0, lw-2), 0, t.width(), t.height() );
	d->stack->setGeometry( 0, t.height()-lw, width(), height()-t.height()+QMAX(0, lw-2));
    }

    d->dirty = FALSE;
    if ( !onlyCheck )
	update();
    if ( autoMask() )
	updateMask();
}
예제 #8
0
void QSlider::setTickmarks( TickSetting s )
{
    ticks = s;
    initTicks();
    update();
    if ( autoMask() )
	updateMask();
}
예제 #9
0
/*!
  When set to TRUE (the default) the positioning of the indicator string
  follows the GUI style. When set to FALSE the indicator position is decided
  by the value of indicatorFollowsStyle().

  \sa indicatorFollowsStyle(), centerIndicator(), setCenterIndicator(),
      setIndicator()
 */
void QProgressBar::setIndicatorFollowsStyle( bool on )
{
    if ( on == auto_indicator )
	return;
    auto_indicator = on;
    repaint( FALSE );
    if ( autoMask() )
	updateMask();
}
예제 #10
0
ThinSplitterHandle::ThinSplitterHandle(Qt::Orientation orientation, QSplitter *parent)
    : QSplitterHandle(orientation, parent)
    , highlightUnderMouse(false)
    , underMouse(false)
{
    sz=Utils::scaleForDpi(4);
    updateMask();
    setAttribute(Qt::WA_MouseNoMask, true);
}
예제 #11
0
void Stack::setMargins(int footer, int header)
{
	m_footer_margin = footer;
	m_header_margin = header;
	m_footer_visible = (m_footer_visible != 0) ? -m_footer_margin : 0;
	m_header_visible = (m_header_visible != 0) ? m_header_margin : 0;
	updateMask();
	showHeader();
}
예제 #12
0
//
// When we set an explicit time we don't want the timeout() slot to be
// called anymore as this relies on currentTime()
//
void QTodoClock::setTime( const QTime & t )
{
	time = t;
	disconnect( internalTimer, SIGNAL(timeout()), this, SLOT(timeout()) );
	if (autoMask())
		updateMask();
	else
		update();
}
예제 #13
0
void QProgressBar::reset()
{
    progress_val = -1;
    percentage = -1;
    setIndicator(progress_str, progress_val, total_steps);
    update();
    if ( autoMask() )
	updateMask();
}
예제 #14
0
void ToolButtonTip::resizeEvent( QResizeEvent * _re )
{
	const QColor color_frame = QColor( 48, 48, 48 );
	m_bg = QImage( size(), QImage::Format_ARGB32 );
	m_bg.fill( color_frame.rgba() );
	QPainter p( &m_bg );
	p.setRenderHint( QPainter::Antialiasing );
	QPen pen( color_frame );
	pen.setWidthF( 1.5 );
	p.setPen( pen );
	QLinearGradient grad( 0, 0, 0, height() );
	const QColor color_top = palette().color( QPalette::Active,
						QPalette::Window ).light( 120 );
	grad.setColorAt( 0, color_top );
	grad.setColorAt( 1, palette().color( QPalette::Active,
						QPalette::Window ).
							light( 80 ) );
	p.setBrush( grad );
	p.drawRoundRect( 0, 0, width() - 1, height() - 1,
					ROUNDED / width(), ROUNDED / height() );
	if( m_toolButton )
	{
		QPoint pt = m_toolButton->mapToGlobal( QPoint( 0, 0 ) );
		p.setPen( color_top );
		p.setBrush( color_top );
		p.setRenderHint( QPainter::Antialiasing, FALSE );
		p.drawLine( pt.x() - x(), 0,
				pt.x() + m_toolButton->width() - x() - 2, 0 );
		const int dx = pt.x() - x();
		p.setRenderHint( QPainter::Antialiasing, TRUE );
		if( dx < 10 && dx >= 0 )
		{
			p.setPen( pen );
			p.drawImage( dx+1, 0, m_bg.copy( 20, 0, 10-dx, 10 ) );
			p.drawImage( dx, 0, m_bg.copy( 0, 10, 1, 10-dx*2 ) );
		}
	}
	p.setPen( Qt::black );

	p.drawImage( MARGIN, MARGIN, m_icon );
	QFont f = p.font();
	f.setBold( TRUE );
	p.setFont( f );
	const int title_x = MARGIN + m_icon.width() + MARGIN;
	const int title_y = MARGIN + fontMetrics().height() - 2;
	p.drawText( title_x, title_y, m_title );

	f.setBold( FALSE );
	p.setFont( f );
	p.drawText( QRect( title_x, title_y + MARGIN,
					width() - MARGIN - title_x,
					height() - MARGIN - title_y ),
					Qt::TextWordWrap, m_description );

	updateMask();
	QWidget::resizeEvent( _re );
}
예제 #15
0
void EditorMagnifierItem::paint(QPainter *                      painter,
                                const QStyleOptionGraphicsItem *option,
                                QWidget *                       widget)
{
    Q_UNUSED(option);
    Q_UNUSED(widget);

    if ( !scene() )
        return;

    QRectF rect = getRect();

    EditorScene *scn = qobject_cast<EditorScene *>( scene() );
    if (rect.isValid() && m_valid && scn)
    {
        updateMask();
        painter->save(); // because clipping is active !!

        QPainterPath clipPath;
        clipPath.addEllipse(getRect().center(), getRect().width() / 2,getRect().width() / 2);
        painter->setClipPath(clipPath);
        painter->setClipping(true);

        // TODO add extracted image to a cache !!!
        QRectF extractRect( rect.translated( pos() - scn->getUnderlayOffset() ) );
        int extractWidth = extractRect.width() / m_magnifyingFactor;
        extractRect.adjust(extractWidth,extractWidth,-extractWidth,-extractWidth);

        QRectF bgRect = scn->getUnderlayImage().rect();

        QRectF croppedRect = extractRect.intersected(bgRect);
        if ( !croppedRect.isNull() )
        {
            QImage background = scn->getUnderlayImage().copy( croppedRect.toRect() );
            QImage mag = background.scaled(rect.size().toSize(),Qt::KeepAspectRatio,Qt::SmoothTransformation);
            painter->drawImage(rect,mag);
        }

        painter->drawPixmap(rect.topLeft(), m_imgMask);
        painter->restore();
    }

    // draw a box if selected
    if( isSelected() )
    {
        painter->save();

        QPen pen;
        pen.setCosmetic(true);
        pen.setColor(Qt::black);
        pen.setWidth(1);
        pen.setStyle(Qt::DotLine);
        painter->setPen(pen);
        painter->drawRect(rect);
        painter->restore();
    }
}
예제 #16
0
void
LauncherContextualMenu::resizeEvent(QResizeEvent* event)
{
    QMenu::resizeEvent(event);
    /* If transparent windows are not available use the XShape extension */
    if (!transparencyAvailable()) {
        updateMask();
    }
}
예제 #17
0
void Stack::setFooterVisible(bool visible)
{
	visible |= Preferences::instance().alwaysShowFooter();
	int footer_visible = visible * -m_footer_margin;
	if (m_footer_visible != footer_visible) {
		emit footerVisible(visible);
		m_footer_visible = footer_visible;
		updateMask();
	}
}
예제 #18
0
void Stack::setHeaderVisible(bool visible)
{
	visible |= Preferences::instance().alwaysShowHeader();
	int header_visible = visible * m_header_margin;
	if (m_header_visible != header_visible) {
		emit headerVisible(visible);
		m_header_visible = header_visible;
		updateMask();
	}
}
예제 #19
0
/*!
  If set to TRUE (the default) the progress bar always shows the indicator
  text at the center of the progress bar, regardless of the GUI style
  currently set.  If set to FALSE the progress bar always shows the
  indicator text outside the progress bar, regardless of the GUI style
  currently set.

  Calling this function always sets indicatorFollowsStyle() to FALSE.

  \sa centerIndicator(), indicatorFollowsStyle(), setIndicatorFollowsStyle(),
      setIndicator()
 */
void QProgressBar::setCenterIndicator( bool on )
{
    if ( !auto_indicator && on == center_indicator )
	return;
    auto_indicator   = FALSE;
    center_indicator = on;
    repaint( FALSE );
    if ( autoMask() )
	updateMask();
}
예제 #20
0
void AnalogClock::timeout()
{
    QTime old_time = time;
    time = QTime::currentTime();
    if ( old_time.minute() != time.minute() 
	|| old_time.hour() != time.hour() ) {	// minute or hour has changed
	if (autoMask())
	    updateMask();
	else
	    update();
    }
}
예제 #21
0
void ICMainWindow::paintEvent(QPaintEvent* event)
{
    Q_UNUSED(event);

    updateMask();

    QPainter painter(this);
    painter.setRenderHint(QPainter::Antialiasing);
    painter.setPen(QPen(QBrush(QColor(51, 153, 255)), 2.0));
    painter.setBrush(QBrush(QColor(252, 252, 252)));
    painter.drawRoundedRect(rect().adjusted(2,1,-2,-1), 5, 5);
}
예제 #22
0
void QProgressBar::setTotalSteps( int totalSteps )
{
    bool clear = totalSteps != total_steps;
    total_steps = totalSteps;
    if ( isVisible() ) {
	if ( setIndicator(progress_str, progress_val, total_steps) ) {
	    repaint( clear );
	    if ( autoMask() )
		updateMask();
	}
    }
}
예제 #23
0
void QFrame::resizeEvent( QResizeEvent *e )
{
    if ( !frect.isNull() ) {
	QRect r( frect.x(), frect.y(),
		 width()  - (e->oldSize().width()  - frect.width()),
		 height() - (e->oldSize().height() - frect.height()) );
	setFrameRect( r );
    }

    if ( autoMask())
	updateMask();
}
예제 #24
0
void
SimdLoopInst::execute (SimdBoolMask &mask, SimdXContext &xcontext) const
{
    SimdBoolMask loopMask (mask.isVarying());

    if (loopMask.isVarying())
    {
	for (int i = xcontext.regSize(); --i >= 0;)
	    loopMask[i] = mask[i];
    }
    else
    {
	loopMask[0] = mask[0];
    }

    bool takeLoopPath;

    do
    {
	_conditionPath->executePath (loopMask, xcontext);

	takeLoopPath = false;

	const SimdReg &condition = xcontext.stack().regSpRelative (-1);

	if (condition.isVarying())
	{
	    loopMask.setVarying (true);

	    for (int i = xcontext.regSize(); --i >= 0;)
	    {
		loopMask[i] &= *(bool*)(condition[i]);
		takeLoopPath |= loopMask[i];
	    }

	    tryToMakeUniform (loopMask, xcontext);
	}
	else
	{
	    takeLoopPath = *(bool*)(condition[0]);
	}

	xcontext.stack().pop (1);

	if (takeLoopPath)
	{
	    _loopPath->executePath (loopMask, xcontext);
	    if( updateMask(mask, loopMask, xcontext.returnMask(), xcontext) )
		break;
	}
    }
    while (takeLoopPath );
}
void UBDesktopAnnotationController::refreshMask()
{
    if(mIsFullyTransparent
            || UBDrawingController::drawingController()->stylusTool() == UBStylusTool::Selector
            //Needed to work correctly when another actions on stylus are checked
            || UBDrawingController::drawingController()->stylusTool() == UBStylusTool::Eraser
            || UBDrawingController::drawingController()->stylusTool() == UBStylusTool::Pointer
            || UBDrawingController::drawingController()->stylusTool() == UBStylusTool::Pen
            || UBDrawingController::drawingController()->stylusTool() == UBStylusTool::Marker)
    {
        updateMask(true);
    }
}
예제 #26
0
void MainWindow::resizeEvent(QResizeEvent *event)
{
	if (!(windowState() & Qt::WindowMaximized))
		currentSize = size();

	drawingWindow->updatePosition(this);
 	historyWindow->updatePosition(this);
	contactList->updatePosition(this);

	updateMask();
	
	QMainWindow::resizeEvent(event);
}
  // What we want to do here is to look at all the points that are *not* included in the indices list,
  // (i.e. these are the outliers, the points not on the floor) and determine which are the closest to the camera
  void cloudIndicesModelCallback(const sensor_msgs::PointCloud2ConstPtr& cloud_msg,
                                 const PointIndicesConstPtr& indices, const pcl::ModelCoefficientsConstPtr& model)
  {
    boost::mutex::scoped_lock lock (callback_mutex);
    NODELET_DEBUG_STREAM("Got cloud with timestamp " << cloud_msg->header.stamp << " + indices with timestamp "
        << indices->header.stamp << " + model with timestamp " << model->header.stamp);

    double dt;
    if (first)
    {
      first = false;
      dt = 0;
    }
    else
    {
      dt = (cloud_msg->header.stamp - prev_cloud_time).toSec();
      prev_cloud_time = cloud_msg->header.stamp;
    }
    if (model->values.size() > 0)
    {
      // Determine altitude:
      kinect_z = reject_outliers(-fabs(model->values[3])) - imu_to_kinect_offset;
      calcVelocity(kinect_z, dt, kinect_vz);
      // Detect obstacles:
      pcl::PointXYZ obstacle_location;
      bool obstacle_found = detectObstacle(cloud_msg, indices, model, obstacle_location);
      if (obstacle_found)
      {
        publishObstacleMarker(obstacle_location);
        NODELET_DEBUG("Detected obstacle at: [%f, %f, %f]", obstacle_location.x, obstacle_location.y,
                      obstacle_location.z);
      }
      publishObstacle(obstacle_found, obstacle_location);
    }
    else
    {
      NODELET_WARN("No planar model found -- cannot determine altitude or obstacles");
    }

    updateMask();

    if (not use_backup_estimator_alt)
    {
      publishOdom();
    }

    if (debug_throttle_rate > 0)
    {
      ros::Duration(1 / debug_throttle_rate).sleep();
    }
  }
예제 #28
0
void
LauncherContextualMenu::setFolded(int folded)
{
    if (folded == m_folded) {
        return;
    }

    if (folded) {
        /* Remove all actions but the title. */
        for (int i = actions().size(); i > 0; --i) {
            QAction* action = actions().at(i - 1);
            if (action != m_titleAction) {
                removeAction(action);
                if (action->parent() == this) {
                    /* Delete the action only if we "own" it,
                       otherwise let its parent take care of it. */
                    delete action;
                }
            }
        }
    } else {
        int prevWidth = width();
        int left = x(), top = y();
        addSeparator();
        m_launcherItem->createMenuActions();

        QRect screenGeometry = QApplication::desktop()->screenGeometry(this);
        if (QApplication::isRightToLeft()) {
            left -= width() - prevWidth;
        }
        if (height() <= screenGeometry.height()) {
            /* Adjust the position of the menu only if it fits entirely on the screen. */
            int menuBottomEdge = y() + height();
            int screenBottomEdge = screenGeometry.y() + screenGeometry.height();
            if (menuBottomEdge > screenBottomEdge) {
                /* The menu goes offscreen, shift it upwards. */
                m_arrowY += menuBottomEdge - screenBottomEdge;
                top = screenBottomEdge - height();
            }
        }
        move(left, top);
        if (!transparencyAvailable()) {
            /* The arrow has moved relatively to the menu. */
            updateMask();
        }
    }

    m_folded = folded;

    Q_EMIT foldedChanged(m_folded);
}
예제 #29
0
void Spacer::setOrientation( Qt::Orientation o )
{
    if ( orient == o )
 	return;
	
    SizeType st = sizeType();
    orient = o;
    setSizeType( st );
    if ( ar )
	resize( QSize( size().height(), size().width() ) );
    updateMask();
    update();
    updateGeometry();
}
예제 #30
0
ToolButtonTip::ToolButtonTip( const QPixmap & _pixmap, const QString & _title,
				const QString & _description,
				QWidget * _parent, QWidget * _tool_btn ) :
	QWidget( _parent, Qt::ToolTip ),
	m_icon( FastQImage( _pixmap ).scaled( 72, 72 ) ),
	m_title( _title ),
	m_description( _description ),
	m_toolButton( _tool_btn )
{
	setAttribute( Qt::WA_DeleteOnClose, TRUE );
	setAttribute( Qt::WA_NoSystemBackground, TRUE );

	resize( sizeHint() );
	updateMask();
}