예제 #1
0
/**
 * @brief       This method has been reimplemented. It repaints the table when the height changes.
 *
 * @param[in]   event       Resize event
 *
 * @return      Nothing.
 */
void AbstractTableView::resizeEvent(QResizeEvent* event)
{
    if(event->size().height() != event->oldSize().height())
    {
        updateScrollBarRange(getRowCount());
        mShouldReload = true;
    }
    QWidget::resizeEvent(event);
}
void SamplesPreviewWidget::on_pbZoomOut_clicked()
{
    // Compute and set the new minimum and maximum.
    float width = _svCanvas->max() - _svCanvas->min();
    float newMin = std::max<float>(0.0, _svCanvas->min() - width / 4.0 * ZOOM_FACTOR);
    float newMax = std::min<float>(1.0, _svCanvas->max() + width / 4.0 * ZOOM_FACTOR);
    _svCanvas->setMinMax(newMin, newMax);
    // Update the scrollbar.
    updateScrollBarRange();
    // Finally update the widget.
    _svCanvas->update();
}
void SamplesPreviewWidget::on_pbZoomIn_clicked()
{
    // Compute and set the new minimum and maximum.
    float width = _svCanvas->max() - _svCanvas->min();
    float middle = _svCanvas->min() + width / 2.0;
    float newMin = middle - width / (2.0 * ZOOM_FACTOR);
    float newMax = middle + width / (2.0 * ZOOM_FACTOR);
    if (newMin >= newMax)
        return;
    _svCanvas->setMinMax(newMin, newMax);
    // Update the scrollbar.
    updateScrollBarRange();
    // Finally update the widget.
    _svCanvas->update();
}