annotate widgets/LevelPanWidget.cpp @ 1305:21342513c252

Slightly nicer pan handling, avoiding showing spurious >0dB peaks
author Chris Cannam
date Mon, 25 Jun 2018 14:16:16 +0100
parents a575dae05fbf
children 5db672d6de4f
rev   line source
Chris@923 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@923 2
Chris@923 3 /*
Chris@923 4 Sonic Visualiser
Chris@923 5 An audio file viewer and annotation editor.
Chris@923 6 Centre for Digital Music, Queen Mary, University of London.
Chris@923 7
Chris@923 8 This program is free software; you can redistribute it and/or
Chris@923 9 modify it under the terms of the GNU General Public License as
Chris@923 10 published by the Free Software Foundation; either version 2 of the
Chris@923 11 License, or (at your option) any later version. See the file
Chris@923 12 COPYING included with this distribution for more information.
Chris@923 13 */
Chris@923 14
Chris@923 15 #include "LevelPanWidget.h"
Chris@923 16
Chris@923 17 #include <QPainter>
Chris@923 18 #include <QMouseEvent>
Chris@923 19 #include <QWheelEvent>
Chris@923 20
Chris@923 21 #include "layer/ColourMapper.h"
Chris@925 22 #include "base/AudioLevel.h"
Chris@923 23
Chris@1176 24 #include "WidgetScale.h"
Chris@1176 25
Chris@923 26 #include <iostream>
Chris@926 27 #include <cmath>
Chris@940 28 #include <cassert>
Chris@923 29
Chris@923 30 using std::cerr;
Chris@923 31 using std::endl;
Chris@923 32
Chris@1301 33 /**
Chris@1301 34 * Gain and pan scales:
Chris@1301 35 *
Chris@1301 36 * Gain: we have 5 circles vertically in the display, each of which
Chris@1301 37 * has half-circle and full-circle versions, and we also have "no
Chris@1301 38 * circles", so there are in total 11 distinct levels, which we refer
Chris@1301 39 * to as "notches" and number 0-10. (We use "notch" because "level" is
Chris@1301 40 * used by the external API to refer to audio gain.)
Chris@1301 41 *
Chris@1301 42 * i.e. the levels are represented by these (schematic, rotated to
Chris@1301 43 * horizontal) displays:
Chris@1301 44 *
Chris@1301 45 * 0 X
Chris@1301 46 * 1 [
Chris@1301 47 * 2 []
Chris@1301 48 * 3 [][
Chris@1301 49 * ...
Chris@1301 50 * 9 [][][][][
Chris@1301 51 * 10 [][][][][]
Chris@1301 52 *
Chris@1301 53 * If we have mute enabled, then we map the range 0-10 to gain using
Chris@1301 54 * AudioLevel::fader_to_* with the ShortFader type, which treats fader
Chris@1301 55 * 0 as muted. If mute is disabled, then we map the range 1-10.
Chris@1301 56 *
Chris@1301 57 * We can also disable half-circles, which leaves the range unchanged
Chris@1301 58 * but limits the notches to even values.
Chris@1301 59 *
Chris@1301 60 * Pan: we have 5 columns with no finer resolution, so we only have 2
Chris@1301 61 * possible pan values on each side of centre.
Chris@1301 62 */
Chris@1301 63
Chris@923 64 static const int maxPan = 2; // range is -maxPan to maxPan
Chris@923 65
Chris@923 66 LevelPanWidget::LevelPanWidget(QWidget *parent) :
Chris@923 67 QWidget(parent),
Chris@1301 68 m_minNotch(0),
Chris@1301 69 m_maxNotch(10),
Chris@1301 70 m_notch(m_maxNotch),
Chris@923 71 m_pan(0),
Chris@1177 72 m_monitorLeft(-1),
Chris@1177 73 m_monitorRight(-1),
Chris@940 74 m_editable(true),
Chris@1249 75 m_editing(false),
Chris@1301 76 m_includeMute(true),
Chris@1303 77 m_includeHalfSteps(true)
Chris@923 78 {
Chris@1191 79 setToolTip(tr("Drag vertically to adjust level, horizontally to adjust pan"));
Chris@1201 80 setLevel(1.0);
Chris@1201 81 setPan(0.0);
Chris@923 82 }
Chris@923 83
Chris@923 84 LevelPanWidget::~LevelPanWidget()
Chris@923 85 {
Chris@923 86 }
Chris@923 87
Chris@1249 88 void
Chris@1249 89 LevelPanWidget::setToDefault()
Chris@1249 90 {
Chris@1249 91 setLevel(1.0);
Chris@1249 92 setPan(0.0);
Chris@1250 93 emitLevelChanged();
Chris@1250 94 emitPanChanged();
Chris@1249 95 }
Chris@1249 96
Chris@929 97 QSize
Chris@929 98 LevelPanWidget::sizeHint() const
Chris@929 99 {
Chris@1176 100 return WidgetScale::scaleQSize(QSize(40, 40));
Chris@929 101 }
Chris@929 102
Chris@1301 103 int
Chris@1301 104 LevelPanWidget::clampNotch(int notch) const
Chris@940 105 {
Chris@1301 106 if (notch < m_minNotch) notch = m_minNotch;
Chris@1301 107 if (notch > m_maxNotch) notch = m_maxNotch;
Chris@1301 108 if (!m_includeHalfSteps) {
Chris@1301 109 notch = (notch / 2) * 2;
Chris@1301 110 }
Chris@1301 111 return notch;
Chris@940 112 }
Chris@940 113
Chris@1177 114 int
Chris@1302 115 LevelPanWidget::clampPan(int pan) const
Chris@1302 116 {
Chris@1302 117 if (pan < -maxPan) pan = -maxPan;
Chris@1302 118 if (pan > maxPan) pan = maxPan;
Chris@1302 119 return pan;
Chris@1302 120 }
Chris@1302 121
Chris@1302 122 int
Chris@1301 123 LevelPanWidget::audioLevelToNotch(float audioLevel) const
Chris@1177 124 {
Chris@1301 125 int notch = AudioLevel::multiplier_to_fader
Chris@1301 126 (audioLevel, m_maxNotch, AudioLevel::ShortFader);
Chris@1301 127 return clampNotch(notch);
Chris@1177 128 }
Chris@1177 129
Chris@1177 130 float
Chris@1301 131 LevelPanWidget::notchToAudioLevel(int notch) const
Chris@1177 132 {
Chris@1301 133 return float(AudioLevel::fader_to_multiplier
Chris@1301 134 (notch, m_maxNotch, AudioLevel::ShortFader));
Chris@1177 135 }
Chris@1177 136
Chris@923 137 void
Chris@1301 138 LevelPanWidget::setLevel(float level)
Chris@923 139 {
Chris@1301 140 int notch = audioLevelToNotch(level);
Chris@1301 141 if (notch != m_notch) {
Chris@1301 142 m_notch = notch;
Chris@1266 143 float convertsTo = getLevel();
Chris@1301 144 if (fabsf(convertsTo - level) > 1e-5) {
Chris@1266 145 emitLevelChanged();
Chris@1266 146 }
Chris@1266 147 update();
Chris@925 148 }
Chris@923 149 }
Chris@923 150
Chris@940 151 float
Chris@940 152 LevelPanWidget::getLevel() const
Chris@940 153 {
Chris@1301 154 return notchToAudioLevel(m_notch);
Chris@1177 155 }
Chris@1177 156
Chris@1177 157 int
Chris@1301 158 LevelPanWidget::audioPanToPan(float audioPan) const
Chris@1177 159 {
Chris@1177 160 int pan = int(round(audioPan * maxPan));
Chris@1302 161 pan = clampPan(pan);
Chris@1177 162 return pan;
Chris@1177 163 }
Chris@1177 164
Chris@1177 165 float
Chris@1301 166 LevelPanWidget::panToAudioPan(int pan) const
Chris@1177 167 {
Chris@1177 168 return float(pan) / float(maxPan);
Chris@1177 169 }
Chris@1177 170
Chris@1177 171 void
Chris@1177 172 LevelPanWidget::setPan(float fpan)
Chris@1177 173 {
Chris@1177 174 int pan = audioPanToPan(fpan);
Chris@1177 175 if (pan != m_pan) {
Chris@1177 176 m_pan = pan;
Chris@1177 177 update();
Chris@940 178 }
Chris@940 179 }
Chris@940 180
Chris@1177 181 float
Chris@1177 182 LevelPanWidget::getPan() const
Chris@1177 183 {
Chris@1177 184 return panToAudioPan(m_pan);
Chris@1177 185 }
Chris@1177 186
Chris@923 187 void
Chris@1177 188 LevelPanWidget::setMonitoringLevels(float left, float right)
Chris@923 189 {
Chris@1177 190 m_monitorLeft = left;
Chris@1177 191 m_monitorRight = right;
Chris@923 192 update();
Chris@923 193 }
Chris@923 194
Chris@940 195 bool
Chris@940 196 LevelPanWidget::isEditable() const
Chris@940 197 {
Chris@940 198 return m_editable;
Chris@940 199 }
Chris@940 200
Chris@940 201 bool
Chris@940 202 LevelPanWidget::includesMute() const
Chris@940 203 {
Chris@940 204 return m_includeMute;
Chris@940 205 }
Chris@940 206
Chris@923 207 void
Chris@923 208 LevelPanWidget::setEditable(bool editable)
Chris@923 209 {
Chris@923 210 m_editable = editable;
Chris@923 211 update();
Chris@923 212 }
Chris@923 213
Chris@940 214 void
Chris@940 215 LevelPanWidget::setIncludeMute(bool include)
Chris@923 216 {
Chris@940 217 m_includeMute = include;
Chris@1301 218 if (m_includeMute) {
Chris@1301 219 m_minNotch = 0;
Chris@1301 220 } else {
Chris@1301 221 m_minNotch = 1;
Chris@1301 222 }
Chris@940 223 emitLevelChanged();
Chris@940 224 update();
Chris@923 225 }
Chris@923 226
Chris@923 227 void
Chris@923 228 LevelPanWidget::emitLevelChanged()
Chris@923 229 {
Chris@923 230 emit levelChanged(getLevel());
Chris@923 231 }
Chris@923 232
Chris@923 233 void
Chris@923 234 LevelPanWidget::emitPanChanged()
Chris@923 235 {
Chris@923 236 emit panChanged(getPan());
Chris@923 237 }
Chris@923 238
Chris@923 239 void
Chris@923 240 LevelPanWidget::mousePressEvent(QMouseEvent *e)
Chris@923 241 {
Chris@1249 242 if (e->button() == Qt::MidButton ||
Chris@1249 243 ((e->button() == Qt::LeftButton) &&
Chris@1249 244 (e->modifiers() & Qt::ControlModifier))) {
Chris@1249 245 setToDefault();
Chris@1249 246 } else if (e->button() == Qt::LeftButton) {
Chris@1249 247 m_editing = true;
Chris@1249 248 mouseMoveEvent(e);
Chris@1249 249 }
Chris@1249 250 }
Chris@1249 251
Chris@1249 252 void
Chris@1249 253 LevelPanWidget::mouseReleaseEvent(QMouseEvent *e)
Chris@1249 254 {
Chris@923 255 mouseMoveEvent(e);
Chris@1249 256 m_editing = false;
Chris@923 257 }
Chris@923 258
Chris@923 259 void
Chris@923 260 LevelPanWidget::mouseMoveEvent(QMouseEvent *e)
Chris@923 261 {
Chris@923 262 if (!m_editable) return;
Chris@1249 263 if (!m_editing) return;
Chris@923 264
Chris@1301 265 int notch = coordsToNotch(rect(), e->pos());
Chris@1301 266 int pan = coordsToPan(rect(), e->pos());
Chris@1301 267
Chris@1301 268 if (notch == m_notch && pan == m_pan) {
Chris@1266 269 return;
Chris@923 270 }
Chris@1301 271 if (notch != m_notch) {
Chris@1301 272 m_notch = notch;
Chris@1266 273 emitLevelChanged();
Chris@923 274 }
Chris@923 275 if (pan != m_pan) {
Chris@1266 276 m_pan = pan;
Chris@1266 277 emitPanChanged();
Chris@923 278 }
Chris@923 279 update();
Chris@923 280 }
Chris@923 281
Chris@923 282 void
Chris@923 283 LevelPanWidget::wheelEvent(QWheelEvent *e)
Chris@923 284 {
Chris@1303 285 int delta = m_wheelCounter.count(e);
Chris@1303 286
Chris@1303 287 if (delta == 0) {
Chris@1302 288 return;
Chris@1302 289 }
Chris@1302 290
Chris@1303 291 if (e->modifiers() & Qt::ControlModifier) {
Chris@1303 292 m_pan = clampPan(m_pan + delta);
Chris@1303 293 emitPanChanged();
Chris@1303 294 update();
Chris@1302 295 } else {
Chris@1303 296 m_notch = clampNotch(m_notch + delta);
Chris@1303 297 emitLevelChanged();
Chris@1303 298 update();
Chris@923 299 }
Chris@923 300 }
Chris@923 301
Chris@1301 302 int
Chris@1301 303 LevelPanWidget::coordsToNotch(QRectF rect, QPointF loc) const
Chris@923 304 {
Chris@1301 305 double h = rect.height();
Chris@1301 306
Chris@1301 307 int nnotch = m_maxNotch + 1;
Chris@1301 308 double cell = h / nnotch;
Chris@1301 309
Chris@1301 310 int notch = int((h - (loc.y() - rect.y())) / cell);
Chris@1301 311 notch = clampNotch(notch);
Chris@1301 312
Chris@1301 313 return notch;
Chris@1301 314 }
Chris@1301 315
Chris@1301 316 int
Chris@1301 317 LevelPanWidget::coordsToPan(QRectF rect, QPointF loc) const
Chris@1301 318 {
Chris@1301 319 double w = rect.width();
Chris@929 320
Chris@923 321 int npan = maxPan * 2 + 1;
Chris@1301 322 double cell = w / npan;
Chris@929 323
Chris@1301 324 int pan = int((loc.x() - rect.x()) / cell) - maxPan;
Chris@1302 325 pan = clampPan(pan);
Chris@1301 326
Chris@1301 327 return pan;
Chris@923 328 }
Chris@923 329
Chris@923 330 QSizeF
Chris@929 331 LevelPanWidget::cellSize(QRectF rect) const
Chris@923 332 {
Chris@929 333 double w = rect.width(), h = rect.height();
Chris@1301 334 int ncol = maxPan * 2 + 1;
Chris@1301 335 int nrow = m_maxNotch/2;
Chris@1301 336 double wcell = w / ncol, hcell = h / nrow;
Chris@923 337 return QSizeF(wcell, hcell);
Chris@923 338 }
Chris@923 339
Chris@923 340 QPointF
Chris@1301 341 LevelPanWidget::cellCentre(QRectF rect, int row, int col) const
Chris@923 342 {
Chris@929 343 QSizeF cs = cellSize(rect);
Chris@1301 344 return QPointF(rect.x() +
Chris@1301 345 cs.width() * (col + maxPan) + cs.width() / 2.,
Chris@1301 346 rect.y() + rect.height() -
Chris@1301 347 cs.height() * (row + 1) + cs.height() / 2.);
Chris@923 348 }
Chris@923 349
Chris@923 350 QSizeF
Chris@929 351 LevelPanWidget::cellLightSize(QRectF rect) const
Chris@923 352 {
Chris@923 353 double extent = 3. / 4.;
Chris@929 354 QSizeF cs = cellSize(rect);
Chris@923 355 double m = std::min(cs.width(), cs.height());
Chris@923 356 return QSizeF(m * extent, m * extent);
Chris@923 357 }
Chris@923 358
Chris@923 359 QRectF
Chris@1301 360 LevelPanWidget::cellLightRect(QRectF rect, int row, int col) const
Chris@923 361 {
Chris@929 362 QSizeF cls = cellLightSize(rect);
Chris@1301 363 QPointF cc = cellCentre(rect, row, col);
Chris@923 364 return QRectF(cc.x() - cls.width() / 2.,
Chris@1266 365 cc.y() - cls.height() / 2.,
Chris@1266 366 cls.width(),
Chris@1266 367 cls.height());
Chris@923 368 }
Chris@923 369
Chris@923 370 double
Chris@929 371 LevelPanWidget::thinLineWidth(QRectF rect) const
Chris@923 372 {
Chris@929 373 double tw = ceil(rect.width() / (maxPan * 2. * 10.));
Chris@1301 374 double th = ceil(rect.height() / (m_maxNotch/2 * 10.));
Chris@923 375 return std::min(th, tw);
Chris@923 376 }
Chris@923 377
Chris@1304 378 double
Chris@1304 379 LevelPanWidget::cornerRadius(QRectF rect) const
Chris@1304 380 {
Chris@1304 381 QSizeF cs = cellSize(rect);
Chris@1304 382 double m = std::min(cs.width(), cs.height());
Chris@1304 383 return m / 5;
Chris@1304 384 }
Chris@1304 385
Chris@1301 386 QRectF
Chris@1301 387 LevelPanWidget::cellOutlineRect(QRectF rect, int row, int col) const
Chris@941 388 {
Chris@1301 389 QRectF clr = cellLightRect(rect, row, col);
Chris@1301 390 double adj = thinLineWidth(rect)/2;
Chris@1301 391 return clr.adjusted(-adj, -adj, adj, adj);
Chris@1301 392 }
Chris@1301 393
Chris@1301 394 QColor
Chris@1301 395 LevelPanWidget::notchToColour(int notch) const
Chris@1301 396 {
Chris@1301 397 if (notch < 3) return Qt::black;
Chris@1301 398 if (notch < 5) return QColor(80, 0, 0);
Chris@1301 399 if (notch < 7) return QColor(160, 0, 0);
Chris@1301 400 if (notch < 9) return QColor(255, 0, 0);
Chris@1301 401 return QColor(255, 255, 0);
Chris@941 402 }
Chris@941 403
Chris@923 404 void
Chris@929 405 LevelPanWidget::renderTo(QPaintDevice *dev, QRectF rect, bool asIfEditable) const
Chris@923 406 {
Chris@929 407 QPainter paint(dev);
Chris@923 408
Chris@923 409 paint.setRenderHint(QPainter::Antialiasing, true);
Chris@923 410
Chris@923 411 QPen pen;
Chris@923 412
Chris@929 413 double thin = thinLineWidth(rect);
Chris@1304 414 double radius = cornerRadius(rect);
Chris@938 415
Chris@1301 416 QColor columnBackground = QColor(180, 180, 180);
Chris@1304 417 paint.setPen(Qt::NoPen);
Chris@1304 418 paint.setBrush(columnBackground);
Chris@923 419
Chris@923 420 for (int pan = -maxPan; pan <= maxPan; ++pan) {
Chris@1304 421 QRectF top = cellOutlineRect(rect, m_maxNotch/2 - 1, pan);
Chris@1304 422 QRectF bottom = cellOutlineRect(rect, 0, pan);
Chris@1304 423 paint.drawRoundedRect(QRectF(top.x(),
Chris@1304 424 top.y(),
Chris@1304 425 top.width(),
Chris@1304 426 bottom.y() + bottom.height() - top.y()),
Chris@1304 427 radius, radius);
Chris@924 428 }
Chris@924 429
Chris@1301 430 bool monitoring = (m_monitorLeft > 0.f || m_monitorRight > 0.f);
Chris@1301 431
Chris@1301 432 if (isEnabled()) {
Chris@1301 433 pen.setColor(Qt::black);
Chris@1301 434 } else {
Chris@1301 435 pen.setColor(Qt::darkGray);
Chris@1301 436 }
Chris@1301 437
Chris@1301 438 if (!asIfEditable && m_includeMute && m_notch == 0) {
Chris@1301 439 // The X for mute takes up the whole display when we're not
Chris@1301 440 // being rendered in editable style
Chris@1301 441 pen.setWidthF(thin * 2);
Chris@1301 442 pen.setCapStyle(Qt::RoundCap);
Chris@1301 443 paint.setPen(pen);
Chris@1301 444 paint.drawLine(cellCentre(rect, 0, -maxPan),
Chris@1301 445 cellCentre(rect, m_maxNotch/2 - 1, maxPan));
Chris@1301 446 paint.drawLine(cellCentre(rect, m_maxNotch/2 - 1, -maxPan),
Chris@1301 447 cellCentre(rect, 0, maxPan));
Chris@1301 448 } else {
Chris@1301 449 // the normal case
Chris@1301 450
Chris@1301 451 // pen a bit less thin than in theory, so that we can erase
Chris@1301 452 // semi-circles later without leaving a faint edge
Chris@1301 453 pen.setWidthF(thin * 0.8);
Chris@1301 454 pen.setCapStyle(Qt::FlatCap);
Chris@1301 455 paint.setPen(pen);
Chris@1301 456
Chris@1301 457 if (m_includeMute && m_notch == 0) {
Chris@1301 458 QRectF clr = cellLightRect(rect, 0, m_pan);
Chris@1301 459 paint.drawLine(clr.topLeft(), clr.bottomRight());
Chris@1301 460 paint.drawLine(clr.bottomLeft(), clr.topRight());
Chris@1301 461 } else {
Chris@1301 462 for (int notch = 1; notch <= m_notch; notch += 2) {
Chris@1301 463 if (isEnabled() && !monitoring) {
Chris@1301 464 paint.setBrush(notchToColour(notch));
Chris@1304 465 } else {
Chris@1304 466 paint.setBrush(Qt::NoBrush);
Chris@1301 467 }
Chris@1301 468 QRectF clr = cellLightRect(rect, notch/2, m_pan);
Chris@1304 469 paint.drawRoundedRect(clr, radius, radius);
Chris@1301 470 }
Chris@1301 471 if (m_notch % 2 != 0) {
Chris@1301 472 QRectF clr = cellOutlineRect(rect, (m_notch-1)/2, m_pan);
Chris@1301 473 paint.save();
Chris@1301 474 paint.setPen(Qt::NoPen);
Chris@1301 475 paint.setBrush(columnBackground);
Chris@1304 476 paint.drawRoundedRect(QRectF(clr.x(),
Chris@1304 477 clr.y(),
Chris@1304 478 clr.width(),
Chris@1304 479 clr.height()/4 + thin),
Chris@1304 480 radius, radius);
Chris@1304 481 paint.drawRect(QRectF(clr.x(),
Chris@1304 482 clr.y() + clr.height()/4 - thin,
Chris@1304 483 clr.width(),
Chris@1304 484 clr.height()/4 + thin));
Chris@1301 485 paint.restore();
Chris@1301 486 }
Chris@1301 487 }
Chris@1301 488 }
Chris@1301 489
Chris@1301 490 if (monitoring) {
Chris@1177 491 paint.setPen(Qt::NoPen);
Chris@1305 492
Chris@1177 493 for (int pan = -maxPan; pan <= maxPan; ++pan) {
Chris@1305 494 float rprop = float(pan - (-maxPan)) / float(maxPan * 2);
Chris@1305 495 float lprop = float(maxPan - pan) / float(maxPan * 2);
Chris@1305 496 float audioLevel =
Chris@1305 497 lprop * m_monitorLeft * m_monitorLeft +
Chris@1305 498 rprop * m_monitorRight * m_monitorRight;
Chris@1301 499 int notchHere = audioLevelToNotch(audioLevel);
Chris@1305 500
Chris@1301 501 for (int notch = 1; notch <= notchHere; notch += 2) {
Chris@1305 502
Chris@1301 503 paint.setBrush(notchToColour(notch));
Chris@1301 504 QRectF clr = cellLightRect(rect, (notch-1)/2, pan);
Chris@1305 505 // double adj = thinLineWidth(rect)/2;
Chris@1305 506 // clr = clr.adjusted(adj, adj, -adj, -adj);
Chris@1305 507 paint.drawRoundedRect(clr, radius, radius);
Chris@1305 508
Chris@1301 509 if (notch + 2 > notchHere && notchHere % 2 != 0) {
Chris@1305 510 paint.save();
Chris@1305 511 paint.setBrush(columnBackground);
Chris@1305 512 paint.drawRoundedRect(QRectF(clr.x(),
Chris@1305 513 clr.y()-0.5,
Chris@1305 514 clr.width(),
Chris@1305 515 clr.height()/4 + thin),
Chris@1305 516 radius, radius);
Chris@1305 517 paint.drawRect(QRectF(clr.x(),
Chris@1305 518 clr.y() + clr.height()/4 - thin,
Chris@1305 519 clr.width(),
Chris@1305 520 clr.height()/4 + thin));
Chris@1305 521 paint.restore();
Chris@1301 522 }
Chris@1177 523 }
Chris@1177 524 }
Chris@1177 525 }
Chris@923 526 }
Chris@923 527
Chris@929 528 void
Chris@929 529 LevelPanWidget::paintEvent(QPaintEvent *)
Chris@929 530 {
Chris@929 531 renderTo(this, rect(), m_editable);
Chris@929 532 }
Chris@923 533
Chris@1180 534 void
Chris@1180 535 LevelPanWidget::enterEvent(QEvent *e)
Chris@1180 536 {
Chris@1180 537 QWidget::enterEvent(e);
Chris@1180 538 emit mouseEntered();
Chris@1180 539 }
Chris@929 540
Chris@1180 541 void
Chris@1180 542 LevelPanWidget::leaveEvent(QEvent *e)
Chris@1180 543 {
Chris@1180 544 QWidget::enterEvent(e);
Chris@1180 545 emit mouseLeft();
Chris@1180 546 }
Chris@929 547