Added Parameter window

master
Yohann Dedy 2017-03-05 12:39:29 +01:00
parent a59715dcee
commit 9c2174c9b0
4 changed files with 62 additions and 3 deletions

View File

@ -181,7 +181,15 @@ void mainWindow::presetCellClicked(int row, int column)
if(column == 2)
{
// TODO : CREATE A PARAM WINDOW
int presetNum = _presetsList->currentRow();
int paramVal = _preset[presetNum][2][row];
int r = paramVal / 16;
int c = paramVal % 16;
QModelIndex currentParam = _paramWindow->_paramNumsTable->model()->index(r,c);
_paramWindow->_paramNumsTable->setCurrentIndex(currentParam);
_paramWindow->_paramNumsTable->setFocus();
_paramWindow->show();
}
}
@ -247,6 +255,18 @@ void mainWindow::updateEventCell(int r, int c)
_eventWindow->close();
}
void mainWindow::updateParamCell(int r, int c)
{
//qDebug() << "r : " << r << "c : " << c;
int paramVal;
paramVal = 16*r + c;
// qDebug() << "paramVal : " << paramVal;
_preset[_presetsList->currentRow()][2][_presetSettingsTable->currentRow()] = paramVal;
_presetSettingsTable->setItem(_presetSettingsTable->currentRow(),2,new QTableWidgetItem(QString::number(paramVal)));
_paramWindow->close();
}
void mainWindow::updateSelectedPreset()
{
std::bitset<8> presetNum;

View File

@ -66,6 +66,7 @@ public slots:
void updatePreset(QMidiMessage* message);
void updateTable();
void updateEventCell(int row, int col);
void updateParamCell(int row, int col);
void updateSelectedPreset();
void updateSliders();

View File

@ -1,6 +1,40 @@
#include "paramwindow.h"
#include <QHBoxLayout>
paramWindow::paramWindow(QWidget *parent) : QMainWindow(parent)
paramWindow::paramWindow(QWidget *parent) :
QMainWindow(parent),
_paramNumsTable(new QTableWidget)
{
QWidget *mainWidget = new QWidget(this);
QHBoxLayout *mainLayout = new QHBoxLayout(mainWidget);
_paramNumsTable->setRowCount(8);
_paramNumsTable->setColumnCount(16);
_paramNumsTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
_paramNumsTable->setSelectionMode(QAbstractItemView::SingleSelection);
_paramNumsTable->horizontalHeader()->setHidden(true);
_paramNumsTable->horizontalHeader()->setDefaultSectionSize(40);
_paramNumsTable->verticalHeader()->setHidden(true);
_paramNumsTable->verticalHeader()->setDefaultSectionSize(30);
int i=0;
for(int r=0; r<_paramNumsTable->rowCount(); r++){
for(int c=0; c<_paramNumsTable->columnCount(); c++){
QString val = QString::number(i);
_paramNumsTable->setItem(r,c,new QTableWidgetItem(val));
i++;
}
}
mainLayout->addWidget(_paramNumsTable);
mainWidget->setFixedSize(670,270);
mainWidget->setLayout(mainLayout);
this->setCentralWidget(mainWidget);
connect(_paramNumsTable,SIGNAL(cellDoubleClicked(int,int)),parent,SLOT(updateParamCell(int,int)));
}
paramWindow::~paramWindow()
{
}

View File

@ -3,12 +3,16 @@
#include <QMainWindow>
#include <QtWidgets>
#include <QTableWidget>
class paramWindow : public QMainWindow
{
Q_OBJECT
public:
explicit paramWindow(QWidget *parent = 0);
~paramWindow();
QTableWidget* _paramNumsTable;
signals: