Skip to content
Snippets Groups Projects
Commit bc715280 authored by Olivier Langella's avatar Olivier Langella
Browse files

ptm list : resize to content

parent a274860b
No related branches found
No related tags found
No related merge requests found
......@@ -122,3 +122,7 @@ void PtmIslandListWindow::doIdentificationPtmGroupGrouped(IdentificationGroup *
qDebug() << "PtmIslandListWindow::doIdentificationPtmGroupGrouped end";
}
void PtmIslandListWindow::resizeColumnsToContents() {
ui->ptm_island_tableview->resizeColumnsToContents();
}
......@@ -48,6 +48,7 @@ public:
explicit PtmIslandListWindow(ProjectWindow * parent = 0);
~PtmIslandListWindow();
void setIdentificationGroup(IdentificationGroup * p_identification_group);
void resizeColumnsToContents();
public slots:
......
......@@ -34,7 +34,7 @@
PtmIslandTableModel::PtmIslandTableModel(PtmIslandListWindow * p_ptm_island_list_window)
{
_p_ptm_island_list_window = p_ptm_island_list_window;
}
PtmIslandTableModel::~PtmIslandTableModel()
......@@ -132,15 +132,8 @@ void PtmIslandTableModel::setIdentificationGroup(IdentificationGroup * p_identif
//refresh();
qDebug() << "PtmIslandTableModel::setIdentificationGroup end ";
endResetModel();
//emit layoutAboutToBeChanged();
//emit layoutChanged();
/*
QModelIndex topLeft = index(0, 0);
QModelIndex bottomRight = index(rowCount() - 1, columnCount() - 1);
emit dataChanged(topLeft, bottomRight);
*/
this->_p_ptm_island_list_window->resizeColumnsToContents();
}
const PtmGroupingExperiment * PtmIslandTableModel::getPtmGroupingExperiment() const {
......@@ -187,6 +180,10 @@ QVariant PtmIslandTableModel::data(const QModelIndex &index, int role ) const {
int row = index.row();
int col = index.column();
switch(role) {
case Qt::SizeHintRole :
//qDebug() << "ProteinTableModel::headerData " << ProteinTableModel::getColumnWidth(section);
return QSize( PtmIslandTableModel::getColumnWidth(col), 30 );
break;
case Qt::DisplayRole:
if (_p_identification_group == nullptr) {
return QVariant();
......@@ -235,3 +232,17 @@ void PtmIslandTableModel::onPtmIslandDataChanged() {
emit layoutAboutToBeChanged();
emit layoutChanged();
}
int PtmIslandTableModel::getColumnWidth(int column) {
qDebug() << "PtmIslandTableModel::getColumnWidth " << column;
switch (column) {
case (int) PtmIslandListColumn::accession:
qDebug() << "PtmIslandTableModel::getColumnWidth accession " << column;
return 250;
break;
case (int) PtmIslandListColumn::description:
return 400;
break;
}
return 100;
}
......@@ -77,10 +77,12 @@ public:
public slots:
void onPtmIslandDataChanged();
private :
static int getColumnWidth(int column);
static const QString getTitle(std::int8_t column);
static const QString getDescription(std::int8_t column);
private :
IdentificationGroup * _p_identification_group=nullptr;
PtmIslandListWindow * _p_ptm_island_list_window=nullptr;
};
#endif // PTMISLANDTABLEMODEL_H
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment