| 131 | } |
| 132 | |
| 133 | void PlotLegend::updateLineStyle(PlotChannel *ch) |
| 134 | { |
| 135 | if(!m_colorLines.contains(ch)) { |
| 136 | return; |
| 137 | } |
| 138 | |
| 139 | QWidget *colorLine = m_colorLines.value(ch); |
| 140 | QColor penColor = ch->curve()->pen().color(); |
| 141 | QString color = QString("rgba(%1, %2, %3, %4)") |
| 142 | .arg(penColor.red()) |
| 143 | .arg(penColor.green()) |
| 144 | .arg(penColor.blue()) |
| 145 | .arg(penColor.alpha()); |
| 146 | int thickness = ch->thickness(); |
| 147 | int style = ch->style(); |
| 148 | |
| 149 | QString borderStyle; |
| 150 | switch(style) { |
| 151 | case PlotChannel::PCS_DOTS: |
| 152 | borderStyle = |
| 153 | QString("background-color: transparent; border: %1px dotted %2;").arg(thickness).arg(color); |
| 154 | break; |
| 155 | case PlotChannel::PCS_STICKS: |
| 156 | case PlotChannel::PCS_STEPS: |
| 157 | borderStyle = |
| 158 | QString("background-color: transparent; border: %1px dashed %2;").arg(thickness).arg(color); |
| 159 | break; |
| 160 | case PlotChannel::PCS_LINES: |
| 161 | case PlotChannel::PCS_SMOOTH: |
| 162 | default: |
| 163 | borderStyle = QString("background-color: %1;").arg(color); |
| 164 | break; |
| 165 | } |
| 166 | |
| 167 | colorLine->setFixedHeight(thickness); |
| 168 | colorLine->setStyleSheet(borderStyle); |
| 169 | } |
| 170 | |
| 171 | #include "moc_plotlegend.cpp" |