Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. International
  3. Spanish
  4. QDataWidgetMapper with QComboBox editable
Forum Updated to NodeBB v4.3 + New Features

QDataWidgetMapper with QComboBox editable

Scheduled Pinned Locked Moved Solved Spanish
1 Posts 1 Posters 302 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Pedro Santana
    wrote on last edited by
    #1

    Re: no submit data with editable QComboBox

    Amigos sou novo no forum, me perdoem se eu descumprir alguma politica do forum, mas não posso deixar de criar esse tópico, pois atualmente passei por um problema sério ao utilizar QDataWidgetMapper com um QComboBox editable, ao pesquisar uma solução encontrei outras pessoas com o mesmo problema, no entanto nenhuma pessoa explicava a solução, até que de muito insistir consegui resolver o problema, e não vou entrar muito em detalhes mas vou deixar o código que utilizei com a solução que é apenas uma linha:

    if (id != -1) {
            for (int row = 0; row < model->rowCount(); ++row) {
                QSqlRecord record = model->record(row);
                if (record.value(Abastecimento::ID).toInt() == id) {
                    mapper->setCurrentIndex(row);
                    // solução
                    ui->placaComboBox->lineEdit()->editingFinished();
                    break;
                }
            }
        }
    
    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved