annotate widgets/Thumbwheel.cpp @ 324:1f67b110c1a3

* fix pane layout problem; fix waveform butterfly mode
author Chris Cannam
date Wed, 07 Nov 2007 16:52:52 +0000
parents c492902dba40
children 846746e4e865 06b5f110c5d2
rev   line source
Chris@132 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@132 2
Chris@132 3 /*
Chris@132 4 Sonic Visualiser
Chris@132 5 An audio file viewer and annotation editor.
Chris@132 6 Centre for Digital Music, Queen Mary, University of London.
Chris@182 7 This file copyright 2006 QMUL.
Chris@132 8
Chris@132 9 This program is free software; you can redistribute it and/or
Chris@132 10 modify it under the terms of the GNU General Public License as
Chris@132 11 published by the Free Software Foundation; either version 2 of the
Chris@132 12 License, or (at your option) any later version. See the file
Chris@132 13 COPYING included with this distribution for more information.
Chris@132 14 */
Chris@132 15
Chris@132 16 #include "Thumbwheel.h"
Chris@132 17
Chris@187 18 #include "base/RangeMapper.h"
Chris@190 19 #include "base/Profiler.h"
Chris@187 20
Chris@132 21 #include <QMouseEvent>
Chris@132 22 #include <QPaintEvent>
Chris@132 23 #include <QWheelEvent>
Chris@187 24 #include <QInputDialog>
Chris@132 25 #include <QPainter>
Chris@190 26 #include <QPainterPath>
Chris@132 27
Chris@132 28 #include <cmath>
Chris@132 29 #include <iostream>
Chris@132 30
Chris@133 31 Thumbwheel::Thumbwheel(Qt::Orientation orientation,
Chris@132 32 QWidget *parent) :
Chris@132 33 QWidget(parent),
Chris@133 34 m_min(0),
Chris@133 35 m_max(100),
Chris@133 36 m_default(50),
Chris@133 37 m_value(50),
Chris@187 38 m_mappedValue(50),
Chris@187 39 m_noMappedUpdate(false),
Chris@165 40 m_rotation(0.5),
Chris@132 41 m_orientation(orientation),
Chris@165 42 m_speed(1.0),
Chris@132 43 m_tracking(true),
Chris@132 44 m_showScale(true),
Chris@132 45 m_clicked(false),
Chris@133 46 m_atDefault(true),
Chris@187 47 m_clickRotation(m_rotation),
Chris@187 48 m_showTooltip(true),
Chris@187 49 m_rangeMapper(0)
Chris@132 50 {
Chris@132 51 }
Chris@132 52
Chris@132 53 Thumbwheel::~Thumbwheel()
Chris@132 54 {
Chris@187 55 delete m_rangeMapper;
Chris@187 56 }
Chris@187 57
Chris@187 58 void
Chris@187 59 Thumbwheel::setRangeMapper(RangeMapper *mapper)
Chris@187 60 {
Chris@187 61 if (m_rangeMapper == mapper) return;
Chris@187 62
Chris@187 63 if (!m_rangeMapper && mapper) {
Chris@187 64 connect(this, SIGNAL(valueChanged(int)),
Chris@187 65 this, SLOT(updateMappedValue(int)));
Chris@187 66 }
Chris@187 67
Chris@187 68 delete m_rangeMapper;
Chris@187 69 m_rangeMapper = mapper;
Chris@187 70
Chris@187 71 updateMappedValue(getValue());
Chris@187 72 }
Chris@187 73
Chris@187 74 void
Chris@187 75 Thumbwheel::setShowToolTip(bool show)
Chris@187 76 {
Chris@187 77 m_showTooltip = show;
Chris@187 78 m_noMappedUpdate = true;
Chris@187 79 updateMappedValue(getValue());
Chris@187 80 m_noMappedUpdate = false;
Chris@132 81 }
Chris@132 82
Chris@132 83 void
Chris@133 84 Thumbwheel::setMinimumValue(int min)
Chris@133 85 {
Chris@133 86 if (m_min == min) return;
Chris@133 87
Chris@133 88 m_min = min;
Chris@133 89 if (m_max <= m_min) m_max = m_min + 1;
Chris@133 90 if (m_value < m_min) m_value = m_min;
Chris@133 91 if (m_value > m_max) m_value = m_max;
Chris@165 92
Chris@165 93 m_rotation = float(m_value - m_min) / float(m_max - m_min);
Chris@165 94 update();
Chris@133 95 }
Chris@133 96
Chris@133 97 int
Chris@133 98 Thumbwheel::getMinimumValue() const
Chris@133 99 {
Chris@133 100 return m_min;
Chris@133 101 }
Chris@133 102
Chris@133 103 void
Chris@133 104 Thumbwheel::setMaximumValue(int max)
Chris@133 105 {
Chris@133 106 if (m_max == max) return;
Chris@133 107
Chris@133 108 m_max = max;
Chris@133 109 if (m_min >= m_max) m_min = m_max - 1;
Chris@133 110 if (m_value < m_min) m_value = m_min;
Chris@133 111 if (m_value > m_max) m_value = m_max;
Chris@165 112
Chris@165 113 m_rotation = float(m_value - m_min) / float(m_max - m_min);
Chris@165 114 update();
Chris@133 115 }
Chris@133 116
Chris@133 117 int
Chris@133 118 Thumbwheel::getMaximumValue() const
Chris@133 119 {
Chris@133 120 return m_max;
Chris@133 121 }
Chris@133 122
Chris@133 123 void
Chris@133 124 Thumbwheel::setDefaultValue(int deft)
Chris@133 125 {
Chris@133 126 if (m_default == deft) return;
Chris@133 127
Chris@133 128 m_default = deft;
Chris@133 129 if (m_atDefault) {
Chris@133 130 setValue(m_default);
Chris@165 131 m_atDefault = true; // setValue unsets this
Chris@133 132 emit valueChanged(getValue());
Chris@133 133 }
Chris@133 134 }
Chris@133 135
Chris@187 136 void
Chris@187 137 Thumbwheel::setMappedValue(float mappedValue)
Chris@187 138 {
Chris@187 139 if (m_rangeMapper) {
Chris@187 140 int newValue = m_rangeMapper->getPositionForValue(mappedValue);
Chris@190 141 bool changed = (m_mappedValue != mappedValue);
Chris@187 142 m_mappedValue = mappedValue;
Chris@187 143 m_noMappedUpdate = true;
Chris@205 144 // std::cerr << "Thumbwheel::setMappedValue(" << mappedValue << "): new value is " << newValue << " (visible " << isVisible() << ")" << std::endl;
Chris@187 145 if (newValue != getValue()) {
Chris@187 146 setValue(newValue);
Chris@190 147 changed = true;
Chris@187 148 }
Chris@190 149 if (changed) emit valueChanged(newValue);
Chris@187 150 m_noMappedUpdate = false;
Chris@187 151 } else {
Chris@190 152 int v = int(mappedValue);
Chris@190 153 if (v != getValue()) {
Chris@190 154 setValue(v);
Chris@190 155 emit valueChanged(v);
Chris@190 156 }
Chris@187 157 }
Chris@187 158 }
Chris@187 159
Chris@133 160 int
Chris@133 161 Thumbwheel::getDefaultValue() const
Chris@133 162 {
Chris@133 163 return m_default;
Chris@133 164 }
Chris@133 165
Chris@133 166 void
Chris@132 167 Thumbwheel::setValue(int value)
Chris@132 168 {
Chris@205 169 // std::cerr << "Thumbwheel::setValue(" << value << ") (from " << m_value
Chris@205 170 // << ", rotation " << m_rotation << ")" << " (visible " << isVisible() << ")" << std::endl;
Chris@133 171
Chris@165 172 if (m_value != value) {
Chris@165 173
Chris@165 174 m_atDefault = false;
Chris@165 175
Chris@165 176 if (value < m_min) value = m_min;
Chris@165 177 if (value > m_max) value = m_max;
Chris@165 178 m_value = value;
Chris@165 179 }
Chris@165 180
Chris@165 181 m_rotation = float(m_value - m_min) / float(m_max - m_min);
Chris@192 182 if (isVisible()) update();
Chris@132 183 }
Chris@132 184
Chris@133 185 void
Chris@133 186 Thumbwheel::resetToDefault()
Chris@133 187 {
Chris@133 188 if (m_default == m_value) return;
Chris@133 189 setValue(m_default);
Chris@133 190 m_atDefault = true;
Chris@133 191 emit valueChanged(getValue());
Chris@133 192 }
Chris@133 193
Chris@132 194 int
Chris@132 195 Thumbwheel::getValue() const
Chris@132 196 {
Chris@132 197 return m_value;
Chris@132 198 }
Chris@132 199
Chris@187 200 float
Chris@187 201 Thumbwheel::getMappedValue() const
Chris@187 202 {
Chris@187 203 if (m_rangeMapper) {
Chris@205 204 // std::cerr << "Thumbwheel::getMappedValue(): value = " << getValue() << ", mappedValue = " << m_mappedValue << std::endl;
Chris@187 205 return m_mappedValue;
Chris@187 206 }
Chris@187 207 return getValue();
Chris@187 208 }
Chris@187 209
Chris@187 210 void
Chris@187 211 Thumbwheel::updateMappedValue(int value)
Chris@187 212 {
Chris@187 213 if (!m_noMappedUpdate) {
Chris@187 214 if (m_rangeMapper) {
Chris@187 215 m_mappedValue = m_rangeMapper->getValueForPosition(value);
Chris@187 216 } else {
Chris@187 217 m_mappedValue = value;
Chris@187 218 }
Chris@187 219 }
Chris@187 220
Chris@187 221 if (m_showTooltip) {
Chris@187 222 QString name = objectName();
Chris@187 223 QString unit = "";
Chris@187 224 QString text;
Chris@187 225 if (m_rangeMapper) unit = m_rangeMapper->getUnit();
Chris@187 226 if (name != "") {
Chris@187 227 text = tr("%1: %2%3").arg(name).arg(m_mappedValue).arg(unit);
Chris@187 228 } else {
Chris@187 229 text = tr("%2%3").arg(m_mappedValue).arg(unit);
Chris@187 230 }
Chris@187 231 setToolTip(text);
Chris@187 232 }
Chris@187 233 }
Chris@187 234
Chris@132 235 void
Chris@256 236 Thumbwheel::scroll(bool up)
Chris@256 237 {
Chris@256 238 int step = lrintf(m_speed);
Chris@256 239 if (step == 0) step = 1;
Chris@256 240
Chris@256 241 if (up) {
Chris@256 242 setValue(m_value + step);
Chris@256 243 } else {
Chris@256 244 setValue(m_value - step);
Chris@256 245 }
Chris@256 246
Chris@256 247 emit valueChanged(getValue());
Chris@256 248 }
Chris@256 249
Chris@256 250 void
Chris@132 251 Thumbwheel::setSpeed(float speed)
Chris@132 252 {
Chris@132 253 m_speed = speed;
Chris@132 254 }
Chris@132 255
Chris@132 256 float
Chris@132 257 Thumbwheel::getSpeed() const
Chris@132 258 {
Chris@132 259 return m_speed;
Chris@132 260 }
Chris@132 261
Chris@132 262 void
Chris@132 263 Thumbwheel::setTracking(bool tracking)
Chris@132 264 {
Chris@132 265 m_tracking = tracking;
Chris@132 266 }
Chris@132 267
Chris@132 268 bool
Chris@132 269 Thumbwheel::getTracking() const
Chris@132 270 {
Chris@132 271 return m_tracking;
Chris@132 272 }
Chris@132 273
Chris@132 274 void
Chris@132 275 Thumbwheel::setShowScale(bool showScale)
Chris@132 276 {
Chris@132 277 m_showScale = showScale;
Chris@132 278 }
Chris@132 279
Chris@132 280 bool
Chris@132 281 Thumbwheel::getShowScale() const
Chris@132 282 {
Chris@132 283 return m_showScale;
Chris@132 284 }
Chris@132 285
Chris@132 286 void
Chris@189 287 Thumbwheel::enterEvent(QEvent *)
Chris@189 288 {
Chris@189 289 emit mouseEntered();
Chris@189 290 }
Chris@189 291
Chris@189 292 void
Chris@189 293 Thumbwheel::leaveEvent(QEvent *)
Chris@189 294 {
Chris@189 295 emit mouseLeft();
Chris@189 296 }
Chris@189 297
Chris@189 298 void
Chris@132 299 Thumbwheel::mousePressEvent(QMouseEvent *e)
Chris@132 300 {
Chris@187 301 if (e->button() == Qt::MidButton ||
Chris@187 302 ((e->button() == Qt::LeftButton) &&
Chris@187 303 (e->modifiers() & Qt::ControlModifier))) {
Chris@187 304 resetToDefault();
Chris@187 305 } else if (e->button() == Qt::LeftButton) {
Chris@133 306 m_clicked = true;
Chris@133 307 m_clickPos = e->pos();
Chris@165 308 m_clickRotation = m_rotation;
Chris@133 309 }
Chris@132 310 }
Chris@132 311
Chris@132 312 void
Chris@187 313 Thumbwheel::mouseDoubleClickEvent(QMouseEvent *mouseEvent)
Chris@132 314 {
Chris@188 315 //!!! needs a common base class with AudioDial (and Panner?)
Chris@187 316
Chris@187 317 if (mouseEvent->button() != Qt::LeftButton) {
Chris@187 318 return;
Chris@187 319 }
Chris@187 320
Chris@187 321 bool ok = false;
Chris@187 322
Chris@187 323 if (m_rangeMapper) {
Chris@187 324
Chris@187 325 float min = m_rangeMapper->getValueForPosition(m_min);
Chris@187 326 float max = m_rangeMapper->getValueForPosition(m_max);
Chris@187 327
Chris@187 328 if (min > max) {
Chris@187 329 float tmp = min;
Chris@187 330 min = max;
Chris@187 331 max = tmp;
Chris@187 332 }
Chris@187 333
Chris@187 334 QString unit = m_rangeMapper->getUnit();
Chris@187 335
Chris@187 336 QString text;
Chris@187 337 if (objectName() != "") {
Chris@187 338 if (unit != "") {
Chris@187 339 text = tr("New value for %1, from %2 to %3 %4:")
Chris@187 340 .arg(objectName()).arg(min).arg(max).arg(unit);
Chris@187 341 } else {
Chris@187 342 text = tr("New value for %1, from %2 to %3:")
Chris@187 343 .arg(objectName()).arg(min).arg(max);
Chris@187 344 }
Chris@187 345 } else {
Chris@187 346 if (unit != "") {
Chris@187 347 text = tr("Enter a new value from %1 to %2 %3:")
Chris@187 348 .arg(min).arg(max).arg(unit);
Chris@187 349 } else {
Chris@187 350 text = tr("Enter a new value from %1 to %2:")
Chris@187 351 .arg(min).arg(max);
Chris@187 352 }
Chris@187 353 }
Chris@187 354
Chris@187 355 float newValue = QInputDialog::getDouble
Chris@187 356 (this,
Chris@187 357 tr("Enter new value"),
Chris@187 358 text,
Chris@187 359 m_mappedValue,
Chris@187 360 min,
Chris@187 361 max,
Chris@187 362 4,
Chris@187 363 &ok);
Chris@187 364
Chris@187 365 if (ok) {
Chris@187 366 setMappedValue(newValue);
Chris@187 367 }
Chris@187 368
Chris@187 369 } else {
Chris@187 370
Chris@187 371 int newValue = QInputDialog::getInteger
Chris@187 372 (this,
Chris@187 373 tr("Enter new value"),
Chris@187 374 tr("Enter a new value from %1 to %2:")
Chris@187 375 .arg(m_min).arg(m_max),
Chris@187 376 getValue(), m_min, m_max, 1, &ok);
Chris@187 377
Chris@187 378 if (ok) {
Chris@187 379 setValue(newValue);
Chris@187 380 }
Chris@187 381 }
Chris@132 382 }
Chris@132 383
Chris@187 384
Chris@132 385 void
Chris@132 386 Thumbwheel::mouseMoveEvent(QMouseEvent *e)
Chris@132 387 {
Chris@133 388 if (!m_clicked) return;
Chris@132 389 int dist = 0;
Chris@132 390 if (m_orientation == Qt::Horizontal) {
Chris@132 391 dist = e->x() - m_clickPos.x();
Chris@132 392 } else {
Chris@132 393 dist = e->y() - m_clickPos.y();
Chris@132 394 }
Chris@165 395
Chris@165 396 float rotation = m_clickRotation + (m_speed * dist) / 100;
Chris@165 397 if (rotation < 0.f) rotation = 0.f;
Chris@165 398 if (rotation > 1.f) rotation = 1.f;
Chris@165 399 int value = lrintf(m_min + (m_max - m_min) * m_rotation);
Chris@132 400 if (value != m_value) {
Chris@132 401 setValue(value);
Chris@132 402 if (m_tracking) emit valueChanged(getValue());
Chris@165 403 m_rotation = rotation;
Chris@165 404 } else if (fabsf(rotation - m_rotation) > 0.001) {
Chris@165 405 m_rotation = rotation;
Chris@165 406 repaint();
Chris@165 407 }
Chris@132 408 }
Chris@132 409
Chris@132 410 void
Chris@132 411 Thumbwheel::mouseReleaseEvent(QMouseEvent *e)
Chris@132 412 {
Chris@133 413 if (!m_clicked) return;
Chris@132 414 bool reallyTracking = m_tracking;
Chris@132 415 m_tracking = true;
Chris@132 416 mouseMoveEvent(e);
Chris@132 417 m_tracking = reallyTracking;
Chris@133 418 m_clicked = false;
Chris@132 419 }
Chris@132 420
Chris@132 421 void
Chris@132 422 Thumbwheel::wheelEvent(QWheelEvent *e)
Chris@132 423 {
Chris@132 424 int step = lrintf(m_speed);
Chris@132 425 if (step == 0) step = 1;
Chris@132 426
Chris@132 427 if (e->delta() > 0) {
Chris@132 428 setValue(m_value + step);
Chris@132 429 } else {
Chris@132 430 setValue(m_value - step);
Chris@132 431 }
Chris@132 432
Chris@132 433 emit valueChanged(getValue());
Chris@132 434 }
Chris@132 435
Chris@132 436 void
Chris@132 437 Thumbwheel::paintEvent(QPaintEvent *)
Chris@132 438 {
Chris@190 439 Profiler profiler("Thumbwheel::paintEvent", true);
Chris@190 440
Chris@191 441 int bw = 3;
Chris@191 442
Chris@191 443 QRect subclip;
Chris@191 444 if (m_orientation == Qt::Horizontal) {
Chris@191 445 subclip = QRect(bw, bw+1, width() - bw*2, height() - bw*2 - 2);
Chris@191 446 } else {
Chris@191 447 subclip = QRect(bw+1, bw, width() - bw*2 - 2, height() - bw*2);
Chris@191 448 }
Chris@191 449
Chris@133 450 QPainter paint(this);
Chris@191 451 paint.fillRect(subclip, palette().background().color());
Chris@190 452
Chris@190 453 paint.setRenderHint(QPainter::Antialiasing, true);
Chris@133 454
Chris@190 455 float w = width();
Chris@190 456 float w0 = 0.5;
Chris@190 457 float w1 = w - 0.5;
Chris@190 458
Chris@190 459 float h = height();
Chris@190 460 float h0 = 0.5;
Chris@190 461 float h1 = h - 0.5;
Chris@190 462
Chris@190 463 for (int i = bw-1; i >= 0; --i) {
Chris@190 464 // for (int i = 0; i < 1; ++i) {
Chris@190 465
Chris@133 466 int grey = (i + 1) * (256 / (bw + 1));
Chris@133 467 QColor fc = QColor(grey, grey, grey);
Chris@133 468 paint.setPen(fc);
Chris@190 469
Chris@190 470 QPainterPath path;
Chris@190 471
Chris@190 472 if (m_orientation == Qt::Horizontal) {
Chris@190 473 path.moveTo(w0 + i, h0 + i + 2);
Chris@190 474 path.quadTo(w/2, i * 1.25, w1 - i, h0 + i + 2);
Chris@190 475 path.lineTo(w1 - i, h1 - i - 2);
Chris@190 476 path.quadTo(w/2, h - i * 1.25, w0 + i, h1 - i - 2);
Chris@190 477 path.closeSubpath();
Chris@190 478 } else {
Chris@190 479 path.moveTo(w0 + i + 2, h0 + i);
Chris@190 480 path.quadTo(i * 1.25, h/2, w0 + i + 2, h1 - i);
Chris@190 481 path.lineTo(w1 - i - 2, h1 - i);
Chris@190 482 path.quadTo(w - i * 1.25, h/2, w1 - i - 2, h0 + i);
Chris@190 483 path.closeSubpath();
Chris@190 484 }
Chris@190 485
Chris@190 486 paint.drawPath(path);
Chris@133 487 }
Chris@133 488
Chris@191 489 paint.setClipRect(subclip);
Chris@133 490
Chris@165 491 float radians = m_rotation * 1.5f * M_PI;
Chris@132 492
Chris@132 493 // std::cerr << "value = " << m_value << ", min = " << m_min << ", max = " << m_max << ", rotation = " << rotation << std::endl;
Chris@132 494
Chris@190 495 w = (m_orientation == Qt::Horizontal ? width() : height()) - bw*2;
Chris@132 496
Chris@132 497 // total number of notches on the entire wheel
Chris@132 498 int notches = 25;
Chris@132 499
Chris@132 500 // radius of the wheel including invisible part
Chris@249 501 int radius = int(w / 2 + 2);
Chris@132 502
Chris@132 503 for (int i = 0; i < notches; ++i) {
Chris@132 504
Chris@165 505 float a0 = (2.f * M_PI * i) / notches + radians;
Chris@132 506 float a1 = a0 + M_PI / (notches * 2);
Chris@165 507 float a2 = (2.f * M_PI * (i + 1)) / notches + radians;
Chris@132 508
Chris@132 509 float depth = cosf((a0 + a2) / 2);
Chris@132 510 if (depth < 0) continue;
Chris@132 511
Chris@132 512 float x0 = radius * sinf(a0) + w/2;
Chris@132 513 float x1 = radius * sinf(a1) + w/2;
Chris@132 514 float x2 = radius * sinf(a2) + w/2;
Chris@132 515 if (x2 < 0 || x0 > w) continue;
Chris@132 516
Chris@132 517 if (x0 < 0) x0 = 0;
Chris@132 518 if (x2 > w) x2 = w;
Chris@132 519
Chris@133 520 x0 += bw;
Chris@133 521 x1 += bw;
Chris@133 522 x2 += bw;
Chris@133 523
Chris@132 524 int grey = lrintf(255 * depth);
Chris@132 525 QColor fc = QColor(grey, grey, grey);
Chris@132 526 QColor oc = palette().dark().color();
Chris@132 527
Chris@132 528 paint.setPen(oc);
Chris@132 529 paint.setBrush(fc);
Chris@132 530
Chris@132 531 if (m_orientation == Qt::Horizontal) {
Chris@133 532 paint.drawRect(QRectF(x1, bw, x2 - x1, height() - bw*2));
Chris@132 533 } else {
Chris@133 534 paint.drawRect(QRectF(bw, x1, width() - bw*2, x2 - x1));
Chris@132 535 }
Chris@132 536
Chris@132 537 if (m_showScale) {
Chris@132 538
Chris@132 539 paint.setBrush(oc);
Chris@132 540
Chris@132 541 float prop;
Chris@132 542 if (i >= notches / 4) {
Chris@132 543 prop = float(notches - (((i - float(notches) / 4.f) * 4.f) / 3.f))
Chris@132 544 / notches;
Chris@132 545 } else {
Chris@132 546 prop = 0.f;
Chris@132 547 }
Chris@132 548
Chris@132 549 if (m_orientation == Qt::Horizontal) {
Chris@133 550 paint.drawRect(QRectF(x1, height() - (height() - bw*2) * prop - bw,
Chris@132 551 x2 - x1, height() * prop));
Chris@132 552 } else {
Chris@133 553 paint.drawRect(QRectF(bw, x1, (width() - bw*2) * prop, x2 - x1));
Chris@132 554 }
Chris@132 555 }
Chris@132 556
Chris@132 557 paint.setPen(oc);
Chris@132 558 paint.setBrush(palette().background().color());
Chris@132 559
Chris@132 560 if (m_orientation == Qt::Horizontal) {
Chris@133 561 paint.drawRect(QRectF(x0, bw, x1 - x0, height() - bw*2));
Chris@132 562 } else {
Chris@133 563 paint.drawRect(QRectF(bw, x0, width() - bw*2, x1 - x0));
Chris@132 564 }
Chris@132 565 }
Chris@132 566 }
Chris@132 567
Chris@132 568 QSize
Chris@132 569 Thumbwheel::sizeHint() const
Chris@132 570 {
Chris@132 571 if (m_orientation == Qt::Horizontal) {
Chris@132 572 return QSize(80, 12);
Chris@132 573 } else {
Chris@132 574 return QSize(12, 80);
Chris@132 575 }
Chris@132 576 }
Chris@132 577