Commit 1226b52f authored by Scott Wheeler's avatar Scott Wheeler

This is a slightly cleaner hack that also works in the case of just one

visible item.

svn path=/trunk/KDE/kdemultimedia/juk/; revision=421816
parent 721b50d7
......@@ -77,30 +77,22 @@ void PlaylistSplitter::slotFocusCurrentPlaylist()
// Select top item.
// Select the top visible (and matching) item.
PlaylistItem *item = static_cast<PlaylistItem *>(playlist->itemAt(QPoint(0, 0)));
// A little bit of a hack to make QListView repaint things properly. Switch
// to single selection mode, set the selection and then switch back.
playlist->markItemSelected(item, true);
// STUPID FREAKING EVIL HACK because QListView hates me and you.
// Apparently all of the selecting items and setting current items
// that we just did works, but doesn't update the GUI (even after
// calling repaint). So let's simulate some user interaction.
QKeyEvent downP(QEvent::KeyPress, Qt::Key_Down, 32, 0);
QKeyEvent downR(QEvent::KeyRelease, Qt::Key_Down, 32, 0);
QKeyEvent upP (QEvent::KeyPress, Qt::Key_Up, 32, 0);
QKeyEvent upR (QEvent::KeyRelease, Qt::Key_Up, 32, 0);
KApplication::sendEvent(playlist, &downP);
KApplication::sendEvent(playlist, &downR);
KApplication::sendEvent(playlist, &upP);
KApplication::sendEvent(playlist, &upR);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment