title: QT Making a Dropdown Menu Widget Programmatically
body: <p>I am using QT 5.5 with Mac OSX. I want to make several dropdown menu widgets programmatically that will have various options that can change the values of certain variables. </p>
  
  <p>So for example, I would have dropdown menu 1 represent variable "command" have:
  - Q
  - W
  - E
  - R
  And by selecting whichever one, then it would make command = Q, or command = W. So that way, I can send command to another program knowing that I sent Q, or W. </p>
  
  <p>My current mainwindow looks something like this:</p>
  
  <pre><code>MainWindow::MainWindow(QWidget *parent) :
      QMainWindow(parent),
      ui(new Ui::MainWindow)
  {
  //******* Set up
  ui-&gt;setupUi(this);
  ui-&gt;centralWidget-&gt;setLayout(new QVBoxLayout);
  
  // 01: Creation of Console
  console = new Console;
  console-&gt;setEnabled(false);
  
  /************** Adding Widgets *********************/
  //creation and attribution of slider
  slider = new QSlider();
  slider-&gt;resize(255, 20);
  slider-&gt;setOrientation(Qt::Horizontal);
  slider-&gt;setRange(0, 255); //0-255 is range we can read
  
  //creation and attribution of the lcd
  lcd = new QLCDNumber();
  lcd-&gt;setSegmentStyle(QLCDNumber::Flat);
  lcd-&gt;resize(255, 50);
  
  //03: Adding widgets to layout
  //add console as a widget to the main widget
  //layout with slider and lcd underneath console
  ui-&gt;centralWidget-&gt;layout()-&gt;addWidget(console);
  ui-&gt;centralWidget-&gt;layout()-&gt;addWidget(slider);
  ui-&gt;centralWidget-&gt;layout()-&gt;addWidget(lcd);
  
  ////////I WANT TO ADD VARIOUS DROPDOWN MENUS HERE NEXT TO EACH OTHER//////// 
  
  /************** Connection Events ***********************/
  ....
  </code></pre>
  
  <p>}</p>