* \brief Remove 'count' rows starting from row 'first' */
| 1857 | * \brief Remove 'count' rows starting from row 'first' |
| 1858 | */ |
| 1859 | void ColumnPrivate::removeRows(int first, int count) { |
| 1860 | if (count == 0) |
| 1861 | return; |
| 1862 | |
| 1863 | m_formulas.removeRows(first, count); |
| 1864 | |
| 1865 | if (first < rowCount()) { |
| 1866 | int corrected_count = count; |
| 1867 | if (first + count > rowCount()) |
| 1868 | corrected_count = rowCount() - first; |
| 1869 | |
| 1870 | if (!m_data) { |
| 1871 | m_rowCount -= corrected_count; |
| 1872 | return; |
| 1873 | } |
| 1874 | |
| 1875 | switch (m_columnMode) { |
| 1876 | case AbstractColumn::ColumnMode::Double: |
| 1877 | static_cast<QVector<double>*>(m_data)->remove(first, corrected_count); |
| 1878 | break; |
| 1879 | case AbstractColumn::ColumnMode::Integer: |
| 1880 | static_cast<QVector<int>*>(m_data)->remove(first, corrected_count); |
| 1881 | break; |
| 1882 | case AbstractColumn::ColumnMode::BigInt: |
| 1883 | static_cast<QVector<qint64>*>(m_data)->remove(first, corrected_count); |
| 1884 | break; |
| 1885 | case AbstractColumn::ColumnMode::DateTime: |
| 1886 | case AbstractColumn::ColumnMode::Month: |
| 1887 | case AbstractColumn::ColumnMode::Day: |
| 1888 | for (int i = 0; i < corrected_count; ++i) |
| 1889 | static_cast<QVector<QDateTime>*>(m_data)->removeAt(first); |
| 1890 | break; |
| 1891 | case AbstractColumn::ColumnMode::Text: |
| 1892 | for (int i = 0; i < corrected_count; ++i) |
| 1893 | static_cast<QVector<QString>*>(m_data)->removeAt(first); |
| 1894 | break; |
| 1895 | } |
| 1896 | } |
| 1897 | |
| 1898 | invalidate(); |
| 1899 | } |
| 1900 | |
| 1901 | int ColumnPrivate::indexForValue(double x, bool smaller) const { |
| 1902 | return indexForValueCommon<Column>(q, |