title: Get QScrollBar Width upon change in QScrollBar Visibility
body: <p>I'm trying to get the width of a qscrollbar as it changes visibility. I'm doing this because I want to change the width of my qtablewidget by the width of the qscrollbar if it is visible.</p>
  
  <p>I'm using the <code>rangeChanged(int min, int max)</code> signal from my qscrollbar. If <code>max &gt; min</code> then the qscrollbar is visible. My problem is that when I get the qscrollbar width using <code>m_tableWidget-&gt;verticalScrollBar()-&gt;width()</code> the value is not the current width, but rather the previous width before the rangeChanged signal was fired.</p>
  
  <p>This is what my signal-slot connection looks like:</p>
  
  <pre><code>connect(m_tableWidget-&gt;verticalScrollBar(), SIGNAL(rangeChanged(int,int)),
          this, SLOT(verticalScrollBarChanged(int,int)));
  </code></pre>
  
  <p>And this is the slot function:</p>
  
  <pre><code>void ImageTableWidget::verticalScrollBarChanged(int min, int max)
  {
      int verticalScrollBarWidth = 0;
      if (max-min)
          verticalScrollBarWidth = m_tableWidget-&gt;verticalScrollBar()-&gt;width();
  
      int horizontalHeaderWidth = m_tableWidget-&gt;horizontalHeader()-&gt;length();
      m_tableWidget-&gt;setFixedWidth(verticalScrollBarWidth + horizontalHeaderWidth);
  }
  </code></pre>
  
  <p>Does anyone know how I could obtain the new qscrollbar width at the time it becomes visible/invisible?</p>