~ubuntu-branches/ubuntu/lucid/kdebase/lucid

« back to all changes in this revision

Viewing changes to apps/dolphin/src/selectiontoggle.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Steve Stalcup
  • Date: 2009-06-03 23:42:46 UTC
  • mto: This revision was merged to the branch mainline in revision 242.
  • Revision ID: james.westby@ubuntu.com-20090603234246-lt9inobn80tnv1o3
Tags: upstream-4.2.90
ImportĀ upstreamĀ versionĀ 4.2.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
149
149
    m_leftMouseButtonPressed = (event->buttons() & Qt::LeftButton);
150
150
}
151
151
 
 
152
void SelectionToggle::resizeEvent(QResizeEvent* event)
 
153
{
 
154
    QAbstractButton::resizeEvent(event);
 
155
    setIconOverlay(isChecked());
 
156
}
 
157
 
152
158
void SelectionToggle::paintEvent(QPaintEvent* event)
153
159
{
154
160
    QPainter painter(this);
155
161
    painter.setClipRect(event->rect());
156
 
    painter.setRenderHint(QPainter::Antialiasing);
157
 
 
158
 
    // draw an alpha blended circle as background
159
 
    const QPalette& palette = parentWidget()->palette();
160
 
 
161
 
    const QBrush& backgroundBrush = palette.brush(QPalette::Normal, QPalette::Window);
162
 
    QColor background = backgroundBrush.color();
163
 
    background.setAlpha(m_fadingValue / 2);
164
 
    painter.setBrush(background);
165
 
 
166
 
    const QBrush& foregroundBrush = palette.brush(QPalette::Normal, QPalette::WindowText);
167
 
    QColor foreground = foregroundBrush.color();
168
 
    foreground.setAlpha(m_fadingValue / 4);
169
 
    painter.setPen(foreground);
170
 
 
171
 
    painter.drawEllipse(0, 0, width(), height());
172
162
 
173
163
    // draw the icon overlay
174
164
    if (m_isHovered) {
206
196
    const char* icon = checked ? "list-remove" : "list-add";
207
197
    m_icon = KIconLoader::global()->loadIcon(icon,
208
198
                                             KIconLoader::NoGroup,
209
 
                                             KIconLoader::SizeSmall);
 
199
                                             qMin(width(), height()));
210
200
    update();
211
201
}
212
202