SpikeStream Application Library  0.2
AnalysesTableView.cpp
Go to the documentation of this file.
00001 #include "AnalysesTableView.h"
00002 using namespace spikestream;
00003 
00004 //Qt includes
00005 #include <QDebug>
00006 #include <QHeaderView>
00007 
00009 AnalysesTableView::AnalysesTableView(QWidget* parent, QAbstractTableModel* model) : QTableView(parent) {
00010     //Set up the view
00011     setShowGrid(false);
00012     setSelectionMode(QAbstractItemView::NoSelection);
00013     connect(this, SIGNAL(clicked(QModelIndex)), this, SLOT(tableClicked(QModelIndex)));
00014 
00015     //Set the model for this view and show it
00016     setModel(model);
00017     show();
00018     resizeHeaders();
00019 }
00020 
00021 
00023 AnalysesTableView::~AnalysesTableView(){
00024 }
00025 
00026 
00027 /*------------------------------------------------------------*/
00028 /*------               PUBLIC METHODS                   ------*/
00029 /*------------------------------------------------------------*/
00030 
00033 void AnalysesTableView::resizeHeaders(){
00034     QHeaderView* hHeader = horizontalHeader();
00035     hHeader->setMinimumSectionSize(10);
00036     hHeader->resizeSection(hHeader->logicalIndex(0), 30);//Check box
00037     hHeader->resizeSection(hHeader->logicalIndex(1), 50);//ID
00038     hHeader->resizeSection(hHeader->logicalIndex(2), 50);//Network id
00039     hHeader->resizeSection(hHeader->logicalIndex(3), 50);//Archive ID
00040     hHeader->resizeSection(hHeader->logicalIndex(4), 80);//Time
00041     hHeader->resizeSection(hHeader->logicalIndex(5), 200);//Description
00042     hHeader->resizeSection(hHeader->logicalIndex(6), 50);//Parameters
00043     hHeader->resizeSection(hHeader->logicalIndex(7), 50);//type
00044     hHeader->setDefaultAlignment(Qt::AlignLeft);
00045 }
00046 
00047 
00048 /*------------------------------------------------------------*/
00049 /*------               PRIVATE SLOTS                    ------*/
00050 /*------------------------------------------------------------*/
00051 
00053 void AnalysesTableView::tableClicked(QModelIndex index){
00054     if(index.column() == 0 || index.column() == 1)
00055         model()->setData(index, 0);
00056 }
00057 
 All Classes Files Functions Variables Typedefs Friends Defines