void StretchHeaderView::UpdateWidths(const QList<int>& sections) { if (!stretch_enabled_) return; ColumnWidthType total_w = 0.0; for (int i=0 ; i<column_widths_.count() ; ++i) { const ColumnWidthType w = column_widths_[i]; int pixels = w * width(); if (pixels != 0 && total_w - int(total_w) > 0.5) pixels ++; total_w += w; if (!sections.isEmpty() && !sections.contains(i)) continue; if (pixels == 0 && !isSectionHidden(i)) hideSection(i); else if (pixels != 0 && isSectionHidden(i)) { showSection(i); AssertMinimalColumnWidth(i); } if (pixels != 0) resizeSection(i, pixels); } }
void ViewHeader::toggleVisibility( int index ) { if ( isSectionHidden( index ) ) showSection( index ); else hideSection( index ); }
void ViewHeader::toggleVisibility( int index ) { qDebug() << Q_FUNC_INFO << index; if ( isSectionHidden( index ) ) showSection( index ); else hideSection( index ); }
int PlayListWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QTreeWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: playListEmpty(); break; case 1: playItem((*reinterpret_cast< PlayListItem*(*)>(_a[1]))); break; case 2: addFile((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; case 3: addFile((*reinterpret_cast< QString(*)>(_a[1]))); break; case 4: addFile((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QMap<QString,QString>(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3]))); break; case 5: addFile((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QMap<QString,QString>(*)>(_a[2]))); break; case 6: { int _r = addDir((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; } break; case 7: { int _r = addDir((*reinterpret_cast< QString(*)>(_a[1]))); if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; } break; case 8: removeSelected(); break; case 9: doubleClicked((*reinterpret_cast< QTreeWidgetItem*(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; case 10: scrollToActive(); break; case 11: deselect((*reinterpret_cast< QTreeWidgetItem*(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; case 12: clearPlayList(); break; case 13: { int _r = loadM3UPlayList((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; } break; case 14: { int _r = loadM3UPlayList((*reinterpret_cast< QString(*)>(_a[1]))); if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; } break; case 15: { int _r = loadPLSPlayList((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; } break; case 16: { int _r = loadPLSPlayList((*reinterpret_cast< QString(*)>(_a[1]))); if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; } break; case 17: saveM3UPlayList((*reinterpret_cast< QString(*)>(_a[1]))); break; case 18: savePLSPlayList((*reinterpret_cast< QString(*)>(_a[1]))); break; case 19: updateColumnWidth((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3]))); break; case 20: updateColumnPosition((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3]))); break; case 21: headerContextMenu((*reinterpret_cast< const QPoint(*)>(_a[1]))); break; case 22: setScroll(); break; case 23: hideSection(); break; case 24: showSection(); break; case 25: printPos((*reinterpret_cast< int(*)>(_a[1]))); break; default: ; } _id -= 26; } return _id; }
void QSpreadsheetHeaderView::mousePressEvent ( QMouseEvent * event ) { QHeaderView::mousePressEvent(event); int logicalIndex = logicalIndexAt(event->pos()); if (buttonMenuRect(logicalIndex).contains(event->pos())) { QMenu menu(this); QAction *hideCol = menu.addAction("Hide column"); QAction *sortAZ = menu.addAction("Sort sheet A->Z"); QAction *sortZA = menu.addAction("Sort sheet Z->A"); // Disable hide column if only one column remains. Otherwise // the gui is no more available to show them back. hideCol->setEnabled(hiddenSectionCount() < count() - 1); QAction *res = menu.exec(mapToGlobal(event->pos())); if (res == hideCol) { hideSection(logicalIndex); updateSection(logicalIndex-1); } if (res == sortAZ) model()->sort(logicalIndex, Qt::AscendingOrder); if (res == sortZA) model()->sort(logicalIndex, Qt::DescendingOrder); } // Catch previous arrow mouse click. if (prevRect(logicalIndex).contains(event->pos())) { showSection(logicalIndex - 1); updateSection(logicalIndex - 2); } // Catch next arrow mouse click. if (nextRect(logicalIndex).contains(event->pos())) { showSection(logicalIndex + 1); updateSection(logicalIndex + 2); } }
void WTrackTableViewHeader::showOrHideColumn(int column) { if (!m_columnActions.contains(column)) { qDebug() << "WTrackTableViewHeader got invalid column" << column; return; } QAction* action = m_columnActions[column]; if (action->isChecked()) { showSection(column); } else { // If the user hides every column then the table will disappear. This // guards against that. NB: hiddenCount reflects checked QAction's so // size-hiddenCount will be zero the moment they uncheck the last // section. if (m_columnActions.size() - hiddenCount() > 0) { hideSection(column); } else { // Otherwise, ignore the request and re-check this QAction. action->setChecked(true); } } }
void StretchHeaderView::HideSection(int logical) { // Would this hide the last section? bool all_hidden = true; for (int i=0 ; i<count() ; ++i) { if (i != logical && !isSectionHidden(i) && sectionSize(i) > 0) { all_hidden = false; break; } } if (all_hidden) { return; } if (!stretch_enabled_) { hideSection(logical); return; } column_widths_[logical] = 0.0; NormaliseWidths(); UpdateWidths(); }