Header of ImportFileView. More...
#include <importfilemodel.h>
Public Slots | |
void | slot_syncSectionWithTagContainer (int section, TagContainer::ColumnTag columnTag, QVariant data) |
Signals | |
void | signal_userInteraction (int column, TagContainer::ColumnTag role, QVariant data) |
Public Member Functions | |
ImportFileHeader (QWidget *parent=0) | |
void | setModel (ImportFileProcessorModel *model) |
ImportFileProcessorModel * | model () const |
void | addSection (const int column) |
void | deleteSection (const int column) |
bool | sectionExists (const int column) const |
QWidget *const | sectionAt (const int column) |
int | count () const |
QSize | sectionSizeFromContents (int logicalIndex) const |
Protected Member Functions | |
void | paintSection (QPainter *painter, const QRect &rect, int logicalIndex) const |
Header of ImportFileView.
ImportFileHeader::ImportFileHeader | ( | QWidget * | parent = 0 |
) |
: QHeaderView(Qt::Horizontal, parent) { setResizeMode(QHeaderView::ResizeToContents); connect(this, SIGNAL(sectionCountChanged(int, int)), this, SLOT(sectionCountAdjust(int, int))); }
void ImportFileHeader::addSection | ( | const int | column | ) |
Referenced by slot_syncSectionWithTagContainer().
{ if (!sectionExists(column)){ sections.insert(column, new ImportFileHeaderSection(column, this->viewport())); connect(sections.value(column), SIGNAL(signal_userInteraction(int, TagContainer::ColumnTag, QVariant)), this, SLOT(slot_sectionUserInteraction(int, TagContainer::ColumnTag, QVariant))); } }
int ImportFileHeader::count | ( | ) | const |
{ return sections.count(); }
void ImportFileHeader::deleteSection | ( | const int | column | ) |
{ if (sectionExists(column)){ disconnect(sections.value(column), SIGNAL(signal_userInteraction(int, TagContainer::ColumnTag, QVariant)), this, SLOT(slot_sectionUserInteraction(int, TagContainer::ColumnTag, QVariant))); delete sections.value(column); sections.remove(column); } }
ImportFileProcessorModel * ImportFileHeader::model | ( | ) | const |
Referenced by paintSection().
{ return dynamic_cast<ImportFileProcessorModel*>(QHeaderView::model()); }
void ImportFileHeader::paintSection | ( | QPainter * | painter, | |
const QRect & | rect, | |||
int | logicalIndex | |||
) | const [protected] |
{ Q_ASSERT(sectionExists(logicalIndex)); //qDebug() << "nr: " << logicalIndex << sections[logicalIndex]->geometry() << " AND " << rect; if (sections[logicalIndex]->geometry() != rect || !sections[logicalIndex]->isVisible()) { qDebug() << "Repainting header sections in ImportFileHeader for logicalindex: " << logicalIndex << " from #column: " << model()->columnCount(); for(int i = 0; i < model()->columnCount(); i++){ QRect newRect(sectionViewportPosition(i) ,rect.y(), sectionSize(i), rect.height()); if (!sections[i]->isVisible()) sections[i]->show(); sections[i]->setGeometry(newRect); //qDebug() << i << " to visual " << visualIndex(i) << sectionViewportPosition(i); } } }
QWidget *const ImportFileHeader::sectionAt | ( | const int | column | ) |
{ Q_ASSERT (sectionExists(column)); return sections.value(column); }
bool ImportFileHeader::sectionExists | ( | const int | column | ) | const |
Referenced by addSection(), deleteSection(), paintSection(), sectionAt(), sectionSizeFromContents(), and slot_syncSectionWithTagContainer().
{ return sections.contains(column) && !sections[column].isNull(); }
QSize ImportFileHeader::sectionSizeFromContents | ( | int | logicalIndex | ) | const |
{ if (sectionExists(logicalIndex))return sections.value(logicalIndex)->minimumSizeHint(); else return QHeaderView::sectionSizeFromContents(logicalIndex); }
void ImportFileHeader::setModel | ( | ImportFileProcessorModel * | model | ) |
{ QHeaderView::setModel(model); }
void ImportFileHeader::signal_userInteraction | ( | int | column, | |
TagContainer::ColumnTag | role, | |||
QVariant | data | |||
) | [signal] |
Referenced by addSection(), and deleteSection().
void ImportFileHeader::slot_syncSectionWithTagContainer | ( | int | section, | |
TagContainer::ColumnTag | columnTag, | |||
QVariant | data | |||
) | [slot] |
{ if(!sectionExists(section)) addSection(section); sections[section]->adjustContent(columnTag, data); emit geometriesChanged(); //Needed for headersize to be updated; }