Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Ok, you can add a layout and <code>QWidget</code>s to a <code>QGraphicsView</code> so that they overlay the view underneath. You can't do this with QtDesigner (and I'm assuming QtCreator as well), so you'll have to do it in code. You can put the following code in the constructor of your window containing the <code>QGraphicsView</code> (named view) and it will add two buttons to a layout that will keep them anchored at the bottom right of the view:</p> <pre><code>QGridLayout *gridLayout; QSpacerItem *horizontalSpacer; QSpacerItem *verticalSpacer; QPushButton *button1; QPushButton *button2; gridLayout = new QGridLayout(view); horizontalSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum); verticalSpacer = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding); button1 = new QPushButton(view); button1-&gt;setText("Button1"); button2 = new QPushButton(view); button2-&gt;setText("Button2"); gridLayout-&gt;addWidget(button1, 1, 1, 1, 1); gridLayout-&gt;addWidget(button2, 1, 2, 1, 1); gridLayout-&gt;addItem(horizontalSpacer, 1, 0, 1, 1); gridLayout-&gt;addItem(verticalSpacer, 0, 2, 1, 1); </code></pre> <p>It shouldn't be too much trouble to add two more buttons and two more spacers to achieve a button in each corner of the window.</p> <p>Making standard <code>QWidget</code> controls transparent can be a bit tricky, especially buttons. Labels are easy though. You can refer to my <a href="https://stackoverflow.com/questions/3953382/qt-how-to-animate-the-transparency-of-a-child-qpushbutton-using-qpropertyanimati/3955121#3955121">answer to another question here</a> for some hints for making transparent <code>QPushButtons</code>.</p>
    singulars
    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