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

peptide list column sizes

parent d6c82efe
No related branches found
No related tags found
No related merge requests found
......@@ -25,14 +25,16 @@
#include <QDebug>
#include <QColor>
#include <QSize>
#include "peptidelistwindow.h"
#include <pappsomspp/grouping/grppeptide.h>
#include "../../core/labeling/label.h"
PeptideTableModel::PeptideTableModel(QObject *parent)
PeptideTableModel::PeptideTableModel(PeptideListWindow * parent)
:QAbstractTableModel(parent)
{
_p_peptide_list_window = parent;
//ui->tableView->show();
// QModelIndex topLeft = createIndex(0,0);
//emit a signal to make the view reread identified data
......@@ -49,7 +51,7 @@ void PeptideTableModel::setProteinMatch(ProteinMatch * p_protein_match) {
//QModelIndex topLeft = createIndex(0,0);
//QModelIndex bottomRight = createIndex(rowCount(),columnCount());
_p_peptide_list_window->resizeColumnsToContents();
//emit dataChanged(topLeft, topLeft);
//emit headerDataChanged(Qt::Horizontal, 0,3);
qDebug() << "PeptideTableModel::setProteinMatch end " ;
......@@ -110,6 +112,10 @@ QVariant PeptideTableModel::data(const QModelIndex &index, int role ) const {
return QVariant(QColor("grey"));
}
break;
case Qt::SizeHintRole :
//qDebug() << "ProteinTableModel::headerData " << ProteinTableModel::getColumnWidth(section);
return QSize( PeptideTableModel::getColumnWidth(col), 30 );
break;
case Qt::DisplayRole:
if (_p_protein_match == nullptr) {
}
......@@ -218,7 +224,7 @@ void PeptideTableModel::onPeptideDataChanged() {
PeptideListColumn PeptideTableModel::getPeptideListColumn(std::int8_t column){
PeptideListColumn PeptideTableModel::getPeptideListColumn(std::int8_t column) {
return static_cast<PeptideListColumn>(column);
}
const QString PeptideTableModel::getTitle(PeptideListColumn column) {
......@@ -351,3 +357,23 @@ const QString PeptideTableModel::getDescription(std::int8_t column) {
}
return "";
}
int PeptideTableModel::getColumnWidth(int column) {
qDebug() << "PeptideTableModel::getColumnWidth " << column;
switch (column) {
case (int) PeptideListColumn::checked:
break;
case (int) PeptideListColumn::peptide_grouping_id:
return 120;
break;
case (int) PeptideListColumn::sample:
return 250;
break;
case (int) PeptideListColumn::sequence:
return 250;
break;
}
return 100;
}
......@@ -51,13 +51,13 @@ enum class PeptideListColumn: std::int8_t {
hyperscore=16
};
class PeptideTableModel;
class PeptideListWindow;
class PeptideTableModel: public QAbstractTableModel
{
Q_OBJECT
public:
PeptideTableModel(QObject *parent=0);
PeptideTableModel(PeptideListWindow *parent);
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
......@@ -80,8 +80,10 @@ public slots:
private :
static const QString getTitle(std::int8_t column);
static const QString getDescription(std::int8_t column);
static int getColumnWidth(int column);
private :
ProteinMatch * _p_protein_match= nullptr;
PeptideListWindow * _p_peptide_list_window=nullptr;
};
#endif // PEPTIDETABLEMODEL_H
......@@ -244,10 +244,10 @@ QVariant ProteinTableModel::data(const QModelIndex &index, int role ) const {
}
}
break;
case Qt::SizeHintRole :
//qDebug() << "ProteinTableModel::headerData " << ProteinTableModel::getColumnWidth(section);
return QSize( ProteinTableModel::getColumnWidth(col), 30 );
break;
case Qt::SizeHintRole :
//qDebug() << "ProteinTableModel::headerData " << ProteinTableModel::getColumnWidth(section);
return QSize( ProteinTableModel::getColumnWidth(col), 30 );
break;
case Qt::BackgroundRole:
if (_p_identification_group->getProteinMatchList().at(row)->isValid() == false)
{
......
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