aboutsummaryrefslogtreecommitdiff
path: root/qmidiplayer-desktop/qmpchannelswindow.cpp
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2018-10-02 23:08:08 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2018-10-02 23:08:08 +0800
commit11bda15b5ecb608686718a8180ff33ff37c673f3 (patch)
treeceb11877bb33b3d3fc7a68c1bfc678c3aa50949f /qmidiplayer-desktop/qmpchannelswindow.cpp
parenta25823bbc28bfb93f1330d7421bd2589c01386c1 (diff)
downloadQMidiPlayer-11bda15b5ecb608686718a8180ff33ff37c673f3.tar.xz
Fixed layout with Qt 5.11.0.8.6_fluidsynth-1.x_final
Minor code cleanups in qmpchannelswindow. Documentation update.
Diffstat (limited to 'qmidiplayer-desktop/qmpchannelswindow.cpp')
-rw-r--r--qmidiplayer-desktop/qmpchannelswindow.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/qmidiplayer-desktop/qmpchannelswindow.cpp b/qmidiplayer-desktop/qmpchannelswindow.cpp
index 77560dc..c154383 100644
--- a/qmidiplayer-desktop/qmpchannelswindow.cpp
+++ b/qmidiplayer-desktop/qmpchannelswindow.cpp
@@ -45,6 +45,7 @@ qmpChannelsWindow::qmpChannelsWindow(QWidget *parent) :
ui->twChannels->setCellWidget(i,3,new QDCComboBox());
QDCComboBox *cb=(QDCComboBox*)ui->twChannels->cellWidget(i,3);
cb->setID(i);
+ cb->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed);
for(size_t j=0;j<devc;++j)
{
cb->addItem(devs[j].c_str());
@@ -59,13 +60,13 @@ qmpChannelsWindow::qmpChannelsWindow(QWidget *parent) :
if(qmpSettingsWindow::getSettingsIntf()->value("Midi/DisableMapping",0).toInt())
cb->setEnabled(false);
connect(cb,SIGNAL(onChange(int,int)),this,SLOT(changeMidiMapping(int,int)));
- ui->twChannels->setCellWidget(i,4,new QDCLabel(""));
- ((QDCLabel*)ui->twChannels->cellWidget(i,4))->setID(i);
- connect(ui->twChannels->cellWidget(i,4),SIGNAL(onDoubleClick(int)),this,SLOT(showPresetWindow(int)));
+ ui->twChannels->setItem(i,4,new QTableWidgetItem(""));
+ ui->twChannels->item(i,4)->setFlags(Qt::ItemIsEnabled);
ui->twChannels->setCellWidget(i,5,new QDCPushButton("..."));
- ((QDCLabel*)ui->twChannels->cellWidget(i,5))->setID(i);
+ ((QDCPushButton*)ui->twChannels->cellWidget(i,5))->setID(i);
connect(ui->twChannels->cellWidget(i,5),SIGNAL(onClick(int)),this,SLOT(showChannelEditorWindow(int)));
}
+ connect(ui->twChannels,SIGNAL(cellDoubleClicked(int,int)),this,SLOT(showPresetWindow(int,int)));
ui->twChannels->setColumnWidth(0,24*(logicalDpiX()/96.));
ui->twChannels->setColumnWidth(1,24*(logicalDpiX()/96.));
ui->twChannels->setColumnWidth(2,24*(logicalDpiX()/96.));
@@ -130,7 +131,7 @@ void qmpChannelsWindow::channelWindowsUpdate()
if(qmpMainWindow::getInstance()->getPlayer()->isFinished())
{
for(int i=0;i<16;++i)
- ((QLabel*)ui->twChannels->cellWidget(i,4))->setText("");
+ ui->twChannels->item(i,4)->setText("");
connect(cb,SIGNAL(onNoteOn()),this,SLOT(updateChannelActivity()));
fused=0;return;
}
@@ -153,14 +154,14 @@ void qmpChannelsWindow::channelWindowsUpdate()
sprintf(data,"%03d:%03d %s",b,p,nm);
if(fused)
{
- if(strcmp(((QLabel*)ui->twChannels->cellWidget(i,4))->
+ if(strcmp((ui->twChannels->item(i,4))->
text().toStdString().c_str(),data))
{
connect(cb,SIGNAL(onNoteOn()),this,SLOT(updateChannelActivity()));
fused=0;
}
}
- ((QLabel*)ui->twChannels->cellWidget(i,4))->setText(data);
+ ui->twChannels->item(i,4)->setText(data);
ui->twChannels->item(i,0)->setIcon(
qmpMainWindow::getInstance()->getPlayer()->getChstates()[i]?*cha:*chi);
if(qmpMainWindow::getInstance()->getPlayer()->getChstates()[i])
@@ -207,8 +208,9 @@ void qmpChannelsWindow::on_pbUnsolo_clicked()
}
}
-void qmpChannelsWindow::showPresetWindow(int chid)
+void qmpChannelsWindow::showPresetWindow(int chid,int col)
{
+ if(col!=4)return;
pselectw->show();
pselectw->setupWindow(chid);
}