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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:24:50+00:00 2026-05-23T22:24:50+00:00

In my application, I have QTableWidget displaying multiple rows, a line edit to enter

  • 0

In my application, I have QTableWidget displaying multiple rows, a line edit to enter a string and a push button.

The requirement says, upon clicking on the push button, the same QTableWidget should show only rows which contain the string entered into the line edit.

I thought of using a QSortFilterProxyModel, but QTableWidget has setModel(...) method private, so I am unable to use QSortFilterProxyModel in this case.

  • 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-05-23T22:24:51+00:00Added an answer on May 23, 2026 at 10:24 pm

    Using a sort/filter proxy is probably overkill for this anyway.

    It’s a matter of iterating through all of your QTableWidgetItem objects, determining if their text matches the filter and calling QTableView::setRowHidden() as needed.

    For example:

    QString filter = textEdit->text();
    for( int i = 0; i < table->rowCount(); ++i )
    {
        bool match = false;
        for( int j = 0; j < table->columnCount(); ++j )
        {
            QTableWidgetItem *item = table->item( i, j );
            if( item->text().contains(filter) )
            {
                match = true;
                break;
            }
        }
        table->setRowHidden( i, !match );
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have application that is connecting to the DB and if I enter incorrect
I have strange issue. My application have multiple activitys, on one activity is setting
My Application have 5 activities(A1,A2,A3,A4,A5). Each activity have one text view and one button(B1,B2,B3,B4,B5).
My web application have a download button and when the client click it, it
I see an application have used Log.info = some info where are these logs
In my console application have an abstract Factory class Listener which contains code for
I have one question; In my ASP.NET MVC web application have to do certain
I have an game application I have written for Windows Mobile and I want
I have application which needs to use a dll (also written by me) which
I have application that makes different queries with different results so the caching in

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.