void PopupMessage::timerEvent(QTimerEvent*) { switch(m_maskEffect) { case Plain: plainMask(); break; case Slide: slideMask(); break; case Dissolve: dissolveMask(); break; } }
void K3b::WidgetShowEffect::timerEvent( QTimerEvent* ) { switch( m_effect ) { case Slide: slideMask(); break; case Dissolve: dissolveMask(); break; } }
void PopupMessage::display() { m_dissolveSize = 24; m_dissolveDelta = -1; if (m_maskEffect == Dissolve) { m_mask = QPixmap(width(), height()); dissolveMask(); m_timerId = startTimer(1000 / 30); } else { m_timerId = startTimer( 6 ); } show(); }
void PopupMessage::display() //SLOT { m_dissolveSize = 24; m_dissolveDelta = -1; if( m_maskEffect == Dissolve ) { // necessary to create the mask m_mask = QBitmap( width(), height() ); // make the mask empty and hence will not show widget with show() called below dissolveMask(); m_timerId = startTimer( 1000 / 30 ); } else { m_timerId = startTimer( 6 ); } show(); }
void K3b::WidgetShowEffect::show( bool effectOnly ) { m_bShow = true; m_offset = 0; m_dissolveSize = 24; m_dissolveDelta = -1; m_widget->ensurePolished(); if( m_effect == Dissolve ) { // necessary to create the mask m_mask = QBitmap( m_widget->width(), m_widget->height() ); // make the mask empty and hence will not show widget with show() called below dissolveMask(); m_timerId = startTimer( 1000 / 30 ); } else { m_widget->move( 0, m_widget->parentWidget()->height() ); m_timerId = startTimer( 6 ); } if( !effectOnly ) m_widget->show(); }
void KalziumTip::displayInternal() { if (!m_richText) return; // determine text rectangel sizes QRect textRect(0,0,0,0); textRect.setWidth(m_richText->widthUsed()); textRect.setHeight(m_richText->height()); //moves the rect textRect.moveBy(-textRect.left(), -textRect.top()); // add the new coordinates textRect.addCoords(0,0,2,2); int margin = KDialog::marginHint(); int height = QMAX(m_icon.height(), textRect.height()) + 2 * margin; int textX = 2 + m_icon.width() + 2 * margin; int width = textX + textRect.width() + margin; int textY = (height - textRect.height()) / 2; //resize pixmap, mask and widget m_mask.resize(width, height); m_pixmap.resize(width, height); resize(width, height); // create and set transparency mask switch(m_maskEffect) { case Plain: plainMask(); break; case Dissolve: dissolveMask(); break; } // draw background QPainter bufferPainter(&m_pixmap); bufferPainter.setPen(Qt::black); bufferPainter.setBrush(backgroundColor()); bufferPainter.drawRoundRect(0, 0, width, height, 1600 / width, 1600 / height); // draw icon if present if (!m_icon.isNull()) { bufferPainter.drawPixmap(margin, margin, m_icon, 0, 0, m_icon.width(), m_icon.height()); } // draw text shadow QColorGroup cg = colorGroup(); cg.setColor(QColorGroup::Text, cg.background().dark(115)); int shadowOffset = QApplication::reverseLayout() ? -1 : 1; m_richText->draw(&bufferPainter, 5 + textX + shadowOffset, textY + 1, QRect(), cg); // draw text cg = colorGroup(); m_richText->draw(&bufferPainter, 5 + textX, textY, rect(), cg); }
void KickerTip::displayInternal() { // we need to check for m_tippingFor here as well as m_richText // since if one is really persistant and moves the mouse around very fast // you can trigger a situation where m_tippingFor gets reset to 0 but // before display() is called! if (!m_tippingFor || !m_richText) { return; } // determine text rectangle QRect textRect(0, 0, 0, 0); if (KickerSettings::mouseOversShowText()) { textRect.setWidth(m_richText->widthUsed()); textRect.setHeight(m_richText->height()); } int margin = KDialog::marginHint(); int height = QMAX(m_icon.height(), textRect.height()) + 2 * margin; int textX = m_icon.isNull() ? margin : 2 + m_icon.width() + 2 * margin; int width = textX + textRect.width() + margin; int textY = (height - textRect.height()) / 2; // resize pixmap, mask and widget bool firstTime = m_dissolveSize == 24; if (firstTime) { m_mask.resize(width, height); m_pixmap.resize(width, height); resize(width, height); if (isVisible()) { // we've already been shown before, but we may grow larger. // in the case of Up or Right displaying tips, this growth can // result in the tip occluding the panel and causing it to redraw // once we return back to display() causing horrid flicker move(KickerLib::popupPosition(m_direction, this, m_tippingFor)); } } // create and set transparency mask switch(m_maskEffect) { case Plain: plainMask(); break; case Dissolve: dissolveMask(); break; } // draw background QPainter bufferPainter(&m_pixmap); bufferPainter.setPen(Qt::black); bufferPainter.setBrush(colorGroup().background()); bufferPainter.drawRoundRect(0, 0, width, height, 1600 / width, 1600 / height); // draw icon if present if (!m_icon.isNull()) { bufferPainter.drawPixmap(margin, margin, m_icon, 0, 0, m_icon.width(), m_icon.height()); } if (KickerSettings::mouseOversShowText()) { // draw text shadow QColorGroup cg = colorGroup(); cg.setColor(QColorGroup::Text, cg.background().dark(115)); int shadowOffset = QApplication::reverseLayout() ? -1 : 1; m_richText->draw(&bufferPainter, 5 + textX + shadowOffset, textY + 1, QRect(), cg); // draw text cg = colorGroup(); m_richText->draw(&bufferPainter, 5 + textX, textY, rect(), cg); } }