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. Signal to connect qtableview with combobox
QtWS25 Last Chance

Signal to connect qtableview with combobox

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 817 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.
  • PabloArgP Offline
    PabloArgP Offline
    PabloArg
    wrote on last edited by
    #1

    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
    0
    • PabloArgP Offline
      PabloArgP Offline
      PabloArg
      wrote on last edited by
      #2

      Probably need more explanation.

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

      1 Reply Last reply
      0
      • PabloArgP Offline
        PabloArgP Offline
        PabloArg
        wrote on last edited by
        #3

        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
        0
        • 猫 Offline
          猫 Offline
          猫大
          wrote on last edited by
          #4

          Editing with a combobox ? try QStyledItemDelegate.

          1 Reply Last reply
          0
          • VRoninV Offline
            VRoninV Offline
            VRonin
            wrote on last edited by VRonin
            #5

            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
            0

            • Login

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