title: Change rectangular Qt button to round
body: <p>I'm trying to create a round button in Qt.  A simple form with a single button <code>QPushButton</code> was created in designer.  I'm attempting to turn this into a round button using <code>setMask()</code>.  As soon as <code>setMask()</code> is applied the button disappeares.  Does a custom widget need to be created to make a round button?</p>
  
  <pre><code>#include "mainwindow.h"
  #include "ui_mainwindow.h"
  #include &lt;QMessageBox&gt;
  #include &lt;QtGui/QPushButton&gt;
  
  
  MainWindow::MainWindow(QWidget *parent) :
      QMainWindow(parent),
      ui(new Ui::MainWindow)
  {
      ui-&gt;setupUi(this);
  
      ui-&gt;pushButton-&gt;setText("Test Text");
      ui-&gt;pushButton-&gt;setFixedHeight(200);
      ui-&gt;pushButton-&gt;setFixedWidth(200);
  
      //Set Starting point of region 5 pixels inside , make region width &amp; height
      //values same and less than button size so that we obtain a pure-round shape
  
      QRegion* region = new QRegion(*(new QRect(ui-&gt;pushButton-&gt;x()+5,ui-&gt;pushButton-&gt;y()+5,190,190)),QRegion::Ellipse);
      ui-&gt;pushButton-&gt;setMask(*region);
      ui-&gt;pushButton-&gt;show();
  
  
  }
  
  MainWindow::~MainWindow()
  {
      delete ui;
  }
  
  void MainWindow::on_pushButton_clicked()
  {
      QMessageBox msgbox;
      msgbox.setText("Text was set");
      msgbox.show();
  
  }
  </code></pre>
  
  <p>Note:  If the button is created in code and applied to a window before the window is displayed, the button is displayed.  I would like to use the WYSIWIG capabilities of the Qt Designer rather than creating the entire form in code.</p>