stringquery.cpp 605 B

12345678910111213141516171819202122232425262728293031
  1. /*
  2. * wpa_gui - StringQuery class
  3. * Copyright (c) 2009, Atheros Communications
  4. *
  5. * This software may be distributed under the terms of the BSD license.
  6. * See README for more details.
  7. */
  8. #include <cstdio>
  9. #include <QLabel>
  10. #include "stringquery.h"
  11. StringQuery::StringQuery(QString label)
  12. {
  13. edit = new QLineEdit;
  14. edit->setFocus();
  15. QGridLayout *layout = new QGridLayout;
  16. layout->addWidget(new QLabel(label), 0, 0);
  17. layout->addWidget(edit, 0, 1);
  18. setLayout(layout);
  19. connect(edit, SIGNAL(returnPressed()), this, SLOT(accept()));
  20. }
  21. QString StringQuery::get_string()
  22. {
  23. return edit->text();
  24. }