Ejemplo n.º 1
0
QImage Score::createThumbnail()
      {
      LayoutMode mode = layoutMode();
      setLayoutMode(LayoutMode::PAGE);
      doLayout();

      Page* page = pages().at(0);
      QRectF fr  = page->abbox();
      qreal mag  = 256.0 / qMax(fr.width(), fr.height());
      int w      = int(fr.width() * mag);
      int h      = int(fr.height() * mag);

      QImage pm(w, h, QImage::Format_ARGB32_Premultiplied);

      int dpm = lrint(DPMM * 1000.0);
      pm.setDotsPerMeterX(dpm);
      pm.setDotsPerMeterY(dpm);
      pm.fill(0xffffffff);

      double pr = MScore::pixelRatio;
      MScore::pixelRatio = 1.0;

      QPainter p(&pm);
      p.setRenderHint(QPainter::Antialiasing, true);
      p.setRenderHint(QPainter::TextAntialiasing, true);
      p.scale(mag, mag);
      print(&p, 0);
      p.end();

      MScore::pixelRatio = pr;

      if (layoutMode() != mode) {
            setLayoutMode(mode);
            doLayout();
            }
      return pm;
      }
int QListView::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QAbstractItemView::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 1)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 1;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< Movement*>(_v) = movement(); break;
        case 1: *reinterpret_cast< Flow*>(_v) = flow(); break;
        case 2: *reinterpret_cast< bool*>(_v) = isWrapping(); break;
        case 3: *reinterpret_cast< ResizeMode*>(_v) = resizeMode(); break;
        case 4: *reinterpret_cast< LayoutMode*>(_v) = layoutMode(); break;
        case 5: *reinterpret_cast< int*>(_v) = spacing(); break;
        case 6: *reinterpret_cast< QSize*>(_v) = gridSize(); break;
        case 7: *reinterpret_cast< ViewMode*>(_v) = viewMode(); break;
        case 8: *reinterpret_cast< int*>(_v) = modelColumn(); break;
        case 9: *reinterpret_cast< bool*>(_v) = uniformItemSizes(); break;
        case 10: *reinterpret_cast< int*>(_v) = batchSize(); break;
        case 11: *reinterpret_cast< bool*>(_v) = wordWrap(); break;
        case 12: *reinterpret_cast< bool*>(_v) = isSelectionRectVisible(); break;
        }
        _id -= 13;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setMovement(*reinterpret_cast< Movement*>(_v)); break;
        case 1: setFlow(*reinterpret_cast< Flow*>(_v)); break;
        case 2: setWrapping(*reinterpret_cast< bool*>(_v)); break;
        case 3: setResizeMode(*reinterpret_cast< ResizeMode*>(_v)); break;
        case 4: setLayoutMode(*reinterpret_cast< LayoutMode*>(_v)); break;
        case 5: setSpacing(*reinterpret_cast< int*>(_v)); break;
        case 6: setGridSize(*reinterpret_cast< QSize*>(_v)); break;
        case 7: setViewMode(*reinterpret_cast< ViewMode*>(_v)); break;
        case 8: setModelColumn(*reinterpret_cast< int*>(_v)); break;
        case 9: setUniformItemSizes(*reinterpret_cast< bool*>(_v)); break;
        case 10: setBatchSize(*reinterpret_cast< int*>(_v)); break;
        case 11: setWordWrap(*reinterpret_cast< bool*>(_v)); break;
        case 12: setSelectionRectVisible(*reinterpret_cast< bool*>(_v)); break;
        }
        _id -= 13;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 13;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 13;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 13;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 13;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 13;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 13;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}