Sat, 23 Jun 2018 13:57:04 +0300
added icons for circular primitives and enhanced some existing ones
--- a/ldforge.qrc Fri Jun 22 15:03:50 2018 +0300 +++ b/ldforge.qrc Sat Jun 23 13:57:04 2018 +0300 @@ -29,16 +29,23 @@ <file>./icons/camera-right.png</file> <file>./icons/camera-top.png</file> <file>./icons/checkerboard.png</file> + <file>./icons/chord.png</file> + <file>./icons/circle.png</file> + <file>./icons/closed-cylinder.png</file> <file>./icons/colorcursor.png</file> <file>./icons/colorselect.png</file> <file>./icons/colors.txt</file> <file>./icons/comment.png</file> <file>./icons/condline.png</file> + <file>./icons/cone.png</file> <file>./icons/copy.png</file> <file>./icons/coverer.png</file> <file>./icons/cut.png</file> + <file>./icons/cylinder.png</file> <file>./icons/delete.png</file> <file>./icons/del-line.png</file> + <file>./icons/disc-negative.png</file> + <file>./icons/disc.png</file> <file>./icons/empty.png</file> <file>./icons/error.png</file> <file>./icons/exit.png</file> @@ -91,6 +98,7 @@ <file>./icons/rectifier.png</file> <file>./icons/redo.png</file> <file>./icons/replace-coords.png</file> + <file>./icons/ring.png</file> <file>./icons/round-coords.png</file> <file>./icons/screencap.png</file> <file>./icons/select-all.png</file>
--- a/src/linetypes/circularprimitive.cpp Fri Jun 22 15:03:50 2018 +0300 +++ b/src/linetypes/circularprimitive.cpp Sat Jun 23 13:57:04 2018 +0300 @@ -282,6 +282,7 @@ break; case PrimitiveModel::Cylinder: + case PrimitiveModel::CylinderOpen: return "cylinder"; case PrimitiveModel::Disc: @@ -294,10 +295,7 @@ return "circle"; case PrimitiveModel::CylinderClosed: - return "cylinder-closed"; - - case PrimitiveModel::CylinderOpen: - return "cylinder-open"; + return "closed-cylinder"; case PrimitiveModel::Chord: return "chord";
--- a/src/model.cpp Fri Jun 22 15:03:50 2018 +0300 +++ b/src/model.cpp Sat Jun 23 13:57:04 2018 +0300 @@ -311,6 +311,8 @@ QVariant Model::data(const QModelIndex& index, int role) const { + static QMap<QString, QPixmap> scaledIcons; + if (index.row() < 0 or index.row() >= size()) return {}; @@ -337,7 +339,17 @@ } case Qt::DecorationRole: - return MainWindow::getIcon(object->iconName()); + { + QString iconName = object->iconName(); + auto it = scaledIcons.find(iconName); + if (it == scaledIcons.end()) + { + QPixmap pixmap = MainWindow::getIcon(object->iconName()) + .scaled({24, 24}, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); + it = scaledIcons.insert(iconName, pixmap); + } + return *it; + } case Qt::BackgroundColorRole: if (object->type() == LDObjectType::Error)