Exemple #1
0
DrumTools::DrumTools(QWidget* parent)
   : QDockWidget(parent)
      {
      drumset = 0;
      _score  = 0;
      setObjectName("drum-tools");
      setAllowedAreas(Qt::DockWidgetAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea));

      QWidget* w = new QWidget(this);
      w->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
      w->setMaximumHeight(100);
      QHBoxLayout* layout = new QHBoxLayout;
      w->setLayout(layout);

      QVBoxLayout* layout1 = new QVBoxLayout;
      layout1->setSpacing(6);
      pitchName = new QLabel;
      pitchName->setAlignment(Qt::AlignCenter);
      pitchName->setWordWrap(true);
      pitchName->setContentsMargins(25, 0, 25, 0);
      layout1->addWidget(pitchName);
      QHBoxLayout* buttonLayout = new QHBoxLayout;
      buttonLayout->setContentsMargins(25, 10, 25, 10);
      editButton = new QToolButton;
      editButton->setMinimumWidth(100);
      editButton->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
      buttonLayout->addWidget(editButton);
      layout1->addLayout(buttonLayout);
      layout->addLayout(layout1);

      drumPalette = new Palette;
      drumPalette->setMag(0.8);
      drumPalette->setSelectable(true);
      drumPalette->setGrid(28, 60);
      PaletteScrollArea* sa = new PaletteScrollArea(drumPalette);
      sa->setFocusPolicy(Qt::NoFocus);
      layout->addWidget(sa);

      setWidget(w);

      w = new QWidget(this);
      setTitleBarWidget(w);
      titleBarWidget()->hide();
      connect(editButton, SIGNAL(clicked()), SLOT(editDrumset()));
      void boxClicked(int);
      connect(drumPalette, SIGNAL(boxClicked(int)), SLOT(drumNoteSelected(int)));
      retranslate();
      drumPalette->setContextMenuPolicy(Qt::PreventContextMenu);
      }
Exemple #2
0
DrumTools::DrumTools(QWidget* parent)
   : QDockWidget(parent)
      {
      drumset = 0;
      _score  = 0;
      setObjectName("drum-tools");
      setWindowTitle(tr("Drum Tools"));
      setAllowedAreas(Qt::DockWidgetAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea));

      QWidget* w = new QWidget(this);
      w->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
      QHBoxLayout* layout = new QHBoxLayout;
      w->setLayout(layout);

      QVBoxLayout* layout1 = new QVBoxLayout;
      QToolButton* tb = new QToolButton;
      tb->setText(tr("Edit Drumset"));
      layout1->addWidget(tb);
      layout1->addStretch();
      layout->addLayout(layout1);

      drumPalette = new Palette;
      drumPalette->setName(tr("Drums"));
      drumPalette->setMag(0.8);
      drumPalette->setSelectable(true);
      drumPalette->setGrid(28, 60);
      PaletteScrollArea* sa = new PaletteScrollArea(drumPalette);
      sa->setFocusPolicy(Qt::NoFocus);
      layout->addWidget(sa);

      setWidget(w);
//      setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));

      w = new QWidget(this);
      setTitleBarWidget(w);
      titleBarWidget()->hide();
      connect(tb, SIGNAL(clicked()), SLOT(editDrumset()));
      void boxClicked(int);
      connect(drumPalette, SIGNAL(boxClicked(int)), SLOT(drumNoteSelected(int)));
      }