treeview-bold-text-v2.patch
| src/qtui/playlist-qt.cc | ||
|---|---|---|
| 38 | 38 |
model(new PlaylistModel(this, playlist)), |
| 39 | 39 |
proxyModel(new PlaylistProxyModel(this, playlist)) |
| 40 | 40 |
{
|
| 41 |
model->setFont(font()); |
|
| 42 | ||
| 41 | 43 |
/* setting up filtering model */ |
| 42 | 44 |
proxyModel->setSourceModel(model); |
| 43 | 45 | |
| ... | ... | |
| 126 | 128 |
} |
| 127 | 129 |
} |
| 128 | 130 | |
| 131 |
void PlaylistWidget::changeEvent(QEvent * event) |
|
| 132 |
{
|
|
| 133 |
if (event->type() == QEvent::FontChange) |
|
| 134 |
model->setFont(font()); |
|
| 135 | ||
| 136 |
audqt::TreeView::changeEvent(event); |
|
| 137 |
} |
|
| 138 | ||
| 129 | 139 |
void PlaylistWidget::contextMenuEvent(QContextMenuEvent * event) |
| 130 | 140 |
{
|
| 131 | 141 |
if (contextMenu) |
| src/qtui/playlist-qt.h | ||
|---|---|---|
| 70 | 70 |
void updateSelection(int rowsBefore, int rowsAfter); |
| 71 | 71 | |
| 72 | 72 |
void activate(const QModelIndex & index); |
| 73 |
void changeEvent(QEvent * event); |
|
| 73 | 74 |
void contextMenuEvent(QContextMenuEvent * event); |
| 74 | 75 |
void keyPressEvent(QKeyEvent * event); |
| 75 | 76 |
void mouseMoveEvent(QMouseEvent * event); |
| src/qtui/playlist_model.cc | ||
|---|---|---|
| 64 | 64 |
return 1 + n_cols; |
| 65 | 65 |
} |
| 66 | 66 | |
| 67 |
void PlaylistModel::setFont(const QFont & font) |
|
| 68 |
{
|
|
| 69 |
m_bold = font; |
|
| 70 |
m_bold.setBold(true); |
|
| 71 |
} |
|
| 72 | ||
| 67 | 73 |
QVariant PlaylistModel::alignment(int col) const |
| 68 | 74 |
{
|
| 69 | 75 |
switch (col) |
| ... | ... | |
| 121 | 127 |
return QString("%1").arg(val);
|
| 122 | 128 |
} |
| 123 | 129 | |
| 130 |
case Qt::FontRole: |
|
| 131 |
if (index.row() == m_playlist.get_position()) |
|
| 132 |
return m_bold; |
|
| 133 |
break; |
|
| 134 | ||
| 124 | 135 |
case Qt::TextAlignmentRole: |
| 125 | 136 |
return alignment(col); |
| 126 | 137 | |
| src/qtui/playlist_model.h | ||
|---|---|---|
| 70 | 70 |
void entriesRemoved(int row, int count); |
| 71 | 71 |
void entriesChanged(int row, int count); |
| 72 | 72 | |
| 73 |
void setFont(const QFont & font); |
|
| 74 | ||
| 73 | 75 |
private: |
| 74 | 76 |
Playlist m_playlist; |
| 75 | 77 |
int m_rows; |
| 78 |
QFont m_bold; |
|
| 76 | 79 | |
| 77 | 80 |
QVariant alignment(int col) const; |
| 78 | 81 |
QString queuePos(int row) const; |
