PDA

View Full Version : how to dreate dialog with variable message



Petr_Kropotkin
18th January 2010, 18:43
I am trying to create a popup message that accepts a string
Can someone show me some code to do it ?

The code is based on this:



#include "gotocelldialog.h"

GoToCellDialog::GoToCellDialog(QWidget *parent)
: QDialog(parent)
{
setupUi(this);

QRegExp regExp("[A-Za-z][1-9][0-9]{0,2}");
lineEdit->setValidator(new QRegExpValidator(regExp, this));

connect(okButton, SIGNAL(clicked()), this, SLOT(accept()));
connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
}

void GoToCellDialog::on_lline_textedit()
{
QMessageBox msgBox;

//* When ok button is clicked messagebox pops up stating your key is "key"//
msgBox.exec();



}
which comes from Qt Gui prgramming version 1

BrainB0ne
19th January 2010, 10:23
If I understand you correctly.. you need something like this.. :)


QString text = QInputDialog::getText(this, tr("QInputDialog::getText()"),
tr("Input:"), QLineEdit::Normal,
QDir::home().dirName(), &ok);

It comes from a Qt Example: standard dialogs.. see here: http://doc.trolltech.com/4.6/dialogs-standarddialogs-dialog-cpp.html

at the function: void Dialog::setText()
maybe it can help you further :)

if I misunderstand your question, maybe another part of the code at the mentioned example can help you out..