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

  • Home
  • SEARCH
  • 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 8547027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:10:27+00:00 2026-06-11T13:10:27+00:00

In my main window ( QMainWindow ) I have a QTableView (named commandsTableView ).

  • 0

In my main window (QMainWindow) I have a QTableView (named commandsTableView). Now I want to react on its selection changes.

I made a slot and connected it manually to ui.commandsTableView->selectionModel(). All works fine.

But then I thought: why not use auto-connection (especially that there will be more connections to be done)? At least it will add more force to consistent naming rules.

Yet I wasn’t able to find proper name syntax. I tried:

  • on_commandsTableView_selectionModel_selectionChanged,
  • on_commandsTableViewSelectionModel_selectionChanged,
  • on_commandsTableView_selectionChanged,
  • on_commandsTableView___selectionChanged

but neither worked. In all cases there is there is a message on output when running the app (with corresponding slot name, here only first given as an example):

QMetaObject::connectSlotsByName: No matching signal for on_commandsTableView_selectionModel_selectionChanged(QItemSelection,QItemSelection)

(Why there are no assertions in response for connection errors – that I cannot understand. I lost much time wondering what is wrong before I spotted those – and alike – messages on output.)

The object returned by ui.commandsTableView->selectionModel() has an empty name. But setting it to selectionModel prior to making a call to connectSlotsByName doesn’t help either.

  • 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-11T13:10:28+00:00Added an answer on June 11, 2026 at 1:10 pm

    According to the documentation connectSlotsByName() only supports signatures like


    void on_<object name>_<signal name>(<signal parameters>);

    According to the sources that’s the only form it checks (watch how it collects a list of children, then matches parent’s method names against names of the children).

    Hence, to be able to use auto-connection you would have needed a named selection model, which would continue existing from the call to connectSlotsByName() onwards. Each time you change the selection model (not likely) or the model (likely) you’d have to name the selection model and auto-connect again. But alas connectSlotsByName() will duplicate all other connections as it doesn’t seem to check if connections are unique, so we have to connect signals to such dynamic children as models, scenes etc manually.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have main window from type QMainWindow , then I set some widget and
I have the most basic of Qt programs - a main window. I want
In my main window named (MainWindow by mistake) I have a method for getting
I have a QMainWindow, and want to handle the clicked signal from a smaller
this is a simple OOP QT question. my app consists of main window (QMainWindow)
I want to display some QTextEdits over my main window at arbitrary locations. Below
I have a Qt application that uses a QMainWindow -derived class for the main
I have a side-window that is opened when clicking a button on the main
I have MainWindow with a button, under the button click event I want MainWindow
I have the following dependency property in my MainWindow class (inherits from WPF's Window)

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.