void NLSimpleGuiWindow::zoomModelPreview( double factor )
{
  TQtWidget *qtWidget = ui->m_modelDisplayWidget;
  QScrollArea *scrollArea = ui->m_modelDisplayScrollArea;
  TCanvas *can = qtWidget->GetCanvas();
  can->SetEditable( kTRUE );
  can->Update(); //need this or else TCanvas won't have updated axis range

  double xmin, xmax, ymin, ymax;
  can->GetRangeAxis( xmin, ymin, xmax, ymax );
  const double nMinutes = xmax - xmin;

  if( nMinutes > 1 )
  {
    int canvasWidth = qtWidget->width();
    int scrollAreaWidth = scrollArea->width();

    int newWidth = factor * canvasWidth;
    newWidth = max(newWidth, scrollAreaWidth);
    newWidth = min(newWidth, 5*scrollAreaWidth);

    if( newWidth == scrollAreaWidth )
       scrollArea->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
    else scrollArea->setHorizontalScrollBarPolicy ( Qt::ScrollBarAsNeeded );

    int h = scrollArea->height() - scrollArea->verticalScrollBar()->height();
    qtWidget->setMinimumSize( newWidth, h );
    qtWidget->setMaximumSize( newWidth, h );
  }//if( nMinutes > 1 )

  can->Update();
  can->SetEditable( kFALSE );
}//void NLSimpleGuiWindow::zoomModelPreview( double factor )