Hey ouekah,
Good news! I believe i have found a hack for solving this.
I just had an idea and tried it out on my Mac. What I did was the following:
1. added a private slot in my header
private slots:
void buttonWasPushed();
void updateGroupBoxTitle();
private slots:
void buttonWasPushed();
void updateGroupBoxTitle();
To copy to clipboard, switch view to plain text mode
2. In the already defined add function I do not call directly groupBox->setTitle(), but instead I use the QTimer:singleShot() static function:
void Form::add(const QString& item)
{
ui->listWidget->addItem(item);
QTimer::singleShot(0,
this,
SLOT(updateGroupBoxTitle
()));
}
void Form::add(const QString& item)
{
ui->listWidget->addItem(item);
QTimer::singleShot(0, this, SLOT(updateGroupBoxTitle()));
}
To copy to clipboard, switch view to plain text mode
.
Then, in the implementation of the updateGroupBoxTitle() slot i just set the title of the groupbox:
void Form::updateGroupBoxTitle()
{
ui
->groupBox
->setTitle
("Currently (" + QString::number(ui
->listWidget
->count
()) + ")");
// updates QGroupBox title}
void Form::updateGroupBoxTitle()
{
ui->groupBox->setTitle("Currently (" + QString::number(ui->listWidget->count()) + ")"); // updates QGroupBox title
}
To copy to clipboard, switch view to plain text mode
This works for me. I hope it will be functional for you also.
If it does work, do not ask me why
.
Waiting for your feedback...
Wladek
Bookmarks