×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Regular Contributor
    Join Date
    Oct 2008
    Posts
    323

    Question Qlistwidget with QSql

    Dear all,

    any one knows how to compare the listwidget data with DB table.

  2. #2
    Regular Contributor
    Join Date
    Oct 2008
    Posts
    323

    Question Re: Qlistwidget with checkbox Compare Sql table

    Dear All,

    Any one have idea about how to compare the listwidget data with sql table

    if any one needs clear i will put my same code

  3. #3
    Nokia Developer Moderator
    Join Date
    Oct 2009
    Posts
    4,326

    Re: Qlistwidget with QSql

    This question is too general and depends on what kind of data you have in the widget and in the database.

  4. #4
    Regular Contributor
    Join Date
    Oct 2008
    Posts
    323

    Question Re: Qlistwidget with QSql

    Dear All


    how to change the value in the DB table value once we
    change the check box event in list widget


    i have some list of data in listwidget.
    chance second check box enable & three checkbox Disable

    after i am calling this below function ?

    Code:
    void FC::Config()
    {
    messageBox = new QMessageBox(this);	
    if (QMessageBox::Ok == messageBox->question(this, "QDelete", "Config update?",
    	QMessageBox::Ok | QMessageBox::Cancel))
    	{
    	TInt NCounts = ui.listWidget->count();
    	TBuf<100> CCounts;
    	CCounts.AppendNum(NCounts);
    	int i;									
    	int j =1;
    	
    	
    	for(i=0; i<NCounts; i++)
    		{
    		
    	if(ui.listWidget->item(i)->checkState() == Qt::Checked)
    		{
    			bool ret;
    			QSqlQuery query;
    			
    			ret = query.prepare(QString("UPDATE Table SET Enable = :Enable, Disable = :Disable where id = %1").arg(j));
    			if(ret)
    				{
    					//query.bindValue(":Enable", );
                                             //query.bindValue(":Disable", );
                                              
    					ret = query.exec();
    					
    				}
    		}
    	else
    		{
    			QSqlQuery query;
    			bool ret;
    			ret = query.prepare(QString("UPDATE Table SET Enable = :Enable, Disable = :Disable where id = %1").arg(j));
    			if(ret)
    				{
    					
    					//query.bindValue(":Enable", );
    					//query.bindValue(":Disable", );
    					ret = query.exec();
    					
    				}
    			}
      j++;
    }
    }
    }
    Last edited by damodharan; 2010-05-28 at 17:09.

  5. #5
    Regular Contributor
    Join Date
    Oct 2008
    Posts
    323

    Re: Qlistwidget with QSql

    Dear all,

    any one have idea about how to compare listwidet rows with table rows?

  6. #6
    Regular Contributor
    Join Date
    Oct 2008
    Posts
    323

    Thumbs up Re: Qlistwidget with QSql

    Thx to all

    problem sloved

Similar Threads

  1. QListWidget : avoid click before selecting
    By henk_marsman in forum Qt
    Replies: 16
    Last Post: 2011-03-29, 16:03
  2. Replies: 1
    Last Post: 2010-05-20, 11:37

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •