Trolltech Home | Qt4-preview-feedback Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt4-preview-feedback Archive, April 2007
Using Qt::MatchFlags


Message 1 in thread

Hi,
maybe I did not understand the underlaying model at all, but I have some 
problems using the matching flags. I wanted to design a search dialog with 
the different flags as checkboxes. Whenever I check "ends with", "contains" 
and "startsWith" are selected too. So, are these values bit positions or flag 
positions? 

set the boxes:
	void TDlgSearch::setData(const QString& str, const Qt::MatchFlags& flags)
	{
		checkCase->setChecked(flags.testFlag(Qt::MatchCaseSensitive));
		checkContains->setChecked(flags.testFlag(Qt::MatchContains));
		checkStarts->setChecked(flags.testFlag(Qt::MatchStartsWith));
	}
read the boxes:
	void TDlgSearch::getData(QString& str, Qt::MatchFlags& flags)
	{
		if( checkCase->isChecked() ) flags |= Qt::MatchCaseSensitive;
		if( checkContains->isChecked() ) flags |= Qt::MatchContains;
		if( checkStarts->isChecked() ) flags |= Qt::MatchStartsWith;
	}

Anything wrong here?

To unsubscribe - send "unsubscribe" in the subject to qt4-preview-feedback-request@xxxxxxxxxxxxx