Ahh. The link you posted is very good.
Despite glancing over it, as well as playing around with my code, I do not see how to get around this programatically. Do you have any suggestions? Reading my initial post, and the modification I made below (lines 25 and 26):
void AcquisitionBrowserWidget
::DICOM_Tree_Changed(QTreeWidgetItem * item,
int column
) {
if(Target_File_Path!="" || Acquisition_Browser->Read_Only_Checkbox->checkState()==Qt::Unchecked)
{
Acquisition_Browser
->Update_Header_Button
->setIcon
(QIcon("blueball.png"));
DICOM_Tree_Data_Changed = true;
DICOM_Tree_Data_Updated = false;
}
else
{
Acquisition_Browser
->Update_Header_Button
->setIcon
(QIcon("greenball.png"));
DICOM_Tree_Data_Changed = false;
DICOM_Tree_Data_Updated = false;
}
if(item==DICOM_Information__Patient_Information__Name)
{
QString Patient_Name
= item
->text
(1);
//Acquisition_Browser->Transfer_Message->setText(item->text(1));
if(Patient_Name_Valid(Patient_Name))
{
Current_Flag_Database_Update(PATIENT_NAME_FIELD_INVALID,false);
Acquisition_Browser->Transfer_Message->setText("Patient name is \nVALID.");
Model->setData(*Current_Model_Index,Qt::blue,Qt::TextColorRole);
//DICOM_Information__Patient_Information__Name->setTextColor(1,Qt::black);
}
else
{
Current_Flag_Database_Update(PATIENT_NAME_FIELD_INVALID,true);
Acquisition_Browser->Transfer_Message->setText("Patient name is \nINVALID.");
//Current_Model_Index->setData(Current_Model_Index,Qt::blue,Qt::TextColorRole);
//item->setTextColor(0,Qt::red);
}
emit Flags_Updated();
}
}
void AcquisitionBrowserWidget::DICOM_Tree_Changed(QTreeWidgetItem * item, int column )
{
if(Target_File_Path!="" || Acquisition_Browser->Read_Only_Checkbox->checkState()==Qt::Unchecked)
{
Acquisition_Browser->Update_Header_Button->setIcon(QIcon("blueball.png"));
DICOM_Tree_Data_Changed = true;
DICOM_Tree_Data_Updated = false;
}
else
{
Acquisition_Browser->Update_Header_Button->setIcon(QIcon("greenball.png"));
DICOM_Tree_Data_Changed = false;
DICOM_Tree_Data_Updated = false;
}
if(item==DICOM_Information__Patient_Information__Name)
{
QString Patient_Name = item->text(1);
//Acquisition_Browser->Transfer_Message->setText(item->text(1));
if(Patient_Name_Valid(Patient_Name))
{
Current_Flag_Database_Update(PATIENT_NAME_FIELD_INVALID,false);
Acquisition_Browser->Transfer_Message->setText("Patient name is \nVALID.");
const QAbstractItemModel *Model = Current_Model_Index->model();
Model->setData(*Current_Model_Index,Qt::blue,Qt::TextColorRole);
//DICOM_Information__Patient_Information__Name->setTextColor(1,Qt::black);
}
else
{
Current_Flag_Database_Update(PATIENT_NAME_FIELD_INVALID,true);
Acquisition_Browser->Transfer_Message->setText("Patient name is \nINVALID.");
//Current_Model_Index->setData(Current_Model_Index,Qt::blue,Qt::TextColorRole);
//item->setTextColor(0,Qt::red);
}
emit Flags_Updated();
}
}
To copy to clipboard, switch view to plain text mode
I need to call setData to change the color.
The error I get is the same as before.
Bookmarks