|
3 | 3 | #include <QGridLayout> |
4 | 4 | #include <QHeaderView> |
5 | 5 |
|
| 6 | +#include "theme.h" |
| 7 | + |
6 | 8 | WarpConstraintItem::WarpConstraintItem(const Warp::Constraint &constraint) : m_constraint(constraint) |
7 | 9 | { |
8 | 10 | QString guidStr = QString::fromStdString(constraint.guid.ToString()); |
@@ -39,11 +41,16 @@ QVariant WarpConstraintItemModel::data(const QModelIndex &index, int role) const |
39 | 41 | { |
40 | 42 | auto itemConstraint = item->GetConstraint(); |
41 | 43 | // TODO: We really should store the guid in a hashmap or something instead of looping over it for every item. |
42 | | - // TODO: A less intense green? |
43 | 44 | // TODO: Take into account the constraint offset. |
44 | 45 | for (const auto &constraint: m_matchedConstraints) |
45 | | - if (constraint.guid == itemConstraint.guid) |
46 | | - return QBrush(Qt::green); |
| 46 | + { |
| 47 | + if (constraint.offset == itemConstraint.offset) |
| 48 | + { |
| 49 | + static QColor matchedColor = getThemeColor(GreenStandardHighlightColor); |
| 50 | + matchedColor.setAlpha(128); |
| 51 | + return matchedColor; |
| 52 | + } |
| 53 | + } |
47 | 54 | } |
48 | 55 | } |
49 | 56 |
|
@@ -83,6 +90,11 @@ WarpConstraintTableWidget::WarpConstraintTableWidget(QWidget *parent) |
83 | 90 | m_table->horizontalHeader()->hide(); |
84 | 91 | // Decrease row height to make it look nice. |
85 | 92 | m_table->verticalHeader()->setDefaultSectionSize(30); |
| 93 | + |
| 94 | + // Make the highlight less bright. |
| 95 | + QPalette palette = m_table->palette(); |
| 96 | + palette.setColor(QPalette::Highlight, getThemeColor(SelectionColor)); |
| 97 | + m_table->setPalette(palette); |
86 | 98 | } |
87 | 99 |
|
88 | 100 | void WarpConstraintTableWidget::SetConstraints(QVector<WarpConstraintItem *> constraints) |
|
0 commit comments