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 7745663
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T10:04:40+00:00 2026-06-01T10:04:40+00:00

In my application, I have list view. Selecting another item in it, triggers an

  • 0

In my application, I have list view. Selecting another item in it, triggers an event:

connect(listView->selectionModel(), SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(item_changed(const QModelIndex &, const QModelIndex &)));

void MainWindow::item_changed(const QModelIndex & current, const QModelIndex & previous)
{
    qDebug() << "\n" << "item_changed(), caller: " << sender()->objectName();
    if (current.isValid())
    {
        /*
          not so important code
        */

        change_query(tokens.join("+"));
    }
}

This calls another slot – change_query().

void MainWindow::change_query(QString newquery)
{
    qDebug() << "change_query(), caller: " << sender()->objectName();

    QUrl query (newquery);

    frame->load(query);

    connect(frame, SIGNAL(loadFinished(bool)), this, SLOT(loading_finished()));
}

And finally, when page is fully loaded, it should call loading_finished()

void MainWindow::loading_finished()
{
    qDebug() << "loading_finished(), caller: " << sender()->objectName();
}

But, to my surprise, the output is:

item_changed(), caller:  "SelectionModel" 
change_query(), caller:  "SelectionModel"
loading_finished(), caller:  "frame" 

item_changed(), caller:  "SelectionModel" 
change_query(), caller:  "SelectionModel" 
loading_finished(), caller:  "frame" 
loading_finished(), caller:  "frame" 

item_changed(), caller:  "SelectionModel" 
change_query(), caller:  "SelectionModel" 
loading_finished(), caller:  "frame" 
loading_finished(), caller:  "frame" 
loading_finished(), caller:  "frame" 

item_changed(), caller:  "SelectionModel" 
change_query(), caller:  "SelectionModel" 
loading_finished(), caller:  "frame" 
loading_finished(), caller:  "frame" 
loading_finished(), caller:  "frame" 
loading_finished(), caller:  "frame" 

As you can see, each time i change selection, another instance (?) of WebFrame is created and loaded, or page is loaded +1 time each loop. I spent last 2 hours finding out where the problem is and I don’t see anything.

  • 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-01T10:04:41+00:00Added an answer on June 1, 2026 at 10:04 am

    You should connect signals to slots only once, possible in constructor.

    Oppositely, you call

    connect(frame, SIGNAL(loadFinished(bool)), this, SLOT(loading_finished()));
    

    evety time you change item. So, your slots gets called so many times, as you called connect.

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

Sidebar

Related Questions

In my application, I have a listview whose list item consists of a TextView
In a WPF application I have a ListView: <ListView Name=ItemSelList ItemsSource={Binding ItemColl} SelectionChanged=ItemSelList_SelectionChanged> <ListView.View>
I have a ListView item in my application. The scroll position does not get
In my Android application, I have a simple list view with adapter. There's a
In my WPF application (XAML posted below), I have a List View and below
In my ASP.NET MVC application I have a view that displays a list of
I have an Android application with a ListView in it, the ListView will setup
I am creating an application that will have a list of items that can
Imagine the typical type of application where you have a list of items with
I have a List in the main application and I am trying to access

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.