Changeset View
Changeset View
Standalone View
Standalone View
src/mainwindow.cpp
Show First 20 Lines • Show All 180 Lines • ▼ Show 20 Line(s) | 176 | { | |||
---|---|---|---|---|---|
181 | auto setupButton = [this, buttonLayout](const QString & key, const QString & text, const QIcon & icon, QWidget * w) { | 181 | auto setupButton = [this, buttonLayout](const QString & key, const QString & text, const QIcon & icon, QWidget * w) { | ||
182 | auto *btn = new QPushButton(m_lateral.m_toolBar); | 182 | auto *btn = new QPushButton(m_lateral.m_toolBar); | ||
183 | btn->setToolTip(text); | 183 | btn->setToolTip(text); | ||
184 | btn->setAutoExclusive(true); | 184 | btn->setAutoExclusive(true); | ||
185 | btn->setCheckable(true); | 185 | btn->setCheckable(true); | ||
186 | //3d view is on top set it checked so users see its selected. | 186 | //3d view is on top set it checked so users see its selected. | ||
187 | btn->setChecked(key == "3d"); | 187 | btn->setChecked(key == "3d"); | ||
188 | btn->setIcon(icon); | 188 | btn->setIcon(icon); | ||
189 | btn->setFixedSize(48, 48); | 189 | //check if the dpi so we can set a larger icon on hidpi | ||
190 | btn->setIconSize(QSize(48, 48)); | 190 | int iconSize = logicalDpiX() / 96 >= 2 ? 48 : 32; | ||
patrickelectric: can you explain the magic numbers in the comment ? | |||||
191 | btn->setIconSize(QSize(iconSize, iconSize)); | ||||
191 | btn->setFlat(true); | 192 | btn->setFlat(true); | ||
192 | m_lateral.m_stack->addWidget(w); | 193 | m_lateral.m_stack->addWidget(w); | ||
193 | m_lateral.m_map[key] = {btn, w}; | 194 | m_lateral.m_map[key] = {btn, w}; | ||
194 | buttonLayout->addWidget(btn); | 195 | buttonLayout->addWidget(btn); | ||
195 | 196 | | |||
196 | connect(btn, &QPushButton::clicked, [this, w, btn] { | 197 | connect(btn, &QPushButton::clicked, [this, w, btn] { | ||
197 | if (m_lateral.m_stack->currentWidget() == w) | 198 | if (m_lateral.m_stack->currentWidget() == w) | ||
198 | { | 199 | { | ||
▲ Show 20 Lines • Show All 159 Lines • Show Last 20 Lines |
can you explain the magic numbers in the comment ?