Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QAbstractItemView::setItemDelegate() is giving me an empty combobox!

QAbstractItemView::setItemDelegate() is giving me an empty combobox!

Scheduled Pinned Locked Moved Solved General and Desktop
sql
2 Posts 1 Posters 174 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.
  • J Offline
    J Offline
    jdent
    wrote on 6 Mar 2024, 23:32 last edited by
    #1

    According to documentation:

    "To use the class, simply call QAbstractItemView::setItemDelegate() on the view with an instance of QSqlRelationalDelegate"

    and I used it like so:

    QTableView* connectView(QSqlRelationalTableModel* model, QTableView* view, const QString& title = "")
    {
    view->setModel(model);
    view->setWindowTitle(title);
    view->setItemDelegate(new QSqlRelationalDelegate(view));
    return view;
    }

    but the combobox for the foreign keys appear empty!!empty combobox.png

    J 1 Reply Last reply 7 Mar 2024, 07:32
    0
    • J jdent
      6 Mar 2024, 23:32

      According to documentation:

      "To use the class, simply call QAbstractItemView::setItemDelegate() on the view with an instance of QSqlRelationalDelegate"

      and I used it like so:

      QTableView* connectView(QSqlRelationalTableModel* model, QTableView* view, const QString& title = "")
      {
      view->setModel(model);
      view->setWindowTitle(title);
      view->setItemDelegate(new QSqlRelationalDelegate(view));
      return view;
      }

      but the combobox for the foreign keys appear empty!!empty combobox.png

      J Offline
      J Offline
      jdent
      wrote on 7 Mar 2024, 07:32 last edited by
      #2

      @jdent The column names contained spaces!! Problem solved!!

      1 Reply Last reply
      1
      • J jdent has marked this topic as solved on 7 Mar 2024, 07:32

      2/2

      7 Mar 2024, 07:32

      • Login

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