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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:59:52+00:00 2026-06-11T19:59:52+00:00

I have a QLineEdit , 2 QPush buttons (Add & Remove Buttons) and a

  • 0

I have a QLineEdit, 2 QPush buttons (Add & Remove Buttons) and a QListView. The Text which i am entering in the QLineEdit will gets added in the QListView when the add button is clicked. And if I’m selecting any one of the Item from the QListView and click the Remove Button the selected item will be removed. I finished these things and it works fine. Now i want to add a another QListView and if am Double clicking the QListView Items (QListView 1) the items should be transfered (items in the QListView 1 should be removed completely) to the new QListView (QListView 2) and vice versa. plz help me with your suggestions. Thanks in Advance.

  • 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-11T19:59:53+00:00Added an answer on June 11, 2026 at 7:59 pm

    Example.h

    class Example : public QWidget
    {
        Q_OBJECT
    
    public:
        explicit Example(QWidget *parent = 0);
        ~Example();
    
    private slots:
         void on_listView_doubleClicked(const QModelIndex &index);
         void on_listView_2_doubleClicked(const QModelIndex &index);
    
    private:
        QStandardItemModel *model;  // This model is used when the add button is clicked.
        QStandardItemModel *listViewModel;
    };  
    

    Example.cpp

    void Example::on_listView_doubleClicked(const QModelIndex &index)
    {  
        QStandardItem *Item1;
        Items1 = new QStandardItem();
    
        Items1->setData(ui->listView->currentIndex().data(), Qt::DisplayRole );
        Items1->setEditable( false );
    
        listViewModel->appendRow( Items1 );
        listViewModel->sort( 0, Qt::AscendingOrder );
        ui->listView_2->setModel( listViewModel );
    
        model->removeRow( ui->listView->currentIndex().row() );
    }
    
    void Example::on_listView_2_doubleClicked(const QModelIndex &index)
    {
        QStandardItem *Items2;
        Items2 = new QStandardItem();
        Items2->setData( ui->listView_2->currentIndex().data(), Qt::DisplayRole );
        Items2->setEditable( false);
    
        model->appendRow( Items2 );
        model->sort( 0,Qt::AscendingOrder );
    
        ui->listView->setModel( model );
        model->removeRow( ui->listView_2->currentIndex().row() );
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a QLineEdit widget in my menubar which shows the text search by
I have 3 QLineEdits (say Name, Address & Phone No.), a QPushButton (Add button)
First I'll show the code. class XLineEdit(QtGui.QLineEdit): '''QLineEdit with clear button, which appears when
On a dialog I have a QLineEdit and a button. I want to enable
I have a QLineEdit, on which I have set a QRegExpValidator, that allows the
I have set property to QLineEdit as self.ui.txtName.setProperty('rules', 'required') I want to remove this
I have a QLineEdit which I use to get a double. But is there
I have two widgets, one arbitrary (usually a QLineEdit), and one QLabel which displays
I'm trying to get a pyside button to copy text from a qlineEdit field
I have a QStackedWidget which holds several pages full of various QLineEdit and QComboBox

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.