|
|
Hi there
I have a QListWidget containing a number of "sites". When doubleclick on
one of those a want this site to be added to a new QListWidget and
deleted from the original list. This way I can create a list to run a
application on.
I receive a signal in a slot with a QListWidgetItem and add this item to
a new QListWidget, but how can I get the gui application updated with
the new content of the QListWidget?
Have a look at the code below.
And how can I remove an entry from a QListWidget?
All hints are appreciated.
Regards
------------------------------
corner_calc::corner_calc(QWidget *parent_s) : QWidget(parent_s){
parent = parent_s;
grid = new QGridLayout;
QLabel *text1 = new QLabel(tr("Text"));
grid->addWidget(text1,0,0,1,1);
listWidget = new QListWidget(this);
new QListWidgetItem(tr("1"), listWidget);
new QListWidgetItem(tr("2"), listWidget);
new QListWidgetItem(tr("3"), listWidget);
new QListWidgetItem(tr("4"), listWidget);
new QListWidgetItem(tr("5"), listWidget);
grid->addWidget(listWidget,1,0,1,1);
QLabel *text2 = new QLabel(tr("text2"));
grid->addWidget(text2,0,1,1,1);
newlistWidget = new QListWidget(this);
grid->addWidget(newlistWidget,1,1,1,1);
connect(listWidget,SIGNAL(itemDoubleClicked(QListWidgetItem*)),
this,SLOT(add_new_item(QListWidgetItem*)));
setLayout(grid);
setWindowTitle(tr("Group Boxes"));
resize(480, 320);
};
void corner_calc::add_new_item(QListWidgetItem *item){
newlistWidget->addItem(item);
/* this cout works fine but the display of the newlistWidget does not
get updated*/
std::cout << item->text().toStdString() << std::endl;
return;
}
--
To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
"unsubscribe" in the subject or the body.
List archive and information: http://lists.trolltech.com/qt-interest/
|
|