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. Combobox entries in QTableView on a QWizardPage

Combobox entries in QTableView on a QWizardPage

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 256 Views 1 Watching
  • 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.
  • K Offline
    K Offline
    kemizio
    wrote on last edited by
    #1

    Hi all,
    I have the following page in my wizard, which goes something like this

    Wizard.h
    ----------------------------------------------------------------
    #ifndef WIZARD_H
    #define WIZARD_H
    #include <QWizard>
    ..... //other headers
    QT_BEGIN_NAMESPACE
    class QTableView;
    class QItemDelegate; //not sure if this should be QComboBox, ComboBoxDelegate
    ....... // bunch of other things
    QT_END_NAMESPACE
    // Define the wizard class
    class Wizard : public QWizard
    {
    Q_OBJECT

    public:
    Wizard(QWidget *parent = 0);
    
    void accept() override;
    };
    
    class AWizardPage : public QWizardPage {
    Q_OBJECT
    public:
        AWizardPage(QWidget *parent =0);
    
    private:
        QTableView *sometableview;
        QAbstractItemModel *data_parameters;
        QItemDelegate *comboboxdelegate //again not sure if needs changing
    };
    .....
     #endif
    

    Wizard.cpp
    ----------------------------------------------------------------

     #include "wizard.h"
    Wizard::Wizard(QWidget *parent)
    : QWizard(parent)
    {
        addPage(new AWizardPage);
       .... //format options 
    }
    
    AWizardPage::AWizardPage(QWidget *parent) : QWizardPage(parent)
    {
        sometableview = new QTableView(this);
       data_parameters = new QAbstractItemModel(this);
    
        sometableview->setModel(data_parameters);
    }
    

    The problem to solve is as follows:
    Build a table model where with an add row delete row button, as well as force the cells in the ith column to be a combobox (or similar) for the user to select.

    Any ideas on how I could implement this? Many thanks!

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Where would the original data of your model come from or would it be completely empty ? How many rows are you expecting to create ?

      As for the add/delete row, you can use two QPushButton one with a + and one with a - to start simple.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      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