Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Unsolved Signal to connect qtableview with combobox

    General and Desktop
    3
    5
    570
    Loading More Posts
    • 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.
    • PabloArg
      PabloArg last edited by

      Hi,

      I want to connect my qtableview made with QStandardItemModel with a combobox. Which Signal from Qtableview or Model need to use?

      Many Thanks

      1 Reply Last reply Reply Quote 0
      • PabloArg
        PabloArg last edited by

        Probably need more explanation.

        I want this, everytime that somebody click on a cell reproduce that value in the combobox

        1 Reply Last reply Reply Quote 0
        • PabloArg
          PabloArg last edited by

          Finally I do something like this:

          connect(ui->myTableView,SIGNAL(clicked(QModelIndex)),this,SLOT(DoSomething(QModelIndex)));

          This is not what I wanted, but it is an intermediate solution.

          Because if for example I have two buttons (up and down) that are move the current position on the table, that definition of connect does not work. I will have to create another connect.

          It would be easier something like this:

          connect (model, SIGNAL (currentindex), this, DoSomething (currentindex))

          1 Reply Last reply Reply Quote 0
          • 猫
            猫大 last edited by

            Editing with a combobox ? try QStyledItemDelegate.

            1 Reply Last reply Reply Quote 0
            • VRonin
              VRonin last edited by VRonin

              connect(ui->myTableView->selectionModel(),&QItemSelectionModel::currentChanged,[this](const QModelIndex& idx){if(idx.isValid()) ui->comboBox->setCurrentIndex(idx.row());});

              "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
              ~Napoleon Bonaparte

              On a crusade to banish setIndexWidget() from the holy land of Qt

              1 Reply Last reply Reply Quote 0
              • First post
                Last post