Runtime error raised up from QComboBox



  • Hi Folks,

    I have a little issue tracking system. To get a new ticket, the user shall to press a QPushButton, that triggers the following method:
    @
    if(!_ui->_LETitle->text().isEmpty()) {
    _card->setValue(_currentState + "/" + _ui->_LETitle->text(), '(' + _ui->_TECardText->toPlainText() + ')');
    }
    _ui->_CBState->clear();
    _ui->_CBState->addItems(_session->getCardStates());
    _ui->_CBCards->clear();
    _card->beginGroup(_currentState);
    _ui->_CBCards->addItems(QStringList("") + _card->allKeys());
    _card->endGroup();
    _ui->_LETitle->clear();
    _ui->_TECardText->clear();
    _currentState = _ui->_CBState->currentText();
    }
    @

    when the execution reachs the
    @
    _ui->_CBState->clear();
    @

    line, Microsoft Visual C++ Runtime Library error raise up. On the command line of the application the following message appers:
    ASSERT failure in QSettings: "empty key", file io\qsettings.cpp, line 325
    Invalid parameter passed to C runtime function.
    Invalid parameter passed to C runtime function.

    Can anybody help me?

    Regards,
    Norbert


  • Lifetime Qt Champion

    Hi,

    The error is not from QComboBox but from QSettings, are you sure _currentState contains something valid ?



  • Hi,

    yes, the _currentState member contains a valid string. During this time, I have considered that the combobox doesn't display any string, because in one of the use cases, I fill up it by the following way:
    @
    _ui->_CBCards->addItems(QStringList("") + _card->allKeys());
    @
    as you can see, I add an empty QStringList and the keys from the ini file (the _card member is a QSettings object).
    Could it cause this kind of error or does it have any matter?

    Regards,
    Norbert


  • Lifetime Qt Champion

    Can you show what your QSettings should contain ?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.