I've created a custom dialog for varoius mathematical tests. The user can select a number of cells with the mouse which appears a linedit in the format Ax:Zx where x is a number. Or they can type in the aforementioned format. On pressing a calc button I wish to not close the dialog but calculate the answer in my spreadsheet class. I'm getting a
Scope for 1272:
Symbol strpos is a variable with complex or multiple locations (DWARF2), length 4.
Symbol list is a variable with complex or multiple locations (DWARF2), length 4.
Symbol prefix is a variable with complex or multiple locations (DWARF2), length 4.
Symbol this is a variable with complex or multiple locations (DWARF2), length 4.
Scope for 1272:
Symbol strpos is a variable with complex or multiple locations (DWARF2), length 4.
Symbol list is a variable with complex or multiple locations (DWARF2), length 4.
Symbol prefix is a variable with complex or multiple locations (DWARF2), length 4.
Symbol this is a variable with complex or multiple locations (DWARF2), length 4.
To copy to clipboard, switch view to plain text mode
Here's my code. I also tried passing by reference commented out below but this crashes at the setCurrentCell without the DWARF2. The problem is I don't know what DWARF means although I assume its some kind of memory allocation error. Can anyone tell me where I'm going wrong? Much thanks.
mydialog.h
class MyTestDialog
: public QDialog,
public Ui
::MyTestDialog{
Q_OBJECT
public:
MyTestDialog
( QWidget * parent
= 0, Qt
::WFlags f
= 0 );
private slots:
void onCalc1();
void on_lineEdit_textChanged();
private :
};
class MyTestDialog : public QDialog, public Ui::MyTestDialog
{
Q_OBJECT
public:
MyTestDialog( QWidget * parent = 0, Qt::WFlags f = 0 );
private slots:
void onCalc1();
void on_lineEdit_textChanged();
private :
};
To copy to clipboard, switch view to plain text mode
and its cpp file
#include "spreadsheet.h"
// start of dialog's constructor
Spreadsheet *spreadsheet; // to access spreadsheet class
MyTestDialog
::MyTestDialog( QWidget * parent, Qt
::WFlags f
) {
setupUi(this);
QRegExp regExp
("[A-Za-z][1-9][0-9]{0,3}:[A-Za-z][1-9][0-9]{0,3}");
// works up to z9999 if you want more increase the 3
// signals slots to close or calculate dialog
connect(calcButton, SIGNAL(clicked()), this, SLOT(onCalc1()));
connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
}
// end of dialog's constructor
void MyTestDialog::on_lineEdit_textChanged()
{
calcButton->setEnabled(lineEdit->hasAcceptableInput());
}
void MyTestDialog::onCalc1()
{
//QString strpos = lineEdit->text();//.toUpper(); // put what is in linedit in string
// QStringList list1 = strpos.split(":", QString::SkipEmptyParts); // split parts before colon and remove colon put in list
spreadsheet->tests(); // pass list into test function
//spreadsheet->tests(list1); // pass list into test function
}
#include "spreadsheet.h"
// start of dialog's constructor
Spreadsheet *spreadsheet; // to access spreadsheet class
MyTestDialog::MyTestDialog( QWidget * parent, Qt::WFlags f)
: QDialog(parent, f)
{
setupUi(this);
QRegExp regExp("[A-Za-z][1-9][0-9]{0,3}:[A-Za-z][1-9][0-9]{0,3}"); // works up to z9999 if you want more increase the 3
lineEdit->setValidator(new QRegExpValidator(regExp, this));
// signals slots to close or calculate dialog
connect(calcButton, SIGNAL(clicked()), this, SLOT(onCalc1()));
connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
}
// end of dialog's constructor
void MyTestDialog::on_lineEdit_textChanged()
{
calcButton->setEnabled(lineEdit->hasAcceptableInput());
}
void MyTestDialog::onCalc1()
{
//QString strpos = lineEdit->text();//.toUpper(); // put what is in linedit in string
// QStringList list1 = strpos.split(":", QString::SkipEmptyParts); // split parts before colon and remove colon put in list
spreadsheet->tests(); // pass list into test function
//spreadsheet->tests(list1); // pass list into test function
}
To copy to clipboard, switch view to plain text mode
and the source in the spreadsheet class
void Spreadsheet::testDialog() // calls testdialog
{
// code for selectedCellRange goes here left out for reasons of space it works
if (!MyTestDialog) // check if dialog is loaded
MyTestDialog = new MyTestDialog(this); // if not create new instance
MyTestDialog->show(); // show as non-modal
MyTestDialog->raise();
MyTestDialog->activateWindow();
MyTestDialog->lineEdit->setText(selectedCellRange); // dumps current selected cell range as text in linedit
}
//void Spreadsheet::tests(const QStringList &list)
void Spreadsheet::tests()
{
QString strpos
= MyTestDialog
->lineEdit
->text
();
//.toUpper(); // line 1272 put what is in linedit in string
prefix=list[0];
setCurrentCell(prefix.mid(1).toInt() - 1,
prefix[0].unicode() - 'A');
}
void Spreadsheet::testDialog() // calls testdialog
{
// code for selectedCellRange goes here left out for reasons of space it works
if (!MyTestDialog) // check if dialog is loaded
MyTestDialog = new MyTestDialog(this); // if not create new instance
MyTestDialog->show(); // show as non-modal
MyTestDialog->raise();
MyTestDialog->activateWindow();
MyTestDialog->lineEdit->setText(selectedCellRange); // dumps current selected cell range as text in linedit
}
//void Spreadsheet::tests(const QStringList &list)
void Spreadsheet::tests()
{
QString strpos = MyTestDialog->lineEdit->text();//.toUpper(); // line 1272 put what is in linedit in string
QStringList list = strpos.split(":", QString::SkipEmptyParts);
QString prefix;
prefix=list[0];
setCurrentCell(prefix.mid(1).toInt() - 1,
prefix[0].unicode() - 'A');
}
To copy to clipboard, switch view to plain text mode
Bookmarks