MCPcopy Create free account
hub / github.com/LunarG/VulkanTools / Resize

Method Resize

vkconfig_gui/widget_setting_enum.cpp:156–188  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

154}
155
156void WidgetSettingEnum::Resize() {
157 // resizeEvent was never call yet
158 if (this->last_resize.width() == 0 || this->last_resize.height() == 0) {
159 return;
160 }
161
162 int width = MIN_FIELD_WIDTH;
163
164 const QFontMetrics fm = this->field->fontMetrics();
165
166 if (meta.default_value == "${VP_DEFAULT}") {
167 const std::vector<std::string>& profiles = GetProfileNames(data_set);
168 for (std::size_t i = 0, n = profiles.size(); i < n; ++i) {
169 width = std::max(width, HorizontalAdvance(fm, (profiles[i] + "0000").c_str()));
170 }
171 } else if (meta.default_value == "${VP_PHYSICAL_DEVICES}") {
172 const std::vector<VulkanPhysicalDeviceInfo>& physical_device_infos = Configurator::Get().vulkan_system_info.physicalDevices;
173 for (std::size_t i = 0, n = physical_device_infos.size(); i < n; ++i) {
174 width = std::max(width, HorizontalAdvance(fm, (physical_device_infos[i].deviceName + std::string("000")).c_str()));
175 }
176 } else {
177 for (std::size_t i = 0, n = this->meta.enum_values.size(); i < n; ++i) {
178 width = std::max(width, HorizontalAdvance(fm, (this->meta.enum_values[i].label + "0000").c_str()));
179 }
180 }
181
182 const int prefix_width = HorizontalAdvance(fm, this->item->text(0) + "0");
183
184 width = std::min(width, this->last_resize.width() - prefix_width);
185
186 const QRect button_rect(this->last_resize.width() - width, 0, width, this->last_resize.height());
187 this->field->setGeometry(button_rect);
188}
189
190void WidgetSettingEnum::resizeEvent(QResizeEvent* event) {
191 this->last_resize = event->size();

Callers 2

RefreshMethod · 0.95
resizeEventMethod · 0.95

Calls 3

GetProfileNamesFunction · 0.85
HorizontalAdvanceFunction · 0.85
GetFunction · 0.85

Tested by

no test coverage detected