Draw 10% opacity icon behind view, so as to give a better hint as to which list is which.
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
#include "musiclibraryproxymodel.h"
|
||||
#include <KDE/KAction>
|
||||
#include <KDE/KLocale>
|
||||
#include <KDE/KIcon>
|
||||
|
||||
SyncCollectionWidget::SyncCollectionWidget(QWidget *parent, const QString &title, const QString &action)
|
||||
: QWidget(parent)
|
||||
@@ -53,6 +54,11 @@ SyncCollectionWidget::~SyncCollectionWidget()
|
||||
{
|
||||
}
|
||||
|
||||
void SyncCollectionWidget::setIcon(const QString &iconName)
|
||||
{
|
||||
tree->setPixmap(KIcon(iconName).pixmap(128, 128));
|
||||
}
|
||||
|
||||
void SyncCollectionWidget::update(const QSet<Song> &songs)
|
||||
{
|
||||
model->update(songs);
|
||||
|
||||
@@ -39,6 +39,7 @@ public:
|
||||
SyncCollectionWidget(QWidget *parent, const QString &title, const QString &action);
|
||||
virtual ~SyncCollectionWidget();
|
||||
|
||||
void setIcon(const QString &iconName);
|
||||
void update(const QSet<Song> &songs);
|
||||
int numArtists();
|
||||
|
||||
|
||||
@@ -164,6 +164,10 @@ bool SyncDialog::updateSongs(bool showMessage)
|
||||
}
|
||||
devWidget->update(inDev);
|
||||
libWidget->update(inLib);
|
||||
if (!isVisible()) {
|
||||
devWidget->setIcon(dev->icon());
|
||||
libWidget->setIcon("cantata-view-media-library");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
|
||||
#include "treeview.h"
|
||||
#include <QtGui/QMouseEvent>
|
||||
#include <QtGui/QPaintEvent>
|
||||
#include <QtGui/QPainter>
|
||||
#include <QtCore/QMap>
|
||||
|
||||
TreeView::TreeView(QWidget *parent)
|
||||
@@ -126,3 +128,14 @@ void TreeView::correctSelection()
|
||||
setCurrentIndex(currentIndex());
|
||||
selectionModel()->select(s, QItemSelectionModel::SelectCurrent);
|
||||
}
|
||||
|
||||
void TreeView::paintEvent(QPaintEvent *e)
|
||||
{
|
||||
QTreeView::paintEvent(e);
|
||||
|
||||
if (!pixmap.isNull()) {
|
||||
QPainter p(viewport());
|
||||
p.setOpacity(0.1);
|
||||
p.drawPixmap((width() - pixmap.width())/2, (height() - pixmap.height())/2, pixmap);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#define TREEVIEW_H
|
||||
|
||||
#include <QtGui/QTreeView>
|
||||
#include <QtGui/QPixmap>
|
||||
|
||||
class TreeView : public QTreeView
|
||||
{
|
||||
@@ -44,12 +45,19 @@ public:
|
||||
void expandAll();
|
||||
void expand(const QModelIndex &idx);
|
||||
virtual void setModel(QAbstractItemModel *m);
|
||||
void setPixmap(const QPixmap &pix) {
|
||||
pixmap=pix;
|
||||
}
|
||||
void paintEvent(QPaintEvent *e);
|
||||
|
||||
private Q_SLOTS:
|
||||
void correctSelection();
|
||||
|
||||
Q_SIGNALS:
|
||||
bool itemsSelected(bool);
|
||||
|
||||
private:
|
||||
QPixmap pixmap;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user