| 269 | } |
| 270 | |
| 271 | void GuiTools::addSymbolStyles(QComboBox* cb) { |
| 272 | QPen pen(Qt::SolidPattern, 0); |
| 273 | const QColor& color = GuiTools::isDarkMode() ? Qt::white : Qt::black; |
| 274 | pen.setColor(color); |
| 275 | |
| 276 | int iconSize = 20; |
| 277 | QPixmap pm(iconSize, iconSize); |
| 278 | cb->setIconSize(QSize(iconSize, iconSize)); |
| 279 | QTransform trafo; |
| 280 | trafo.scale(15, 15); |
| 281 | |
| 282 | for (int i = 0; i < Symbol::stylesCount(); ++i) { |
| 283 | QPainter pa; |
| 284 | // get styles in order |
| 285 | const auto style = Symbol::indexToStyle(i); |
| 286 | |
| 287 | pm.fill(Qt::transparent); |
| 288 | pa.begin(&pm); |
| 289 | pa.setPen(pen); |
| 290 | pa.setRenderHint(QPainter::Antialiasing); |
| 291 | pa.translate(iconSize / 2, iconSize / 2); |
| 292 | pa.drawPath(trafo.map(Symbol::stylePath(style))); |
| 293 | pa.end(); |
| 294 | cb->addItem(QIcon(pm), Symbol::styleName(style), (int)style); |
| 295 | } |
| 296 | } |
| 297 | |
| 298 | QString GuiTools::openImageFile(const QString& className) { |
| 299 | KConfigGroup conf = Settings::group(className); |