| 174 | } |
| 175 | |
| 176 | void XYCurveDock::init() { |
| 177 | QPainter pa; |
| 178 | // TODO size of the icon depending on the actual height of the combobox? |
| 179 | int iconSize = 20; |
| 180 | QPixmap pm(iconSize, iconSize); |
| 181 | ui.cbLineType->setIconSize(QSize(iconSize, iconSize)); |
| 182 | |
| 183 | QPen pen(Qt::SolidPattern, 0); |
| 184 | const QColor& color = GuiTools::isDarkMode() ? Qt::white : Qt::black; |
| 185 | pen.setColor(color); |
| 186 | |
| 187 | // no line |
| 188 | pm.fill(Qt::transparent); |
| 189 | pa.begin(&pm); |
| 190 | pa.setPen(pen); |
| 191 | pa.setBrush(QBrush(pen.color())); |
| 192 | pa.setRenderHint(QPainter::Antialiasing); |
| 193 | pa.drawEllipse(1, 1, 4, 4); |
| 194 | pa.drawEllipse(15, 15, 4, 4); |
| 195 | pa.end(); |
| 196 | ui.cbLineType->setItemIcon(0, pm); |
| 197 | |
| 198 | // line |
| 199 | pm.fill(Qt::transparent); |
| 200 | pa.begin(&pm); |
| 201 | pa.setPen(pen); |
| 202 | pa.setBrush(QBrush(pen.color())); |
| 203 | pa.setRenderHint(QPainter::Antialiasing); |
| 204 | pa.drawEllipse(1, 1, 4, 4); |
| 205 | pa.drawEllipse(15, 15, 4, 4); |
| 206 | pa.drawLine(3, 3, 17, 17); |
| 207 | pa.end(); |
| 208 | ui.cbLineType->setItemIcon(1, pm); |
| 209 | |
| 210 | // horizontal start |
| 211 | pm.fill(Qt::transparent); |
| 212 | pa.begin(&pm); |
| 213 | pa.setPen(pen); |
| 214 | pa.setBrush(QBrush(pen.color())); |
| 215 | pa.setRenderHint(QPainter::Antialiasing); |
| 216 | pa.drawEllipse(1, 1, 4, 4); |
| 217 | pa.drawEllipse(15, 15, 4, 4); |
| 218 | pa.drawLine(3, 3, 17, 3); |
| 219 | pa.drawLine(17, 3, 17, 17); |
| 220 | pa.end(); |
| 221 | ui.cbLineType->setItemIcon(2, pm); |
| 222 | |
| 223 | // vertical start |
| 224 | pm.fill(Qt::transparent); |
| 225 | pa.begin(&pm); |
| 226 | pa.setPen(pen); |
| 227 | pa.setBrush(QBrush(pen.color())); |
| 228 | pa.setRenderHint(QPainter::Antialiasing); |
| 229 | pa.drawEllipse(1, 1, 4, 4); |
| 230 | pa.drawEllipse(15, 15, 4, 4); |
| 231 | pa.drawLine(3, 3, 3, 17); |
| 232 | pa.drawLine(3, 17, 17, 17); |
| 233 | pa.end(); |