Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8391001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T19:08:39+00:00 2026-06-09T19:08:39+00:00

I have the following code: model = new QStandardItemModel(); channel = new QTableView(this); channel->setModel(model);

  • 0

I have the following code:

model = new QStandardItemModel();
channel = new QTableView(this);
channel->setModel(model);

model->setData(model->index(d,0,QModelIndex()), 0 );
model->setData(model->index(d,1,QModelIndex()),Channel);
model->setData(model->index(d,2,QModelIndex()),Unit);
model->setData(model->index(d,3,QModelIndex()),dimension);
model->setData(model->index(d,4,QModelIndex()),code);
model->setData(model->index(d,5,QModelIndex()),description);

I want you to just click on a box, return the row number where the selected field.

any idea how to do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T19:08:41+00:00Added an answer on June 9, 2026 at 7:08 pm

    What you are referring to is called SIGNALS and SLOTS. QObjects emit various signals that you can connect to functions that perform actions. In your case you are probably interested in the clicked signal of the QTableView (Actually provided by the super class QAbstractItemView)

    connect(channel, SIGNAL(clicked(QModelIndex), 
               this, SLOT(handleTableClick()));
    

    handleTableClick can really be named anything you want and would be a public SLOT you have defined to handle this signal:

    public slots:
        void handleTableClick(const QModelIndex &);
    

    When a user clicks on a valid cell, your slot will be called and you will be passed the QModelIndex. From there you can look up the row.

    void Foo::handleTableClick(const QModelIndex &idx) {
        int row = idx.row();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following code function Model(onChanged) { this.array = new Array(); this.onChanged = onChanged;
I have the following code: Url.Action(Index, Home, new {param1 = Model.Param1, param2 = Model.Param2}
I have the following code public ActionResult Index() { ViewData.Model = new Model(); return
I have the following code in a view: <div class=wrap_select> @Html.DropDownList(dateRange, new SelectList(Model.DateRange, Value,Text),
I have the following code - var options = new Ext.data.JsonStore({ model: 'options_model', data:
Okay, I have the following code: QFileSystemModel *model = new QFileSystemModel; model->setRootPath(QDir::currentPath()); model->setFilter(QDir::Files |
So I have the following code: @model Project.Models.ViewModels.SomeViewModel @using (Html.BeginForm(SomeAction, SomeController, new { id
I have following code @using (Html.BeginForm()) { @Html.DropDownListFor(m => m.IDs, new SelectList(Model. IDs), Model.SelectedID)
I have the following code: @{ var index=0; } @foreach (AdminSummary adminSummary in @Model.AdminSummaries)
I have the following code: private Models.mediamanagerEntities dataModel = new Models.mediamanagerEntities(); public ActionResult Index(FormCollection

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.