23 double m_current_zoom_level = 1.0;
30 QLinearGradient result(rect.topLeft(), rect.bottomRight());
31 #if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
32 result.setColorAt(0, c.darker(150));
33 result.setColorAt(0.5, c.lighter(200));
34 result.setColorAt(1, c.darker(150));
36 result.setColorAt(0, c.dark(150));
37 result.setColorAt(0.5, c.light(200));
38 result.setColorAt(1, c.dark(150));
40 return std::move(result);
47 QLinearGradient result(rect.x() + rect.width() / 2, rect.y(), rect.x() + rect.width() / 2,
48 rect.y() + rect.height());
49 result.setColorAt(0, c);
50 result.setColorAt(0.5, c.lighter(150));
51 result.setColorAt(1, c);
52 return std::move(result);
58 QPixmap result(size, size);
59 result.fill(QColor(250, 250, 250));
60 QPainter tilePainter(&result);
61 QColor color(220, 220, 220);
62 tilePainter.fillRect(0.0, 0.0, 2, 2, color);
71 QPixmap pixmap(rect.width() + 1, rect.height() + 1);
72 pixmap.fill(Qt::transparent);
73 QPainter painter(&pixmap);
74 painter.setPen(Qt::black);
76 painter.drawRect(rect);
83 QPixmap pixmap(rect.width() + 1, rect.height() + 1);
84 pixmap.fill(Qt::transparent);
85 QPainter painter(&pixmap);
86 painter.setPen(Qt::black);
88 painter.drawRect(rect);
89 painter.setPen(Qt::DashLine);
98 QPixmap pixmap(rect.width() + 1, rect.height() + 1);
99 pixmap.fill(Qt::transparent);
100 QPainter painter(&pixmap);
101 painter.setPen(Qt::black);
103 painter.drawRoundedRect(rect, 3, 3);
110 QPixmap pixmap(rect.width() + 1, rect.height() + 1);
111 pixmap.fill(Qt::transparent);
112 QPainter painter(&pixmap);
113 painter.setPen(Qt::black);
115 painter.drawRoundedRect(rect, 3, 3);
122 QPixmap pixmap(rect.width() + 1, rect.height() + 1);
123 pixmap.fill(Qt::transparent);
124 QPainter painter(&pixmap);
125 painter.setPen(Qt::black);
127 painter.drawRoundedRect(rect, 5, 5);
133 static std::random_device r;
134 std::default_random_engine re(r());
135 std::uniform_int_distribution<int> ru(0, 255);
137 return QColor(ru(re), ru(re), ru(re));
142 return left->y() < right->y();
153 result = qBound(ymin, ymin + (
int)std::pow(
nanometer, 0.9), ymax);
159 if (
name ==
"MultiLayer") {
161 }
else if (
name ==
"Layer") {
163 }
else if (
name ==
"ParticleLayout") {
165 }
else if (
name ==
"Rotation") {
167 }
else if (
name.startsWith(
"FormFactor") ||
name ==
"Particle" ||
name ==
"ParticleCoreShell"
168 ||
name ==
"ParticleDistribution") {
170 }
else if (
name.startsWith(
"Interference")) {
173 return QRectF(0, 0, 50, 50);
179 if (
name ==
"MultiLayer") {
181 return QColor(51, 116, 255);
182 }
else if (
name ==
"Layer") {
184 return QColor(26, 156, 9);
185 }
else if (
name ==
"ParticleLayout") {
186 return QColor(135, 206, 50);
187 }
else if (
name.startsWith(
"FormFactor") ||
name ==
"Particle" ||
name ==
"ParticleCoreShell") {
188 return QColor(210, 223, 237);
189 }
else if (
name.startsWith(
"InterferenceFunction")) {
190 return QColor(255, 236, 139);
191 }
else if (
name ==
"Transparant red") {
192 return QColor(0xFF, 0, 0, 0x80);
193 }
else if (
name ==
"Transparant blue") {
194 return QColor(0, 0, 0xFF, 0x80);
196 return QColor(Qt::lightGray);
203 QRectF mime_rect(0, 0, default_rect.width() * m_current_zoom_level,
204 default_rect.height() * m_current_zoom_level);
206 QPixmap pixmap(mime_rect.width() + 1, mime_rect.height() + 1);
207 pixmap.fill(Qt::transparent);
208 QPainter painter(&pixmap);
209 painter.setPen(Qt::black);
211 painter.drawRoundedRect(mime_rect, 1, 1);
232 return QColor(Qt::lightGray);
252 return QColor(210, 223, 237);
262 return QColor(145, 50, 220);
Defines class DesignerHelper.
DefinesStyleUtils namespace.
static QPixmap getSceneBackground()
static QRectF getParticleLayoutBoundingRect()
static QRectF getInterferenceFunctionBoundingRect()
static int getPythonEditorFontSize()
static QRectF getParticleBoundingRect()
static QPixmap getPixmapParticleLayout()
static QRectF getDefaultBoundingRect(const QString &name)
returns default bounding rectangle for given IvView name
static bool sort_layers(QGraphicsItem *left, QGraphicsItem *right)
sort graphics item according they y-coordinate
static QPixmap getPixmapInterferenceFunction()
static QColor getDefaultMaterialColor()
static QPixmap getMimePixmap(const QString &name)
returns Mime pixmap for givew IView name
static QGradient getDecorationGradient(const QColor &color, const QRectF &rect)
static QColor getDefaultParticleColor()
static int getHeaderFontSize()
returns system dependent font size
static QColor getRandomColor()
static QGradient getLayerGradient(const QColor &color, const QRectF &rect)
static int getLabelFontSize()
static QPixmap getPixmapParticle()
static QRectF getDefaultMultiLayerRect()
static QColor getDefaultLayerColor()
static int nanometerToScreen(double nanometer)
non-linear conversion of layer's thickness in nanometers to screen size to have reasonable graphics r...
static int getPortFontSize()
static QColor getDefaultColor(const QString &name)
returns default color for IView with given name
static QRectF getTransformationBoundingRect()
static int getSectionFontSize()
static QPixmap getPixmapLayer()
static QColor getDefaultTransformationColor()
static QPixmap getPixmapMultiLayer()
QString const & name(EShape k)
QSize SizeOfLetterM(const QWidget *widget=nullptr)
Returns size of largest letter of default system font.
int SystemPointSize()
Returns size in points of default system font.
static constexpr double nanometer
Internal unit for lengths.