Hello, all;
I’d appreciate some assistance in being able to extract text from a QTableWidgetItem. I’ve tried using the .text() command, but I have problems getting the text and passing it along no matter how I declare the object that I use to hold it. The object I seem to be having problems with is “displayText†below: I’ve tried declaring it as a pointer and a non-pointer, and the only way I can get this code to compile is by writing it this way (right now I’m using dummy text to try to get the program to work):
listWidget->setItem(0, 0, newItem1);
listWidget->hide();
displayText = (*newItem1).text();
textDisplay->setStyleSheet(swQuad2_stylesheet);
textDisplay->setText(displayText);
textDisplay->setReadOnly(true);
SWLayout->addStretch(1);
SWLayout->addWidget(textDisplay);
SWLayout->addStretch(1);
QTableWidget *listWidget = new QTableWidget(2,2,this);
QTableWidgetItem *newItem1 = new QTableWidgetItem(tr("Display Text 1"));
listWidget->setItem(0, 0, newItem1);
listWidget->hide();
QString displayText;
displayText = (*newItem1).text();
QLineEdit *textDisplay = new QLineEdit();
textDisplay->setStyleSheet(swQuad2_stylesheet);
textDisplay->setText(displayText);
textDisplay->setReadOnly(true);
QVBoxLayout *SWLayout = new QVBoxLayout;
SWLayout->addStretch(1);
SWLayout->addWidget(textDisplay);
SWLayout->addStretch(1);
To copy to clipboard, switch view to plain text mode
However, even though the code does compile, I get the following errors when I run it:
Could not parse application stylesheet
Segmentation fault
Any suggestions? Thanks in advance.
Bookmarks