Don't include scrollbars in client area size
Return the size of just the viewport when using QScrollArea. Closes https://github.com/wxWidgets/wxWidgets/pull/1418
This commit is contained in:
committed by
Vadim Zeitlin
parent
18b87b2ab5
commit
cd7594e639
@@ -230,6 +230,11 @@ private:
|
|||||||
QScrollBar *m_horzScrollBar; // owned by m_qtWindow when allocated
|
QScrollBar *m_horzScrollBar; // owned by m_qtWindow when allocated
|
||||||
QScrollBar *m_vertScrollBar; // owned by m_qtWindow when allocated
|
QScrollBar *m_vertScrollBar; // owned by m_qtWindow when allocated
|
||||||
|
|
||||||
|
// Return the viewport of m_qtContainer, if it's used, or just m_qtWindow.
|
||||||
|
//
|
||||||
|
// Always returns non-null pointer if the window has been already created.
|
||||||
|
QWidget *QtGetClientWidget() const;
|
||||||
|
|
||||||
QScrollBar *QtGetScrollBar( int orientation ) const;
|
QScrollBar *QtGetScrollBar( int orientation ) const;
|
||||||
QScrollBar *QtSetScrollBar( int orientation, QScrollBar *scrollBar=NULL );
|
QScrollBar *QtSetScrollBar( int orientation, QScrollBar *scrollBar=NULL );
|
||||||
|
|
||||||
|
@@ -582,6 +582,23 @@ void wxWindowQt::DoGetTextExtent(const wxString& string, int *x, int *y, int *de
|
|||||||
*externalLeading = fontMetrics.lineSpacing();
|
*externalLeading = fontMetrics.lineSpacing();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QWidget *wxWindowQt::QtGetClientWidget() const
|
||||||
|
{
|
||||||
|
QWidget *qtWidget = NULL;
|
||||||
|
if ( m_qtContainer != NULL )
|
||||||
|
{
|
||||||
|
qtWidget = m_qtContainer->viewport();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( qtWidget == NULL )
|
||||||
|
{
|
||||||
|
// We don't have scrollbars or the QScrollArea has no children
|
||||||
|
qtWidget = GetHandle();
|
||||||
|
}
|
||||||
|
|
||||||
|
return qtWidget;
|
||||||
|
}
|
||||||
|
|
||||||
/* Returns a scrollbar for the given orientation, or NULL if the scrollbar
|
/* Returns a scrollbar for the given orientation, or NULL if the scrollbar
|
||||||
* has not been previously created and create is false */
|
* has not been previously created and create is false */
|
||||||
QScrollBar *wxWindowQt::QtGetScrollBar( int orientation ) const
|
QScrollBar *wxWindowQt::QtGetScrollBar( int orientation ) const
|
||||||
@@ -957,7 +974,8 @@ void wxWindowQt::DoSetSize(int x, int y, int width, int height, int sizeFlags )
|
|||||||
|
|
||||||
void wxWindowQt::DoGetClientSize(int *width, int *height) const
|
void wxWindowQt::DoGetClientSize(int *width, int *height) const
|
||||||
{
|
{
|
||||||
QRect geometry = GetHandle()->geometry();
|
QWidget *qtWidget = QtGetClientWidget();
|
||||||
|
const QRect geometry = qtWidget->geometry();
|
||||||
if (width) *width = geometry.width();
|
if (width) *width = geometry.width();
|
||||||
if (height) *height = geometry.height();
|
if (height) *height = geometry.height();
|
||||||
}
|
}
|
||||||
@@ -965,7 +983,7 @@ void wxWindowQt::DoGetClientSize(int *width, int *height) const
|
|||||||
|
|
||||||
void wxWindowQt::DoSetClientSize(int width, int height)
|
void wxWindowQt::DoSetClientSize(int width, int height)
|
||||||
{
|
{
|
||||||
QWidget *qtWidget = GetHandle();
|
QWidget *qtWidget = QtGetClientWidget();
|
||||||
QRect geometry = qtWidget->geometry();
|
QRect geometry = qtWidget->geometry();
|
||||||
geometry.setWidth( width );
|
geometry.setWidth( width );
|
||||||
geometry.setHeight( height );
|
geometry.setHeight( height );
|
||||||
|
Reference in New Issue
Block a user