HeaderViewWidget::HeaderViewWidget(Qt::Orientation orientation, QWidget *parent) : QHeaderView(orientation, parent) { setTextElideMode(Qt::ElideRight); setSectionsMovable(true); connect(this, SIGNAL(sectionClicked(int)), this, SLOT(toggleSort(int))); }
ViewHeader::ViewHeader( QAbstractItemView* parent ) : QHeaderView( Qt::Horizontal, parent ) , m_parent( parent ) , m_menu( new QMenu( this ) ) , m_sigmap( new QSignalMapper( this ) ) , m_init( false ) { m_menu->setFont( TomahawkUtils::systemFont() ); #if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 ) setSectionResizeMode( QHeaderView::Interactive ); setSectionsMovable( true ); #else setResizeMode( QHeaderView::Interactive ); setMovable( true ); #endif setMinimumSectionSize( 60 ); setDefaultAlignment( Qt::AlignLeft ); setStretchLastSection( true ); // m_menu->addAction( tr( "Resize columns to fit window" ), this, SLOT( onToggleResizeColumns() ) ); // m_menu->addSeparator(); connect( m_sigmap, SIGNAL( mapped( int ) ), SLOT( toggleVisibility( int ) ) ); }
MyHorizontalHeader(QWidget *parent = 0) : QHeaderView(Qt::Horizontal, parent) { connect(this, SIGNAL(sectionResized(int, int, int)), this, SLOT(handleSectionResized(int))); connect(this, SIGNAL(sectionMoved(int, int, int)), this, SLOT(handleSectionMoved(int, int, int))); setSectionsMovable(true); for (int i = 0; i < MAX_COLUMN_COUNT; i++) { boxes[i] = NULL; } }
HeaderView::HeaderView(QAbstractItemView* parent) : QHeaderView(Qt::Horizontal, parent) , m_parent(parent) , m_menu(0) { #if QT_VERSION >= 0x050000 setSectionsMovable(true); #else setMovable(true); #endif setStretchLastSection(true); setDefaultAlignment(Qt::AlignLeft); setMinimumSectionSize(60); }
CQHeaderView:: CQHeaderView(QWidget *parent) : QHeaderView(Qt::Horizontal, parent) { connect(this, SIGNAL(sectionResized(int, int, int)), this, SLOT(handleSectionResized(int))); connect(this, SIGNAL(sectionMoved(int, int, int)), this, SLOT(handleSectionMoved(int, int, int))); #if QT_VERSION < 0x050000 setMovable(true); #else setSectionsMovable(true); #endif }
EditableHeaderView::EditableHeaderView (Qt::Orientation orientation, QWidget * parent) : QHeaderView(orientation, parent) , m_lineEdit(0) , m_idx(0) { setSectionsMovable(true); setSectionsClickable(true); m_lineEdit = new QLineEdit(viewport()); m_lineEdit->setAlignment(Qt::AlignTop); m_lineEdit->setHidden(1); m_lineEdit->blockSignals(1); connect(this, SIGNAL(sectionDoubleClicked(int)), this, SLOT(onEditHeader(int))); connect(m_lineEdit, SIGNAL(editingFinished()), this, SLOT(onEditingFinished())); }
TupExposureHeader::TupExposureHeader(QWidget * parent) : QHeaderView(Qt::Horizontal, parent), m_editedSection(-1), m_sectionOnMotion(false) { setSectionsClickable(true); setSectionsMovable(true); TCONFIG->beginGroup("General"); themeName = TCONFIG->value("Theme", "Light").toString(); connect(this, SIGNAL(sectionDoubleClicked(int)), this, SLOT(showTitleEditor(int))); m_editor = new QLineEdit(this); m_editor->setFocusPolicy(Qt::ClickFocus); m_editor->setInputMask(""); connect(m_editor, SIGNAL(editingFinished()), this, SLOT(hideTitleEditor())); m_editor->hide(); }
FilterHorizontalHeaderView::FilterHorizontalHeaderView(SortMultiFilterProxyModel *model, QTableView *parent): QHeaderView(Qt::Horizontal,parent) { //setModel(parent->model()); _model=model; setSectionsMovable(parent->horizontalHeader()->sectionsMovable()); setSectionsClickable(parent->horizontalHeader()->sectionsClickable()); insertColumns(0,model->columnCount()-1); updateWidgetPositions(); contextMenu.addAction(&saveAct); contextMenu.addAction(&clearAct); contextMenu.addSeparator(); connect(&saveAct,&QAction::triggered,this,&FilterHorizontalHeaderView::savePreset); connect(&clearAct,&QAction::triggered,this,&FilterHorizontalHeaderView::clearAllFilters); connect(parent->horizontalScrollBar(),SIGNAL(valueChanged(int)), this,SLOT(updateWidgetPositions()) ); connect(this,SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)), this,SLOT(setSortIndicator(int,Qt::SortOrder))); connect(this,SIGNAL(sectionResized(int,int,int)), this,SLOT(updateWidgetPositions())); connect(model,&QAbstractItemModel::columnsInserted, [=](const QModelIndex&, int logicalFirst, int logicalLast) { insertColumns(logicalFirst,logicalLast); }); timer.setInterval(300); timer.setSingleShot(true); connect(&timer,SIGNAL(timeout()),this,SLOT(applyFilters())); //TODO: add header data update //TODO: add sections removal }