Note that there are some explanatory texts on larger screens.

plurals
  1. POQScrollArea not respecting contentMargins setting
    primarykey
    data
    text
    <p><a href="http://doc.qt.nokia.com/stable/qscrollarea.html" rel="nofollow">QScrollArea</a>, for some reason, is ignoring the <code>contentMargins</code> setting when I set <a href="http://doc.qt.nokia.com/stable/qgraphicsview.html" rel="nofollow">QGraphicsView</a> as its widget. Looking at the snippet below, can someone please tell if I'm doing something wrong or it could be a bug in the SDK?</p> <p>Snippet 1 (works perfect):</p> <pre><code>QWidget *appWindow = new QWidget; QScrollArea *sa = new QScrollArea(appWindow); sa-&gt;setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn); sa-&gt;setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); sa-&gt;setContentMargins(50, 50, 50, 50); QWidget *widgetToScroll = new QWidget(sa); widgetToScroll-&gt;resize(5000, 5000); sa-&gt;setWidget(widgetToScroll); QVBoxLayout *appWindowLayout = new QVBoxLayout(appWindow); appWindowLayout-&gt;addWidget(sa); appWindow-&gt;setLayout(appWindowLayout); appWindow-&gt;show(); </code></pre> <p>Snippet 2 (It's like <a href="http://doc.qt.nokia.com/stable/qwidget.html#setContentsMargins" rel="nofollow">setContentMargins()</a> call is ignored completely):</p> <pre><code>QWidget *appWindow = new QWidget; QScrollArea *sa = new QScrollArea(appWindow); sa-&gt;setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn); sa-&gt;setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); sa-&gt;setContentMargins(50, 50, 50, 50); QGraphicsView *widgetToScroll = new QGraphicsView(new QGraphicsScene(sa), sa); widgetToScroll-&gt;setAlignment(Qt::AlignLeft | Qt::AlignTop); widgetToScroll-&gt;resize(5000, 5000); sa-&gt;setWidget(widgetToScroll); QVBoxLayout *appWindowLayout = new QVBoxLayout(appWindow); appWindowLayout-&gt;addWidget(sa); appWindow-&gt;setLayout(appWindowLayout); appWindow-&gt;show(); </code></pre> <p>Thanks.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload