This class is somewhat a replacement for QInputDialog where a line of text shall be edited or entered by the user. More...
#include <bpsdialog.h>
Public Member Functions | |
| BpsTextInputDialog (QWidget *aParent, const QString &aTitle, const QString &aLabel) | |
| void | setText (const QString &aText) |
| Set the text to be edited. | |
| QString | text () const |
This class is somewhat a replacement for QInputDialog where a line of text shall be edited or entered by the user.
In contrast to QInputDialog, this one has a default window modality instead of application modality, and it has buttons for alpha and numeric virtual keyboards.
Example: Edit tab name dialog
void AWorkspaceWidget::renameCurrentTab() { BpsTextInputDialog dlg(this, tr("Rename tab"), tr("New tab name:")); BpsSettings s; s.open(bps->userStatusPath()+bStr("/Workplace/TabEdit"); QPoint pos = s.value("position").toPoint(); if (!pos.isNull()) dlg.move(pos); dlg.setKeyboardStatus(s.value("keyboard").toInt()); dlg.setText(tabText(currentIndex())); if (dlg.exec() == QDialog::Accepted && !dlg.text().isEmpty()) setTabText(currentIndex(), dlg.text()); s.setValue("position", dlg.pos()); s.setValue("keyboard", dlg.keyboardStatus()); } // renameCurrentTab
| BpsTextInputDialog::BpsTextInputDialog | ( | QWidget * | aParent, |
| const QString & | aTitle, | ||
| const QString & | aLabel | ||
| ) |
| [in] | aParent | The parent widget. |
| [in] | aTitle | The window title. |
| [in] | aLabel | The label text to show above the line input. |
| void BpsTextInputDialog::setText | ( | const QString & | aText | ) |
Set the text to be edited.
Typically you would set the text before calling exec or show.
| [in] | aText | The text to set. |
| QString BpsTextInputDialog::text | ( | ) | const |