comparison widgets/PropertyBox.cpp @ 1190:2513f660c183 levelpanwidget

An attempt to improve PropertyBox layout on the Mac. Make all rows consistent by always creating a group layout for each row, regardless of whether the item(s) in it are marked as grouped or not.
author Chris Cannam
date Thu, 15 Dec 2016 14:39:40 +0000
parents 7609580fb05a
children 51bb2582c2cc
comparison
equal deleted inserted replaced
1189:7609580fb05a 1190:2513f660c183
167 if (params) { 167 if (params) {
168 168
169 m_playButton = new NotifyingToolButton; 169 m_playButton = new NotifyingToolButton;
170 m_playButton->setCheckable(true); 170 m_playButton->setCheckable(true);
171 m_playButton->setIcon(IconLoader().load("speaker")); 171 m_playButton->setIcon(IconLoader().load("speaker"));
172 m_playButton->setToolTip(tr("Click to toggle playback"));
172 m_playButton->setChecked(!params->isPlayMuted()); 173 m_playButton->setChecked(!params->isPlayMuted());
173 m_playButton->setFixedSize(buttonSize); 174 m_playButton->setFixedSize(buttonSize);
174 connect(m_playButton, SIGNAL(toggled(bool)), 175 connect(m_playButton, SIGNAL(toggled(bool)),
175 this, SLOT(playAudibleButtonChanged(bool))); 176 this, SLOT(playAudibleButtonChanged(bool)));
176 connect(m_playButton, SIGNAL(mouseEntered()), 177 connect(m_playButton, SIGNAL(mouseEntered()),
259 #endif 260 #endif
260 261
261 bool inGroup = (groupName != QString()); 262 bool inGroup = (groupName != QString());
262 263
263 if (!have) { 264 if (!have) {
265
266 QLabel *labelWidget = 0;
267
264 if (inGroup) { 268 if (inGroup) {
265 if (m_groupLayouts.find(groupName) == m_groupLayouts.end()) { 269 if (m_groupLayouts.find(groupName) == m_groupLayouts.end()) {
266 #ifdef DEBUG_PROPERTY_BOX 270 labelWidget = new QLabel(groupName, m_mainWidget);
267 cerr << "PropertyBox: adding label \"" << groupName << "\" and frame for group for \"" << name << "\"" << endl; 271 }
268 #endif 272 } else {
269 m_layout->addWidget(new QLabel(groupName, m_mainWidget), row, 0); 273 inGroup = true;
270 QFrame *frame = new QFrame(m_mainWidget); 274 groupName = "ungrouped: " + propertyLabel;
271 m_layout->addWidget(frame, row, 1, 1, 2); 275 if (m_groupLayouts.find(groupName) == m_groupLayouts.end()) {
272 m_groupLayouts[groupName] = new QGridLayout; 276 labelWidget = new QLabel(propertyLabel, m_mainWidget);
273 m_groupLayouts[groupName]->setMargin(0); 277 }
274 frame->setLayout(m_groupLayouts[groupName]); 278 }
275 } 279
276 } else { 280 if (labelWidget) {
277 #ifdef DEBUG_PROPERTY_BOX 281 m_layout->addWidget(labelWidget, row, 0);
278 cerr << "PropertyBox: adding label \"" << propertyLabel << "\"" << endl; 282 QWidget *frame = new QWidget(m_mainWidget);
279 #endif 283 frame->setMinimumSize(WidgetScale::scaleQSize(QSize(1, 24)));
280 m_layout->addWidget(new QLabel(propertyLabel, m_mainWidget), row, 0); 284 m_groupLayouts[groupName] = new QGridLayout;
281 } 285 m_groupLayouts[groupName]->setMargin(0);
286 frame->setLayout(m_groupLayouts[groupName]);
287 m_layout->addWidget(frame, row, 1, 1, 2);
288 m_layout->setColumnStretch(1, 10);
289 }
282 } 290 }
283 291
284 switch (type) { 292 switch (type) {
285 293
286 case PropertyContainer::ToggleProperty: 294 case PropertyContainer::ToggleProperty: