stringquery.cpp 824 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * wpa_gui - StringQuery class
  3. * Copyright (c) 2009, Atheros Communications
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2 as
  7. * published by the Free Software Foundation.
  8. *
  9. * Alternatively, this software may be distributed under the terms of BSD
  10. * license.
  11. *
  12. * See README and COPYING for more details.
  13. */
  14. #include <cstdio>
  15. #include <QLabel>
  16. #include "stringquery.h"
  17. StringQuery::StringQuery(QString label)
  18. {
  19. edit = new QLineEdit;
  20. edit->setFocus();
  21. QGridLayout *layout = new QGridLayout;
  22. layout->addWidget(new QLabel(label), 0, 0);
  23. layout->addWidget(edit, 0, 1);
  24. setLayout(layout);
  25. connect(edit, SIGNAL(returnPressed()), this, SLOT(accept()));
  26. }
  27. QString StringQuery::get_string()
  28. {
  29. return edit->text();
  30. }