Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. i am saving the scan details of patient in tool box. but even if there is no scan image also other details like time and scan mode are saving in tool box. how to avoid it
Forum Update on Monday, May 27th 2025

i am saving the scan details of patient in tool box. but even if there is no scan image also other details like time and scan mode are saving in tool box. how to avoid it

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 111 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    V Swetha Reddy
    wrote on last edited by Chris Kawa
    #1
    QDate dt;
    QString columns;
    
    QString _PatientList_ImageDirPath;
    QString MRNforReport;
    QString Date;
    ImageCaptureWindow *image;
    
    int TotalPatients;
    
    QString MRNoForIC;
    QString PatientNameIC;
    
    //bool MCC_Parameters_Flag = false;
    PatientListWindow::PatientListWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::PatientListWindow)
    {
    	PRINTFUNCTIONNAME
    		ui->setupUi(this);
    	ui->tableWidget->verticalHeader()->setVisible(false);
    
    	ui->tableWidget->horizontalHeader()->setStyleSheet("QHeaderView { font-size: 12pt; }");
    
    	ui->tableWidget->horizontalHeader()->setStretchLastSection(true);
    
    	//For Registration bind
    	int noofdays = 0;
    	model = new QSqlTableModel(this, db);
    	model->setTable("ApplicationSettings");
    	model->select();
    	qDebug() << "RowCount" << model->rowCount();
    	if (model->rowCount() != 0)
    	{
    		noofdays = model->record(0).value("NoofPatientDisplayInDays").toInt();
    		columns = model->record(0).value("PatientFieldSettings").toString();
    	}
    	dt = QDate::currentDate().addDays(-noofdays);
    	QSqlQueryModel *modl = new QSqlQueryModel();
    	if (ui->chkAllFields->isChecked() == true)
    	{
    		modl->setQuery("SELECT * FROM Registration WHERE RegDate >=\'" + dt.toString("yyyy-MM-dd") + "' order by Id Desc;");
    	}
    	else
    	{
    		if (columns == "")
    		{
    			modl->setQuery("SELECT * FROM Registration WHERE RegDate >=\'" + dt.toString("yyyy-MM-dd") + "' order by Id Desc;");
    		}
    		else
    		{
    			modl->setQuery("SELECT id," + columns + " FROM Registration WHERE RegDate >=\'" + dt.toString("yyyy-MM-dd") + "' order by Id Desc;");
    		}
    	}
    	RegistrationListBind(modl);
    	style();
    	LoadApplicationSettings();
    
    	ui->btnCancel->setObjectName("command");
    	ui->btnEditRegistration->setObjectName("command");
    	qDebug() << "bef load ";
    	LoadStyleIcon();
    	qDebug() << "aft load ";
    	//image = new ImageCaptureWindow();
    }
    
    
    bool PatientListWindow::CheckNotExist(QString s, QStringList lst)
    {
    	PRINTFUNCTIONNAME
    		bool flag = true;
    	for (int i = 0; i < lst.count(); i++)
    	{
    		if (lst[i] == s)
    		{
    			flag = false;
    			break;
    		}
    	}
    	return flag;
    }
    
    
    void PatientListWindow::LoadThumbnail(QString MRNo)
    {
    	PRINTFUNCTIONNAME
    
    		QSqlQueryModel *modl = new QSqlQueryModel();
    	QString query = "SELECT ExamDateTime,Eye,Technician,SignalStrength,'MACULA HD' as ScanMode,fundusImage,OCTImage FROM MaculaHD where MRNo = '" + MRNo + "' UNION ALL";
    	query = query + " SELECT ExamDateTime,Eye,Technician,SignalStrength,'MACULA RADIAL' as ScanMode,fundusImage,OCTImage FROM MaculaRadial where MRNo = '" + MRNo + "' UNION ALL";
    	query = query + " SELECT ExamDateTime,Eye,Technician,SignalStrength,'MACULA CUBE' as ScanMode,fundusImage,OCTImage FROM MaculaCube where MRNo = '" + MRNo + "' UNION ALL";
    	query = query + " SELECT ExamDateTime,Eye,Technician,SignalStrength,'GLAUCOMA DISC' as ScanMode,fundusImage,OCTImage FROM GlaucomaDisk where MRNo = '" + MRNo + "' UNION ALL";
    	query = query + " SELECT ExamDateTime,Eye,Technician,SignalStrength,'GLAUCOMA MACULA' as ScanMode,fundusImage,OCTImage FROM GlaucomaMacula where MRNo = '" + MRNo + "' UNION ALL";
    	query = query + " SELECT ExamDateTime,Eye,Technician,SignalStrength,'ANTERIOR HD' as ScanMode,fundusImage,OCTImage FROM AnteriorHD where MRNo = '" + MRNo + "' UNION ALL";
    	query = query + " SELECT ExamDateTime,Eye,Technician,SignalStrength,'ANTERIOR RADIAL' as ScanMode,IrisImage,OCTImage FROM AnteriorRadial where MRNo = '" + MRNo + "'  Order by ExamDateTime desc";
    
    	modl->setQuery(query);
    
    	// remove exist items
    	for (int i = ui->toolBox->count() - 1; i >= 0; i--)
    	{
    		ui->toolBox->removeItem(i);
    		//qDebug() << "RemoveItem=" <<ui->toolBox->removeItem(i);
    		qDebug() << "remove item ="<<i;
    	}
    
    	QStringList lst;
    	lst.clear();
    	for (int i = 0; i < modl->rowCount(); i++){
    		//qDebug() << "rowcount=" << modl->rowcount();
    
    		if (!lst.contains(modl->record(i).value("ExamDateTime").toDate().toString("yyyy-MM-dd")))
    		{
    			lst << modl->record(i).value("ExamDateTime").toDate().toString("yyyy-MM-dd");
    		}
    	}
    
    	//By Date wise
    	for (int i = 0; i < lst.count(); i++)
    	{
    		// Add pages
    		QWidget *wid = new QWidget();
    		ui->toolBox->addItem(wid, lst[i]);
    		ui->toolBox->visibleRegion();
    		QVBoxLayout *v = new QVBoxLayout();
    		v->setObjectName("QVBL");
    		v->setSpacing(0);
    		v->setMargin(0);
    
    		for (int j = 0; j < modl->rowCount(); j++)
    		{
    			if (lst[i] == modl->record(j).value("ExamDateTime").toDate().toString("yyyy-MM-dd"))
    			{
    				ThumnailListWidget *w = new ThumnailListWidget();
    				w->setObjectName("TH");
    				w->LoadThumbData(modl->record(j).value("ExamDateTime").toDateTime().toString("yyyy-MM-dd HH:mm:ss"), modl->record(j).value("Eye").toString(), modl->record(j).value("ScanMode").toString(), modl->record(j).value("SignalStrength").toInt(), modl->record(j).value("FundusImage").toString(), modl->record(j).value("OCTImage").toString(), MRNo);
    				v->addWidget(w);
    				connect(w, SIGNAL(raiseevent(QString, QString, QString)), SLOT(receivedevent(QString, QString, QString))); //comment  by karthik *****
    
    				wid->setLayout(v);
    			}
    		}
    		v->addStretch();
    	}
    
    }
    
    static void setToolBoxButtonColor(QToolBox* toolBox, int index, QColor color)
    {
    	int i = 0;
    	foreach(QAbstractButton* button, toolBox->findChildren<QAbstractButton*>())
    	{
    		// make sure only toolbox button palettes are modifieds
    		if (button->metaObject()->className() == QString("QToolBoxButton"))
    		{
    			if (i == index)
    			{
    				// found correct button
    				QPalette p = button->palette();
    				p.setColor(QPalette::Button, color);
    				button->setPalette(p);
    				break;
    			}
    			i++;
    		}
    	}
    }
    
    void PatientListWindow::GetThumbnailWidgetCheckedCount(QString srcexamdate)
    {
    
    	//int selectCount = 0;
    	for (int i = 0; i < ui->toolBox->count(); i++)
    	{
    		if (ui->toolBox->itemText(i) == srcexamdate)
    		{
    			QWidget *wid = ui->toolBox->widget(i);
    			QVBoxLayout *v = wid->findChild<QVBoxLayout *>("QVBL");
    
    			//to check checked count
    			for (int j = 0; j < v->count() - 1; j++) // to omite last parent widget
    			{
    				ThumnailListWidget *w = qobject_cast<ThumnailListWidget *>(v->itemAt(j)->widget());
    				QCheckBox *chk = w->findChild<QCheckBox *>("chkwidget");
    
    				if (chk->isChecked())
    				{
    					//selectCount++;
    					setToolBoxButtonColor(ui->toolBox, i, QColor(100, 195, 125));
    					break;
    				}
    				else
    				{
    					setToolBoxButtonColor(ui->toolBox, i, Qt::transparent);
    				}
    			}
    		}		
    
    	}	
    }
    
    
    void PatientListWindow::receivedevent(QString ExamDateTime, QString ScanMode, QString mrno)
    {
    	PRINTFUNCTIONNAME
    
    		QDateTime dt = QDateTime::fromString(ExamDateTime, "yyyy-MM-dd HH:mm:ss");  
    
    	qDebug() << "*********************************" << dt.toString("yyyy-MM-dd");
    
    		GetThumbnailWidgetCheckedCount(dt.toString("yyyy-MM-dd"));
    }
    
    1 Reply Last reply
    0
    • JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by JKSH
      #2

      Hi @V-Swetha-Reddy, and welcome!

      even if there is no scan image also other details like time and scan mode are saving in tool box. how to avoid it

      Answer: Write code to check if there is a scan image. If there is no image, don't call the functions that save the details.

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      1 Reply Last reply
      5

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved