SpikeStream Application Library
0.2
|
00001 #include "ConnectionsTableView.h" 00002 using namespace spikestream; 00003 00004 //Qt includes 00005 #include <QDebug> 00006 #include <QHeaderView> 00007 00008 00010 ConnectionsTableView::ConnectionsTableView(QWidget* parent, QAbstractTableModel* model) : QTableView(parent) { 00011 //Set up the view 00012 setShowGrid(false); 00013 setSelectionMode(QAbstractItemView::NoSelection); 00014 00015 //Set the model for this view and show it 00016 setModel(model); 00017 show(); 00018 resizeHeaders(); 00019 } 00020 00021 00023 ConnectionsTableView::~ConnectionsTableView(){ 00024 } 00025 00026 00027 /*----------------------------------------------------------*/ 00028 /*----- PUBLIC METHODS -----*/ 00029 /*----------------------------------------------------------*/ 00030 00033 void ConnectionsTableView::resizeHeaders(){ 00034 QHeaderView* hHeader = horizontalHeader(); 00035 hHeader->setMinimumSectionSize(10); 00036 hHeader->resizeSection(hHeader->logicalIndex(0), 100);//ID 00037 hHeader->resizeSection(hHeader->logicalIndex(1), 50);//From ID 00038 hHeader->resizeSection(hHeader->logicalIndex(2), 50);//To ID 00039 hHeader->resizeSection(hHeader->logicalIndex(3), 50);//Delay 00040 hHeader->resizeSection(hHeader->logicalIndex(4), 50);//Weight 00041 hHeader->resizeSection(hHeader->logicalIndex(5), 100);//Temporary weight 00042 hHeader->setDefaultAlignment(Qt::AlignLeft); 00043 } 00044 00045