Beispiel #1
0
void SvgItem::setSvg(Plasma::Svg *svg)
{
    if (m_svg) {
        disconnect(m_svg.data(), 0, this, 0);
    }
    m_svg = svg;
    updateDevicePixelRatio();

    if (svg) {
        connect(svg, SIGNAL(repaintNeeded()), this, SLOT(updateNeeded()));
        connect(svg, SIGNAL(repaintNeeded()), this, SIGNAL(naturalSizeChanged()));
        connect(svg, SIGNAL(sizeChanged()), this, SIGNAL(naturalSizeChanged()));
    }

    if (implicitWidth() <= 0) {
        setImplicitWidth(naturalSize().width());
    }
    if (implicitHeight() <= 0) {
        setImplicitHeight(naturalSize().height());
    }

    scheduleImageUpdate();

    emit svgChanged();
    emit naturalSizeChanged();
}
Beispiel #2
0
PopupLayer::PopupLayer( MarbleWidget *marbleWidget, QObject *parent ) :
    QObject( parent ),
    d( new Private( marbleWidget, this ) )
{
    connect( d->m_popupItem, SIGNAL(repaintNeeded()), this, SIGNAL(repaintNeeded()) );
    connect( d->m_popupItem, SIGNAL(hide()), this, SLOT(hidePopupItem()) );
}
Beispiel #3
0
Bubble::Bubble(QObject *parent, const QVariantList &args)
    :  Plasma::Applet(parent, args),
       m_showText(false),
       m_animated(true),
       m_val(0),
       m_max(0),
       m_speed(1000),
       m_bubbles(20),
       m_bubbleCount(0),
       m_labelTransparency(0),
       m_rebuildClip(true)
{
    m_svg = new Plasma::Svg(this);
    m_svg->setImagePath(Plasma::Theme::defaultTheme()->imagePath("bubblemon/bubble"));

    connect(m_svg, SIGNAL(repaintNeeded()), this, SLOT(repaintNeeded()));

    setAcceptHoverEvents(true);
    setAspectRatioMode(Plasma::Square);
    setBackgroundHints(NoBackground);
    
    m_animation = new QPropertyAnimation(this, "labelTransparency", this);
    m_animation->setDuration(200);
    m_animation->setStartValue(0.0);
    m_animation->setEndValue(1.0);
}
Beispiel #4
0
Clock::Clock(QObject *parent, const QVariantList &args)
    : ClockApplet(parent, args),
      m_showSecondHand(false),
      m_showTimezoneString(false),
      m_showingTimezone(false),
      m_tzFrame(0),
      m_repaintCache(RepaintAll),
      m_faceCache(QPixmap()),
      m_handsCache(QPixmap()),
      m_glassCache(QPixmap()),
      m_secondHandUpdateTimer(0),
      m_animateSeconds(false)
{
    KGlobal::locale()->insertCatalog("libplasmaclock");
    // this catalog is only used once on the first start of the clock to translate the timezone in the configuration file
    KGlobal::locale()->insertCatalog("timezones4");
    setHasConfigurationInterface(true);
    resize(256, 256);
    setAspectRatioMode(Plasma::Square);
    setBackgroundHints(NoBackground);

    m_theme = new Plasma::Svg(this);
    m_theme->setImagePath("widgets/clock");
    m_theme->setContainsMultipleImages(true);
    m_theme->resize(size());

    connect(m_theme, SIGNAL(repaintNeeded()), this, SLOT(repaintNeeded()));
}
Beispiel #5
0
void PopupLayer::setVisible( bool visible )
{
    d->m_popupItem->setVisible( visible );
    if ( !visible ) {
        disconnect( d->m_popupItem, SIGNAL(repaintNeeded()), this, SIGNAL(repaintNeeded()) );
        d->m_popupItem->clearHistory();
        emit repaintNeeded();
    }
    else {
        connect( d->m_popupItem, SIGNAL(repaintNeeded()), this, SIGNAL(repaintNeeded()) );
    }
}
Beispiel #6
0
void MeasureToolPlugin::writeSettings()
{
    m_showSegmentLabels = m_uiConfigWidget->m_showSegLabelsCheckBox->isChecked();

    emit settingsChanged( nameId() );
    emit repaintNeeded();
}
bool QFormulatorRenderer::reload()
{
	m_isValid = (m_engine->refreshViaMathML() == 1);
	if( m_isValid )
		emit repaintNeeded();
	return m_isValid;
}
bool QFormulatorRenderer::load(const QString& filename)
{
	m_isValid = (m_engine->fileOpenSilent( filename ) == 1);
	if( m_isValid )
		emit repaintNeeded();
	return m_isValid;
}
Beispiel #9
0
PushButton::PushButton(QGraphicsWidget *parent)
    : QGraphicsProxyWidget(parent),
      d(new PushButtonPrivate(this))
{
    d->background = new FrameSvg(this);
    d->background->setImagePath("widgets/button");
    d->background->setCacheAllRenderedFrames(true);

    d->background->setElementPrefix("normal");

    d->hoverAnimation = Animator::create(Animator::PixmapTransitionAnimation);
    d->hoverAnimation->setTargetWidget(this);

    KPushButton *native = new KPushButton;
    connect(native, SIGNAL(pressed()), this, SIGNAL(pressed()));
    connect(native, SIGNAL(pressed()), this, SLOT(pressedChanged()));
    connect(native, SIGNAL(released()), this, SIGNAL(released()));
    connect(native, SIGNAL(released()), this, SLOT(pressedChanged()));
    connect(native, SIGNAL(clicked()), this, SIGNAL(clicked()));
    connect(native, SIGNAL(toggled(bool)), this, SIGNAL(toggled(bool)));
    setWidget(native);
    native->setAttribute(Qt::WA_NoSystemBackground);
    native->setWindowIcon(QIcon());

    setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);

    d->focusIndicator = new FocusIndicator(this, d->background);

    d->syncBorders();
    setAcceptHoverEvents(true);

    connect(d->background, SIGNAL(repaintNeeded()), SLOT(syncBorders()));
    d->initTheming();
    d->syncFrame();
}
Beispiel #10
0
void NavigationButton::changeEvent( QEvent *e )
{
    if ( e->type() == QEvent::EnabledChange ) {
        m_iconMode = isEnabled() ? QIcon::Normal : QIcon::Disabled;
    }
    emit repaintNeeded();
}
Beispiel #11
0
void NavigationButton::leaveEvent( QEvent * )
{
    if ( isEnabled() ) {
        m_iconMode = QIcon::Normal;
    }
    emit repaintNeeded();
}
Beispiel #12
0
void Speedometer::updateLocation( const GeoDataCoordinates& coordinates, qreal speed )
{
    Q_UNUSED( coordinates );

    speed *= METER2KM / SEC2HOUR;
    QString speedUnit;

    switch ( m_locale->measurementSystem() ) {
    case MarbleLocale::ImperialSystem:
        //miles per hour
        speedUnit = tr("mph");
        speed *= KM2MI;
        break;

    case MarbleLocale::MetricSystem:
        //kilometers per hour
        speedUnit = tr("km/h");
        break;

    case MarbleLocale::NauticalSystem:
        // nm per hour (kt)
        speedUnit = tr("kt");
        speed *= KM2NM;
        break;
    }

    m_widget.speed->display( speed );
    m_widget.speedUnit->setText( speedUnit );

    update();
    emit repaintNeeded();
}
Beispiel #13
0
GLWidget::GLWidget(QWidget *parent)
    : QGLWidget(QGLFormat(QGL::SampleBuffers|QGL::AlphaChannel), parent)
{
    setWindowTitle(tr("OpenGL framebuffer objects"));
    makeCurrent();
    fbo = new QGLFramebufferObject(1024, 1024);
    rot_x = rot_y = rot_z = 0.0f;
    scale = 0.1f;
    anim = new QTimeLine(750, this);
    anim->setUpdateInterval(20);
    connect(anim, SIGNAL(valueChanged(qreal)), SLOT(animate(qreal)));
    connect(anim, SIGNAL(finished()), SLOT(animFinished()));

    svg_renderer = new QSvgRenderer(QLatin1String(":/res/bubbles.svg"), this);
    connect(svg_renderer, SIGNAL(repaintNeeded()), this, SLOT(draw()));

    logo = QImage(":/res/designer.png");
    logo = logo.convertToFormat(QImage::Format_ARGB32);

    tile_list = glGenLists(1);
    glNewList(tile_list, GL_COMPILE);
    glBegin(GL_QUADS);
    {
        glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f,  1.0f);
        glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -1.0f,  1.0f);
        glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f,  1.0f,  1.0f);
        glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f,  1.0f,  1.0f);

        glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f);
        glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f,  1.0f, -1.0f);
        glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f,  1.0f, -1.0f);
        glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f);

        glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f,  1.0f, -1.0f);
        glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f,  1.0f,  1.0f);
        glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f,  1.0f,  1.0f);
        glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f,  1.0f, -1.0f);

        glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, -1.0f, -1.0f);
        glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, -1.0f, -1.0f);
        glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f,  1.0f);
        glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f,  1.0f);

        glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f);
        glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f,  1.0f, -1.0f);
        glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f,  1.0f,  1.0f);
        glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f,  1.0f);

        glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f);
        glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f,  1.0f);
        glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f,  1.0f,  1.0f);
        glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f,  1.0f, -1.0f);
    }
    glEnd();
    glEndList();

    wave = new GLfloat[logo.width()*logo.height()];
    memset(wave, 0, logo.width()*logo.height());
    startTimer(30); // wave timer
}
Beispiel #14
0
void ProgressFloatItem::show()
{
    setActive( true );

    update();
    emit repaintNeeded( QRegion() );
}
void GLC_MoverController::setActiveMover(const int id, const GLC_UserInput& userInput)
{
	Q_ASSERT(m_MoverHash.contains(id));
	m_ActiveMoverId= id;
	connect(m_MoverHash.value(m_ActiveMoverId), SIGNAL(updated()), this, SIGNAL(repaintNeeded()));
	m_MoverHash.value(m_ActiveMoverId)->init(userInput);
}
Beispiel #16
0
Shadows::Shadows(QObject *parent, const QString &prefix)
    : Plasma::Svg(parent),
      d(new Private(this))
{
    setImagePath(prefix);
    connect(this, SIGNAL(repaintNeeded()), this, SLOT(updateShadows()));
}
Beispiel #17
0
 void init()
 {
     Q_Q(QGraphicsSvgItem);
     renderer = new QSvgRenderer(q);
     QObject::connect(renderer, SIGNAL(repaintNeeded()),
                      q, SLOT(_q_repaintItem()));
 }
void GLC_MoverController::setActiveMover(const int id, QMouseEvent * e)
{
	Q_ASSERT(m_MoverHash.contains(id));
	m_ActiveMoverId= id;
	connect(m_MoverHash.value(m_ActiveMoverId), SIGNAL(updated()), this, SIGNAL(repaintNeeded()));
	m_MoverHash.value(m_ActiveMoverId)->init(e);
}
Beispiel #19
0
void License::updateLicenseText()
{
    const GeoSceneDocument *const mapTheme = marbleModel()->mapTheme();
    if ( !mapTheme )
        return;

    const GeoSceneHead *const head = mapTheme->head();
    if ( !head )
        return;

    const GeoSceneLicense *license = marbleModel()->mapTheme()->head()->license();
    m_label->setText( m_showFullLicense ? license->license() : license->shortLicense() );
    m_label->setToolTip( license->license() );
    if( license->attribution() == GeoSceneLicense::Always ) {
        setUserCheckable( false );
    } else if( license->attribution() == GeoSceneLicense::Never ) {
        setVisible( false );
        setUserCheckable( false );
    } else if( license->attribution() == GeoSceneLicense::OptIn ) {
        setUserCheckable( true );
        setVisible( false );
    } else {
        setUserCheckable( true );
        setVisible( true );
    }
    QSizeF const magic( 6,0 );
    m_widgetItem->setSize( m_label->sizeHint()+magic );
    setSize( m_label->sizeHint()+magic );
    update();
    emit repaintNeeded();
}
Beispiel #20
0
/*!
    Constructs a new SVG display widget with the given \a parent.
*/
QSvgWidget::QSvgWidget(QWidget *parent)
    : QWidget(*new QSvgWidgetPrivate, parent, 0)
{
    d_func()->renderer = new QSvgRenderer(this);
    QObject::connect(d_func()->renderer, SIGNAL(repaintNeeded()),
                     this, SLOT(update()));
}
void MeasureToolPlugin::writeSettings()
{
    m_showDistanceLabel = m_configDialog->showDistanceLabels();
    m_showBearingLabel = m_configDialog->showBearingLabel();
    m_showBearingChangeLabel = m_configDialog->showBearingLabelChange();
    m_showPolygonArea = m_configDialog->showPolygonArea();
    m_showCircularArea = m_configDialog->showCircularArea();
    m_showRadius = m_configDialog->showRadius();
    m_showPerimeter = m_configDialog->showPerimeter();
    m_showCircumference = m_configDialog->showCircumference();
    m_paintMode = (PaintMode)m_configDialog->paintMode();

    if (m_paintMode == Circular) {
        if (m_measureLineString.size() < 2) {
            m_addMeasurePointAction->setEnabled(true);
        } else {
            m_addMeasurePointAction->setEnabled(false);
            while (m_measureLineString.size() > 2)
                m_measureLineString.remove(m_measureLineString.size()-1);
        }
    } else {
        m_addMeasurePointAction->setEnabled(true);
    }

    emit settingsChanged( nameId() );
    emit repaintNeeded();
}
Beispiel #22
0
void NavigationButton::enterEvent(QEvent *)
{
    if ( isEnabled() ) {
        m_iconMode = QIcon::Active;
    }
    emit repaintNeeded();
}
void ElevationProfileFloatItem::forceRepaint()
{
    // We add one pixel as antialiasing could result into painting on these pixels to.
    QRectF floatItemRect = QRectF( positivePosition() - QPoint( 1, 1 ),
                                   size() + QSize( 2, 2 ) );
    update();
    emit repaintNeeded( floatItemRect.toRect() );
}
Beispiel #24
0
Flags::~Flags()
{
    if( svg != NULL ) {
        disconnect(svg, SIGNAL(repaintNeeded()), this, SLOT(themeChanged()));
        delete svg;
    }
    delete transparentPixmap;
}
bool QFormulatorRenderer::load(const QByteArray& contents)
{
	m_engine->clear();
	m_isValid = (m_engine->insertMathML( __FMLCORE_Product_Title, QString(contents), 0 ) == 1);
	if( m_isValid )
		emit repaintNeeded();
	return m_isValid;
}
Beispiel #26
0
FrameSvgItemMargins::FrameSvgItemMargins(Plasma::FrameSvg *frameSvg, QObject *parent)
    : QObject(parent),
      m_frameSvg(frameSvg),
      m_fixed(false)
{
    //qDebug() << "margins at: " << left() << top() << right() << bottom();
    connect(m_frameSvg, SIGNAL(repaintNeeded()), this, SLOT(update()));
}
Beispiel #27
0
void NavigationButton::mouseReleaseEvent ( QMouseEvent * )
{
    if ( isEnabled() ) {
        m_iconMode = QIcon::Active;
        emit clicked();
    }
    emit repaintNeeded();
}
Beispiel #28
0
void ProgressFloatItem::hideProgress()
{
    if ( enabled() ) {
        setActive( false );

        update();
        emit repaintNeeded( QRegion() );
    }
}
Beispiel #29
0
void PlacemarkLayout::resetCacheData()
{
    const int rowCount = m_placemarkModel.rowCount();

    m_placemarkCache.clear();
    requestStyleReset();
    addPlacemarks( m_placemarkModel.index( 0, 0 ), 0, rowCount );
    emit repaintNeeded();
}
void GLC_MoverController::setNoMover()
{
	if (0 != m_ActiveMoverId)
	{
		m_MoverHash.value(m_ActiveMoverId)->ends();
		disconnect(m_MoverHash.value(m_ActiveMoverId), SIGNAL(updated()), this, SIGNAL(repaintNeeded()));
		m_ActiveMoverId= 0;
	}
}