Пример #1
0
void FreezeTableWidget::init()
{
    frozenTableView->setModel(model());
    frozenTableView->setFocusPolicy(Qt::NoFocus);
    frozenTableView->verticalHeader()->hide();
    frozenTableView->horizontalHeader()->setResizeMode(QHeaderView::Fixed);

    viewport()->stackUnder(frozenTableView);

    frozenTableView->setStyleSheet("QTableView { border: none;"
                                   "background-color: #E0E0E0;"
                                   "selection-background-color: #999}"); //for demo purposes
    frozenTableView->setSelectionModel(selectionModel());
    for(int col=1; col<model()->columnCount(); col++)
        frozenTableView->setColumnHidden(col, true);

    frozenTableView->setColumnWidth(0, columnWidth(0) );

    frozenTableView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    frozenTableView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    frozenTableView->show();

    updateFrozenTableGeometry();

    //setHorizontalScrollMode(ScrollPerPixel);
    //setVerticalScrollMode(ScrollPerPixel);
    //frozenTableView->setVerticalScrollMode(ScrollPerPixel);
}
Пример #2
0
void FreezeTableWidget::updateSectionWidth(int logicalIndex, int, int newSize)
{
    if(logicalIndex==0) {
        frozenTableView->setColumnWidth(0,newSize);
        updateFrozenTableGeometry();
    }
}
Пример #3
0
void FreezeTableWidget::init() {
	frozenTableView->setFocusPolicy(Qt::NoFocus);
	frozenTableView->verticalHeader()->hide();
	frozenTableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Fixed);

	viewport()->stackUnder(frozenTableView);

	frozenTableView->setSelectionModel(selectionModel());

	frozenTableView->setColumnWidth(0, columnWidth(0));

	frozenTableView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	frozenTableView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	frozenTableView->show();

	updateFrozenTableGeometry();
	for (int col = 1; col < model()->columnCount(); ++col)
		frozenTableView->setColumnHidden(col, true);	//should hide more when inserted

	setHorizontalScrollMode(ScrollPerPixel);
	setVerticalScrollMode(ScrollPerPixel);
	frozenTableView->setVerticalScrollMode(ScrollPerPixel);

//	frozenTableView->setEditTriggers(QTableView::DoubleClicked|QTableView::AnyKeyPressed);
}
Пример #4
0
void TableView::init()
{
    //m_dataTree->setFocusPolicy(Qt::NoFocus);

    //viewport()->stackUnder(_dataTree);

    //m_dataTree->setSelectionModel(selectionModel());
    //for(int col = 0; col < model()->columnCount(); col++)
    {
       // this->setColumnHidden(col, true);
       // m_dataTree->setColumnWidth(col, this->columnWidth(col) );
    }

    m_dataTree->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    //m_dataTree->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

    //this->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    this->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

    this->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);
    this->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);

    m_dataTree->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);
    m_dataTree->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);

    //this->verticalHeader()->setVerticalScrollMode(QAbstractItemView::ScrollPerItem);

    updateFrozenTableGeometry();
}
Пример #5
0
void QFrozenRowTableWidget::updateSectionHeight(int logicalIndex, int oldSize, int newSize)
{
	Q_UNUSED(oldSize);
	if (logicalIndex < frozenRows){
		  frozenTableWidget->setRowHeight(0, newSize);
		  updateFrozenTableGeometry();
	}
}
Пример #6
0
void TracksView::updateFrozenSectionHeight(int logicalIndex, int /*oldSize*/, int newSize)
      {
      if (logicalIndex < _frozenRowCount) {
            setRowHeight(logicalIndex, newSize);
            _frozenCornerTableView->setRowHeight(logicalIndex, newSize);
            _frozenVTableView->setRowHeight(logicalIndex, newSize);
            updateFrozenTableGeometry();
            }
      }
Пример #7
0
void TracksView::updateFrozenSectionWidth(int logicalIndex, int /*oldSize*/, int newSize)
      {
      if (logicalIndex < _frozenColCount) {
            setColumnWidth(logicalIndex, newSize);
            _frozenCornerTableView->setColumnWidth(logicalIndex, newSize);
            _frozenHTableView->setColumnWidth(logicalIndex, newSize);
            updateFrozenTableGeometry();
            }
      }
Пример #8
0
void QFrozenRowTableWidget::init() {
	frozenTableWidget->setFocusPolicy(Qt::NoFocus);
	frozenTableWidget->horizontalHeader()->hide();
	frozenTableWidget->verticalHeader()->hide();
	frozenTableWidget->verticalHeader()->setResizeMode(QHeaderView::Fixed);

	viewport()->stackUnder(frozenTableWidget);

	frozenTableWidget->setSelectionModel(selectionModel());

	for (int i=0; i<frozenRows; i++)
		frozenTableWidget->setRowHeight(i, rowHeight(i) );

	frozenTableWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	frozenTableWidget->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	frozenTableWidget->show();

	updateFrozenTableGeometry();

	setHorizontalScrollMode(ScrollPerPixel);
	setVerticalScrollMode(ScrollPerPixel);
	frozenTableWidget->setHorizontalScrollMode(ScrollPerPixel);
}
Пример #9
0
void TracksView::setFrozenColCount(int count)
      {
      _frozenColCount = count;
      _delegate->setFrozenColIndex(_frozenColCount - 1);

      if (model()->columnCount() == 0)
            return;

      Q_ASSERT_X(count >= 0 && count < model()->columnCount(),
                 "TracksView::setFrozenColCount", "Invalid frozen column count");

      for (int col = 0; col != count; ++col) {
            _frozenVTableView->setColumnHidden(col, false);
            _frozenVTableView->setColumnWidth(col, columnWidth(col));
            _frozenCornerTableView->setColumnHidden(col, false);
            }

      for (int col = count; col < model()->columnCount(); ++col) {
            _frozenVTableView->setColumnHidden(col, true);
            _frozenCornerTableView->setColumnHidden(col, true);
            }

      updateFrozenTableGeometry();
      }
Пример #10
0
void TracksView::setFrozenRowCount(int count)
      {
      _frozenRowCount = count;
      _delegate->setFrozenRowIndex(_frozenRowCount - 1);

      if (model()->rowCount() == 0)
            return;

      Q_ASSERT_X(count >= 0 && count < model()->rowCount(),
                 "TracksView::setFrozenRowCount", "Invalid frozen row count");

      for (int row = 0; row != count; ++row) {
            _frozenHTableView->setRowHidden(row, false);
            _frozenHTableView->setRowHeight(row, rowHeight(row));
            _frozenCornerTableView->setRowHidden(row, false);
            }

      for (int row = count; row < model()->rowCount(); ++row) {
            _frozenHTableView->setRowHidden(row, true);
            _frozenCornerTableView->setRowHidden(row, true);
            }

      updateFrozenTableGeometry();
      }
Пример #11
0
void QFrozenRowTableWidget::resizeEvent(QResizeEvent * event)
{
      QTableWidget::resizeEvent(event);
      updateFrozenTableGeometry();
 }
Пример #12
0
void TracksView::resizeEvent(QResizeEvent *event)
      {
      QTableView::resizeEvent(event);
      updateFrozenTableGeometry();
      }
Пример #13
0
void FreezeTableWidget::resizeEvent(QResizeEvent * event)
{
    QTableView::resizeEvent(event);
    updateFrozenTableGeometry();
}