comparison widgets/PropertyBox.cpp @ 1174:3f5c82034f9b more-hidpi

Scale the sizes of a few more UI elements
author Chris Cannam
date Mon, 05 Dec 2016 12:04:23 +0000
parents db90fee630bc
children ed99d432dc57
comparison
equal deleted inserted replaced
1173:db90fee630bc 1174:3f5c82034f9b
25 #include "base/RangeMapper.h" 25 #include "base/RangeMapper.h"
26 26
27 #include "AudioDial.h" 27 #include "AudioDial.h"
28 #include "LEDButton.h" 28 #include "LEDButton.h"
29 #include "IconLoader.h" 29 #include "IconLoader.h"
30 #include "WidgetScale.h"
30 31
31 #include "NotifyingCheckBox.h" 32 #include "NotifyingCheckBox.h"
32 #include "NotifyingComboBox.h" 33 #include "NotifyingComboBox.h"
33 #include "NotifyingPushButton.h" 34 #include "NotifyingPushButton.h"
34 #include "ColourNameDialog.h" 35 #include "ColourNameDialog.h"
194 layout->insertStretch(-1, 10); 195 layout->insertStretch(-1, 10);
195 196
196 if (params->getPlayClipId() != "") { 197 if (params->getPlayClipId() != "") {
197 QPushButton *playParamButton = 198 QPushButton *playParamButton =
198 new QPushButton(QIcon(":icons/faders.png"), ""); 199 new QPushButton(QIcon(":icons/faders.png"), "");
199 playParamButton->setFixedWidth(24); 200 playParamButton->setFixedWidth(WidgetScale::scalePixelSize(24));
200 playParamButton->setFixedHeight(24); 201 playParamButton->setFixedHeight(WidgetScale::scalePixelSize(24));
201 layout->addWidget(playParamButton); 202 layout->addWidget(playParamButton);
202 connect(playParamButton, SIGNAL(clicked()), 203 connect(playParamButton, SIGNAL(clicked()),
203 this, SLOT(editPlayParameters())); 204 this, SLOT(editPlayParameters()));
204 } 205 }
205 206
207 layout->addWidget(gainDial); 208 layout->addWidget(gainDial);
208 gainDial->setMeterColor(Qt::darkRed); 209 gainDial->setMeterColor(Qt::darkRed);
209 gainDial->setMinimum(-50); 210 gainDial->setMinimum(-50);
210 gainDial->setMaximum(50); 211 gainDial->setMaximum(50);
211 gainDial->setPageStep(1); 212 gainDial->setPageStep(1);
212 gainDial->setFixedWidth(24); 213 gainDial->setFixedWidth(WidgetScale::scalePixelSize(24));
213 gainDial->setFixedHeight(24); 214 gainDial->setFixedHeight(WidgetScale::scalePixelSize(24));
214 gainDial->setNotchesVisible(false); 215 gainDial->setNotchesVisible(false);
215 gainDial->setObjectName(tr("Playback Gain")); 216 gainDial->setObjectName(tr("Playback Gain"));
216 gainDial->setRangeMapper(new LinearRangeMapper 217 gainDial->setRangeMapper(new LinearRangeMapper
217 (-50, 50, -25, 25, tr("dB"))); 218 (-50, 50, -25, 25, tr("dB")));
218 gainDial->setDefaultValue(0); 219 gainDial->setDefaultValue(0);
234 layout->addWidget(panDial); 235 layout->addWidget(panDial);
235 panDial->setMeterColor(Qt::darkGreen); 236 panDial->setMeterColor(Qt::darkGreen);
236 panDial->setMinimum(-50); 237 panDial->setMinimum(-50);
237 panDial->setMaximum(50); 238 panDial->setMaximum(50);
238 panDial->setPageStep(1); 239 panDial->setPageStep(1);
239 panDial->setFixedWidth(24); 240 panDial->setFixedWidth(WidgetScale::scalePixelSize(24));
240 panDial->setFixedHeight(24); 241 panDial->setFixedHeight(WidgetScale::scalePixelSize(24));
241 panDial->setNotchesVisible(false); 242 panDial->setNotchesVisible(false);
242 panDial->setToolTip(tr("Playback Pan / Balance")); 243 panDial->setToolTip(tr("Playback Pan / Balance"));
243 panDial->setDefaultValue(0); 244 panDial->setDefaultValue(0);
244 panDial->setObjectName(tr("Playback Pan / Balance")); 245 panDial->setObjectName(tr("Playback Pan / Balance"));
245 panDial->setShowToolTip(true); 246 panDial->setShowToolTip(true);
328 button = new NotifyingPushButton(); 329 button = new NotifyingPushButton();
329 button->setCheckable(true); 330 button->setCheckable(true);
330 QIcon icon(IconLoader().load(iconName)); 331 QIcon icon(IconLoader().load(iconName));
331 button->setIcon(icon); 332 button->setIcon(icon);
332 button->setObjectName(name); 333 button->setObjectName(name);
333 button->setFixedSize(QSize(18, 18)); 334 button->setFixedSize(WidgetScale::scaleQSize(QSize(18, 18)));
334 } else { 335 } else {
335 button = new NotifyingCheckBox(); 336 button = new NotifyingCheckBox();
336 button->setObjectName(name); 337 button->setObjectName(name);
337 } 338 }
338 connect(button, SIGNAL(toggled(bool)), 339 connect(button, SIGNAL(toggled(bool)),
395 this, SLOT(mouseEnteredWidget())); 396 this, SLOT(mouseEnteredWidget()));
396 connect(dial, SIGNAL(mouseLeft()), 397 connect(dial, SIGNAL(mouseLeft()),
397 this, SLOT(mouseLeftWidget())); 398 this, SLOT(mouseLeftWidget()));
398 399
399 if (inGroup) { 400 if (inGroup) {
400 dial->setFixedWidth(24); 401 dial->setFixedWidth(WidgetScale::scalePixelSize(24));
401 dial->setFixedHeight(24); 402 dial->setFixedHeight(WidgetScale::scalePixelSize(24));
402 m_groupLayouts[groupName]->addWidget 403 m_groupLayouts[groupName]->addWidget
403 (dial, 0, m_groupLayouts[groupName]->columnCount()); 404 (dial, 0, m_groupLayouts[groupName]->columnCount());
404 } else { 405 } else {
405 dial->setFixedWidth(32); 406 dial->setFixedWidth(WidgetScale::scalePixelSize(32));
406 dial->setFixedHeight(32); 407 dial->setFixedHeight(WidgetScale::scalePixelSize(32));
407 m_layout->addWidget(dial, row, 1); 408 m_layout->addWidget(dial, row, 1);
408 QLabel *label = new QLabel(m_mainWidget); 409 QLabel *label = new QLabel(m_mainWidget);
409 connect(dial, SIGNAL(valueChanged(int)), 410 connect(dial, SIGNAL(valueChanged(int)),
410 label, SLOT(setNum(int))); 411 label, SLOT(setNum(int)));
411 label->setNum(value); 412 label->setNum(value);