Documents > BPS V2 C++ API
BpsTextInputDialog Class Reference

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>

List of all members.

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

Detailed Description

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
textinputdialog.png

Constructor & Destructor Documentation

BpsTextInputDialog::BpsTextInputDialog ( QWidget *  aParent,
const QString &  aTitle,
const QString &  aLabel 
)
Parameters:
[in]aParentThe parent widget.
[in]aTitleThe window title.
[in]aLabelThe label text to show above the line input.

Member Function Documentation

void BpsTextInputDialog::setText ( const QString &  aText)

Set the text to be edited.

Typically you would set the text before calling exec or show.

Parameters:
[in]aTextThe text to set.
QString BpsTextInputDialog::text ( ) const
Returns:
The current text value. After exec this will be the text edited by the user.

The documentation for this class was generated from the following file: