35 if (event->type() == QEvent::MouseButtonPress) {
36 QMouseEvent *me =
static_cast<QMouseEvent*
>(event);
38 if (me->button() == Qt::LeftButton) {
41 const QRect visibilityIcon = option.rect.adjusted(option.rect.width() -
CHANNEL_ICON_SIZE, 0, 0, 0);
43 if (visibilityIcon.contains(me->pos())) {
44 if (me->modifiers() & Qt::ShiftModifier) {
46 if (currentlyIsolated) {
70 QPalette
palette = QApplication::palette();
77 QColor nodeBGColor = colorData.value<QColor>();
80 styleOption.widget->style()->drawPrimitive(QStyle::PE_PanelItemViewItem,
81 &styleOption, painter,
86 QString text = index.data().toString();
89 text = styleOption.fontMetrics.elidedText(text, styleOption.textElideMode, textArea.width());
90 painter->setBrush(
palette.buttonText());
91 styleOption.widget->style()->drawItemText(painter, textArea, Qt::AlignLeft | Qt::AlignVCenter, styleOption.palette,
true, text, QPalette::ButtonText);
95 QRect arrow = QRect(styleOption.widget->rect().topLeft(), styleOption.rect.bottomLeft());
96 painter->setPen(Qt::NoPen);
97 QStyleOptionViewItem item = styleOption;
99 styleOption.widget->style()->drawPrimitive(QStyle::PE_IndicatorBranch,
104 QColor color = colorData.value<QColor>();
107 newPen.setCapStyle(Qt::RoundCap);
108 painter->setPen(newPen);
111 painter->setBrush(color);
113 painter->setBrush(QBrush());
116 const int y = styleOption.rect.top() + styleOption.rect.height() / 2;
118 const QPoint right = QPoint(styleOption.rect.left(), y);
119 painter->drawLine(left, right);
124 QRect iconArea = styleOption.rect.adjusted(styleOption.rect.width() - iconSpace, 0, 0, 0);
127 visibilityIcon.paint(painter, iconArea);
135 const bool hasValidStyle = styleOption.widget ? styleOption.widget->isEnabled() : (styleOption.state & QStyle::State_Enabled);
136 QPalette::ColorGroup cg = hasValidStyle ? QPalette::Normal : QPalette::Disabled;
138 QRect viewArea = styleOption.rect;
139 const QWidget*
const widget = styleOption.widget;
141 viewArea.setLeft(widget->rect().left());
144 const QColor highlight = nodeColor.lighter(115);
145 const QColor shadow = nodeColor.darker(105);
146 painter->fillRect(viewArea, highlight);
147 painter->fillRect(viewArea.adjusted(0,6,0,0), shadow);
149 if ( (styleOption.state & QStyle::State_Selected)
150 && widget->style()->proxy()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, &styleOption, widget)) {
151 painter->fillRect(viewArea, styleOption.palette.brush(cg, QPalette::Highlight));
156 viewArea -= QMargins(0, 2, 0, 2);
157 painter->fillRect(viewArea, nodeColor);
165 const int numCurves = model->rowCount(channelIndex.parent());
166 const int clickedCurve = channelIndex.row();
167 const QModelIndex& nodeIndex = channelIndex.parent();
169 for (
int i = 0; i < numCurves; i++) {
170 if (i == clickedCurve) {
173 QModelIndex indexToToggle = model->index(i, channelIndex.column(), nodeIndex);
183 const int numCurves = model->rowCount(nodeIndex);
185 for (
int i = 0; i < numCurves; i++) {
186 QModelIndex curveIndex = model->index(i, 0, nodeIndex);