示例#1
0
  UserNameBox::UserNameBox(Device* d, QWidget* parent)
    : QWidget(parent) {
    d_ = d;
    input_line_ = new UserNameInputBox(d, this);
    button_box_ = new QDialogButtonBox(QDialogButtonBox::Ok
                                       | QDialogButtonBox::Cancel);

    connect(button_box_, SIGNAL(accepted()),
            input_line_, SLOT(userInput()));
    connect(button_box_, SIGNAL(rejected()),
            parent, SLOT(close()));
    connect(input_line_, SIGNAL(done()),
            parent, SLOT(close()));
    connect(input_line_, SIGNAL(done()),
            this, SLOT(createColorBox()));

    QLabel* screen_name_label = new QLabel(this);
    screen_name_label->setText(tr("Your name:"));

    QVBoxLayout* main_layout = new QVBoxLayout;
    main_layout->addWidget(screen_name_label);
    main_layout->addWidget(input_line_);
    main_layout->addWidget(button_box_);
    main_layout->setSizeConstraint(QLayout::SetFixedSize);

    setLayout(main_layout);

    input_line_->setFocus(Qt::PopupFocusReason);
  }
void UnknownObject::create()
{
  clearObject();

  createUnknownBox();

  control_.name = "box_control";
  if( use_material_ )
  {
      createBox();
      control_.markers.push_back(box_);
  }
  else
  {
      createColorBox();
      control_.markers.push_back(box_);
      control_.markers.push_back(wire_);
  }
  control_.interaction_mode = InteractiveMarkerControl::MENU;
  control_.always_visible = true;
  object_.controls.push_back(control_);

  createMenu();
}