Mercurial > hg > svgui
comparison widgets/PropertyBox.cpp @ 1197:ff77b7707c95 levelpanwidget
Take advantage of the fact that a group layout is now always used, to simplify code
author | Chris Cannam |
---|---|
date | Fri, 16 Dec 2016 13:10:21 +0000 |
parents | b1e3ee5f1be6 |
children | 69ff93e0c624 |
comparison
equal
deleted
inserted
replaced
1196:b1e3ee5f1be6 | 1197:ff77b7707c95 |
---|---|
253 cerr << "::updatePropertyEditor(\"" << name << "\"):"; | 253 cerr << "::updatePropertyEditor(\"" << name << "\"):"; |
254 cerr << " value " << value << ", have " << have << ", group \"" | 254 cerr << " value " << value << ", have " << have << ", group \"" |
255 << groupName << "\"" << endl; | 255 << groupName << "\"" << endl; |
256 #endif | 256 #endif |
257 | 257 |
258 bool inGroup = (groupName != QString()); | |
259 | |
260 if (!have) { | 258 if (!have) { |
261 | 259 |
262 QLabel *labelWidget = 0; | 260 QLabel *labelWidget = 0; |
263 | 261 |
264 if (inGroup) { | 262 if (groupName != QString()) { |
265 if (m_groupLayouts.find(groupName) == m_groupLayouts.end()) { | 263 if (m_groupLayouts.find(groupName) == m_groupLayouts.end()) { |
266 labelWidget = new QLabel(groupName, m_mainWidget); | 264 labelWidget = new QLabel(groupName, m_mainWidget); |
267 } | 265 } |
268 } else { | 266 } else { |
269 inGroup = true; | |
270 groupName = "ungrouped: " + propertyLabel; | 267 groupName = "ungrouped: " + propertyLabel; |
271 if (m_groupLayouts.find(groupName) == m_groupLayouts.end()) { | 268 if (m_groupLayouts.find(groupName) == m_groupLayouts.end()) { |
272 labelWidget = new QLabel(propertyLabel, m_mainWidget); | 269 labelWidget = new QLabel(propertyLabel, m_mainWidget); |
273 } | 270 } |
274 } | 271 } |
320 this, SLOT(propertyControllerChanged(bool))); | 317 this, SLOT(propertyControllerChanged(bool))); |
321 connect(button, SIGNAL(mouseEntered()), | 318 connect(button, SIGNAL(mouseEntered()), |
322 this, SLOT(mouseEnteredWidget())); | 319 this, SLOT(mouseEnteredWidget())); |
323 connect(button, SIGNAL(mouseLeft()), | 320 connect(button, SIGNAL(mouseLeft()), |
324 this, SLOT(mouseLeftWidget())); | 321 this, SLOT(mouseLeftWidget())); |
325 if (inGroup) { | 322 button->setToolTip(propertyLabel); |
326 button->setToolTip(propertyLabel); | 323 m_groupLayouts[groupName]->addWidget |
327 m_groupLayouts[groupName]->addWidget | 324 (button, 0, m_groupLayouts[groupName]->columnCount()); |
328 (button, 0, m_groupLayouts[groupName]->columnCount()); | |
329 } else { | |
330 m_layout->addWidget(button, row, 1, 1, 2); | |
331 } | |
332 m_propertyControllers[name] = button; | 325 m_propertyControllers[name] = button; |
333 } | 326 } |
334 | 327 |
335 if (button->isChecked() != (value > 0)) { | 328 if (button->isChecked() != (value > 0)) { |
336 button->blockSignals(true); | 329 button->blockSignals(true); |
375 connect(dial, SIGNAL(mouseEntered()), | 368 connect(dial, SIGNAL(mouseEntered()), |
376 this, SLOT(mouseEnteredWidget())); | 369 this, SLOT(mouseEnteredWidget())); |
377 connect(dial, SIGNAL(mouseLeft()), | 370 connect(dial, SIGNAL(mouseLeft()), |
378 this, SLOT(mouseLeftWidget())); | 371 this, SLOT(mouseLeftWidget())); |
379 | 372 |
380 if (inGroup) { | 373 dial->setFixedWidth(WidgetScale::scalePixelSize(24)); |
381 dial->setFixedWidth(WidgetScale::scalePixelSize(24)); | 374 dial->setFixedHeight(WidgetScale::scalePixelSize(24)); |
382 dial->setFixedHeight(WidgetScale::scalePixelSize(24)); | 375 m_groupLayouts[groupName]->addWidget |
383 m_groupLayouts[groupName]->addWidget | 376 (dial, 0, m_groupLayouts[groupName]->columnCount()); |
384 (dial, 0, m_groupLayouts[groupName]->columnCount()); | |
385 } else { | |
386 dial->setFixedWidth(WidgetScale::scalePixelSize(32)); | |
387 dial->setFixedHeight(WidgetScale::scalePixelSize(32)); | |
388 m_layout->addWidget(dial, row, 1); | |
389 QLabel *label = new QLabel(m_mainWidget); | |
390 connect(dial, SIGNAL(valueChanged(int)), | |
391 label, SLOT(setNum(int))); | |
392 label->setNum(value); | |
393 m_layout->addWidget(label, row, 2); | |
394 } | |
395 | 377 |
396 m_propertyControllers[name] = dial; | 378 m_propertyControllers[name] = dial; |
397 } | 379 } |
398 | 380 |
399 if (dial->value() != value) { | 381 if (dial->value() != value) { |
423 connect(cb, SIGNAL(mouseEntered()), | 405 connect(cb, SIGNAL(mouseEntered()), |
424 this, SLOT(mouseEnteredWidget())); | 406 this, SLOT(mouseEnteredWidget())); |
425 connect(cb, SIGNAL(mouseLeft()), | 407 connect(cb, SIGNAL(mouseLeft()), |
426 this, SLOT(mouseLeftWidget())); | 408 this, SLOT(mouseLeftWidget())); |
427 | 409 |
428 if (inGroup) { | 410 cb->setToolTip(propertyLabel); |
429 cb->setToolTip(propertyLabel); | 411 m_groupLayouts[groupName]->addWidget |
430 m_groupLayouts[groupName]->addWidget | 412 (cb, 0, m_groupLayouts[groupName]->columnCount()); |
431 (cb, 0, m_groupLayouts[groupName]->columnCount()); | |
432 } else { | |
433 m_layout->addWidget(cb, row, 1, 1, 2); | |
434 } | |
435 m_propertyControllers[name] = cb; | 413 m_propertyControllers[name] = cb; |
436 } | 414 } |
437 | 415 |
438 if (cb->currentIndex() != value) { | 416 if (cb->currentIndex() != value) { |
439 cb->blockSignals(true); | 417 cb->blockSignals(true); |
507 connect(cb, SIGNAL(mouseEntered()), | 485 connect(cb, SIGNAL(mouseEntered()), |
508 this, SLOT(mouseEnteredWidget())); | 486 this, SLOT(mouseEnteredWidget())); |
509 connect(cb, SIGNAL(mouseLeft()), | 487 connect(cb, SIGNAL(mouseLeft()), |
510 this, SLOT(mouseLeftWidget())); | 488 this, SLOT(mouseLeftWidget())); |
511 | 489 |
512 if (inGroup) { | 490 cb->setToolTip(propertyLabel); |
513 cb->setToolTip(propertyLabel); | 491 m_groupLayouts[groupName]->addWidget |
514 m_groupLayouts[groupName]->addWidget | 492 (cb, 0, m_groupLayouts[groupName]->columnCount()); |
515 (cb, 0, m_groupLayouts[groupName]->columnCount()); | |
516 } else { | |
517 m_layout->addWidget(cb, row, 1, 1, 2); | |
518 } | |
519 m_propertyControllers[name] = cb; | 493 m_propertyControllers[name] = cb; |
520 } | 494 } |
521 | 495 |
522 cb->blockSignals(true); | 496 cb->blockSignals(true); |
523 if (type == PropertyContainer::ValueProperty) { | 497 if (type == PropertyContainer::ValueProperty) { |