필터 업데이트

애널저 숫자 정렬 추가

git-svn-id: svn://192.168.0.12/source@280 8346c931-da38-4b9b-9d4c-e48b93cbd075
This commit is contained in:
admin
2016-07-08 08:20:08 +00:00
parent 3a7eb4d829
commit 9d04a7e128
13 changed files with 99 additions and 41 deletions

View File

@@ -4,6 +4,7 @@
#include <QMessageBox> #include <QMessageBox>
#include <QInputDialog> #include <QInputDialog>
#include <QFileDialog> #include <QFileDialog>
#include "stable.h"
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
{ {
@@ -141,7 +142,7 @@ void MainWindow::FileNew()
{ {
for(int j = 0; j < column.size(); j++) for(int j = 0; j < column.size(); j++)
{ {
pTable->setItem(i, j, new QTableWidgetItem(QString(" "))); pTable->setItem(i, j, new STableWidgetItem(QString(" ")));
} }
} }
} }

View File

@@ -251,7 +251,7 @@ void SBatchRun::ViewResult()
for (int k = 0; k < pTable->columnCount() ; k++) for (int k = 0; k < pTable->columnCount() ; k++)
{ {
QString str = m_vecData[i][j][k].replace("\n"," "); QString str = m_vecData[i][j][k].replace("\n"," ");
pTable->setItem(nCount,k,new QTableWidgetItem(" "+str.replace("\t"," ")+" ")); pTable->setItem(nCount,k,new STableWidgetItem(" "+str.replace("\t"," ")+" "));
} }
nCount++; nCount++;
GetMainWindow()->m_progress.setValue(nCount); GetMainWindow()->m_progress.setValue(nCount);
@@ -319,7 +319,7 @@ void SBatchRun::ViewRawResult()
for (int k = 0; k < pTable->columnCount() ; k++) for (int k = 0; k < pTable->columnCount() ; k++)
{ {
QString str = m_vecData[i][j][k].replace("\n"," "); QString str = m_vecData[i][j][k].replace("\n"," ");
pTable->setItem(nCount,k,new QTableWidgetItem(" "+str.replace("\t"," ")+" ")); pTable->setItem(nCount,k,new STableWidgetItem(" "+str.replace("\t"," ")+" "));
} }
nCount++; nCount++;
GetMainWindow()->m_progress.setValue(nCount); GetMainWindow()->m_progress.setValue(nCount);
@@ -503,13 +503,13 @@ bool SBatchRun::loadData()
for(int j = 0; j < GetColumn().data().size(); j++) for(int j = 0; j < GetColumn().data().size(); j++)
//strList << " " + query.value(j).toString() + " "; //strList << " " + query.value(j).toString() + " ";
strList.append(query.value(j).toString()); strList.append(query.value(j).toString());
/*
if(strList[m_anData[E_DATA_platform_form]].trimmed() == "post" || strList[m_anData[E_DATA_platform_form]].trimmed() == "story" || strList[m_anData[E_DATA_platform_form]].trimmed() == "channel") if(strList[m_anData[E_DATA_platform_form]].trimmed() == "post" || strList[m_anData[E_DATA_platform_form]].trimmed() == "story" || strList[m_anData[E_DATA_platform_form]].trimmed() == "channel")
strList[m_anData[E_DATA_platform_form]] = "sns"; strList[m_anData[E_DATA_platform_form]] = "sns";
if(strList[m_anData[E_DATA_platform_form]].trimmed() == "group") if(strList[m_anData[E_DATA_platform_form]].trimmed() == "group")
strList[m_anData[E_DATA_platform_form]] = "community"; strList[m_anData[E_DATA_platform_form]] = "community";
*/
if(i == E_ARTICLE_BODY) if(i == E_ARTICLE_BODY)
{ {

View File

@@ -104,7 +104,7 @@ void SCountDlg::choose_1()
{ {
int nCol = 0; int nCol = 0;
QString str = now.toString("yyyy-MM-dd").trimmed(); QString str = now.toString("yyyy-MM-dd").trimmed();
m_pTable->setItem(nCount,nCol++,new QTableWidgetItem(str)); m_pTable->setItem(nCount,nCol++,new STableWidgetItem(str));
if (mapCount.contains(now)) if (mapCount.contains(now))
m_pTable->setItem(nCount,nCol,new STableNumberItem(QString::number(mapCount[now]))); m_pTable->setItem(nCount,nCol,new STableNumberItem(QString::number(mapCount[now])));
else else
@@ -131,7 +131,7 @@ void SCountDlg::choose_1()
for (QMap<QString,int> ::iterator i = mapCount.begin(); i != mapCount.end(); ++i) for (QMap<QString,int> ::iterator i = mapCount.begin(); i != mapCount.end(); ++i)
{ {
int nCol = 0; int nCol = 0;
m_pTable->setItem(nCount,nCol++,new QTableWidgetItem(i.key())); m_pTable->setItem(nCount,nCol++,new STableWidgetItem(i.key()));
m_pTable->setItem(nCount,nCol++,new STableNumberItem(QString::number(i.value()))); m_pTable->setItem(nCount,nCol++,new STableNumberItem(QString::number(i.value())));
nCount++; nCount++;
} }
@@ -200,7 +200,7 @@ void SCountDlg::choose_2()
{ {
int nCol = 0; int nCol = 0;
QString str = now.toString("yyyy-MM-dd").trimmed(); QString str = now.toString("yyyy-MM-dd").trimmed();
m_pTable->setItem(nCount,nCol++,new QTableWidgetItem(str)); m_pTable->setItem(nCount,nCol++,new STableWidgetItem(str));
if (mapCount.contains(str)) if (mapCount.contains(str))
{ {
for (QSet<QString>::iterator j = setList.begin(); j != setList.end(); ++j) for (QSet<QString>::iterator j = setList.begin(); j != setList.end(); ++j)
@@ -225,7 +225,7 @@ void SCountDlg::choose_2()
for (QMap<QString,QMap<QString,int> >::iterator i = mapCount.begin(); i != mapCount.end(); ++i) for (QMap<QString,QMap<QString,int> >::iterator i = mapCount.begin(); i != mapCount.end(); ++i)
{ {
int nCol = 0; int nCol = 0;
m_pTable->setItem(nCount,nCol++,new QTableWidgetItem(i.key())); m_pTable->setItem(nCount,nCol++,new STableWidgetItem(i.key()));
for (QSet<QString>::iterator j = setList.begin(); j != setList.end(); ++j) for (QSet<QString>::iterator j = setList.begin(); j != setList.end(); ++j)
{ {
if (i->contains(*j)) if (i->contains(*j))

View File

@@ -86,11 +86,13 @@ void SDataDlg::DataReload(QString _strTableName,int _nSelect)
for (int i = 0; i < pTable->columnCount() ; i++) for (int i = 0; i < pTable->columnCount() ; i++)
{ {
QString str = query.value(i).toString().replace("\n"," "); QString str = query.value(i).toString().replace("\n"," ");
/*
if((i == GetColumn().getColumnIndex("platform_form")) && (str.trimmed() == "post" || str.trimmed() == "channel" || str.trimmed() == "story")) if((i == GetColumn().getColumnIndex("platform_form")) && (str.trimmed() == "post" || str.trimmed() == "channel" || str.trimmed() == "story"))
str = "sns"; str = "sns";
if((i == GetColumn().getColumnIndex("platform_form")) && (str.trimmed() == "group")) if((i == GetColumn().getColumnIndex("platform_form")) && (str.trimmed() == "group"))
str = "community"; str = "community";
pTable->setItem(nCount,i,new QTableWidgetItem(" "+str.replace("\t"," ")+" ")); */
pTable->setItem(nCount,i,new STableWidgetItem(" "+str.replace("\t"," ")+" "));
} }
nCount++; nCount++;
GetMainWindow()->m_progress.setValue(nCount); GetMainWindow()->m_progress.setValue(nCount);
@@ -102,7 +104,7 @@ void SDataDlg::InsertCopyRow(int _nRow,QTableWidget *_pCurrent,QTableWidget *_pN
{ {
_pNew->setRowCount(_pNew->rowCount()+1); _pNew->setRowCount(_pNew->rowCount()+1);
for (int nCount = 0;nCount < _pCurrent->columnCount() ;nCount++ ) for (int nCount = 0;nCount < _pCurrent->columnCount() ;nCount++ )
_pNew->setItem(_pNew->rowCount()-1,nCount,new QTableWidgetItem(*_pCurrent->item(_nRow,nCount))); _pNew->setItem(_pNew->rowCount()-1,nCount,new STableWidgetItem(*_pCurrent->item(_nRow,nCount)));
} }
void SDataDlg::SearchDate(QDate _dtStart,QDate _dtEnd) void SDataDlg::SearchDate(QDate _dtStart,QDate _dtEnd)
@@ -327,10 +329,10 @@ void SDataDlg::SearchReplace(int _nCatalogIndex,int _nReplaceFindIndex,int _nRep
strOut = strMiddle; strOut = strMiddle;
break; break;
} }
pNew->setItem(nCount,nColumnCount,new QTableWidgetItem(strOut)); pNew->setItem(nCount,nColumnCount,new STableWidgetItem(strOut));
} }
else else
pNew->setItem(nCount,nColumnCount,new QTableWidgetItem(*pCurrent->item(nCount,nColumnCount))); pNew->setItem(nCount,nColumnCount,new STableWidgetItem(*pCurrent->item(nCount,nColumnCount)));
} }
GetMainWindow()->m_progress.setValue(nCount); GetMainWindow()->m_progress.setValue(nCount);
GetMainWindow()->m_progress.repaint(); GetMainWindow()->m_progress.repaint();
@@ -432,7 +434,7 @@ void SDataDlg::Import(QVector <QByteArray> _vecImport )
if(column.at(j).at(SColumn::E_DATABASE).compare(strings.at(i)) == 0) if(column.at(j).at(SColumn::E_DATABASE).compare(strings.at(i)) == 0)
strings[i] = column.at(j).at(SColumn::E_NAME); strings[i] = column.at(j).at(SColumn::E_NAME);
} }
pNew->setHorizontalHeaderItem(i-1,new QTableWidgetItem(strings.at(i))); pNew->setHorizontalHeaderItem(i-1,new STableWidgetItem(strings.at(i)));
} }
bFirst = false; bFirst = false;
pNew->setRowCount(_vecImport.size()-1); pNew->setRowCount(_vecImport.size()-1);
@@ -446,7 +448,7 @@ void SDataDlg::Import(QVector <QByteArray> _vecImport )
QStringList strings = strLine.split(","); QStringList strings = strLine.split(",");
int ncCol=0; int ncCol=0;
foreach(QString str,strings) foreach(QString str,strings)
pNew->setItem(ncRow,ncCol++,new QTableWidgetItem(QString(" " + str + " "))); pNew->setItem(ncRow,ncCol++,new STableWidgetItem(QString(" " + str + " ")));
GetMainWindow()->m_progress.setValue(ncRow++); GetMainWindow()->m_progress.setValue(ncRow++);
GetMainWindow()->m_progress.repaint(); GetMainWindow()->m_progress.repaint();
} }

View File

@@ -22,7 +22,7 @@ void STable::SetHeaderList(QVector <QStringList>* _pvecHead,int _nColumn)
setColumnCount(_pvecHead->size()); setColumnCount(_pvecHead->size());
int i = 0; int i = 0;
foreach(QStringList strList, *_pvecHead ) foreach(QStringList strList, *_pvecHead )
setHorizontalHeaderItem(i++,new QTableWidgetItem(strList.at(_nColumn))); setHorizontalHeaderItem(i++,new STableWidgetItem(strList.at(_nColumn)));
} }
void STable::SetHeaderList(QStringList _Head) void STable::SetHeaderList(QStringList _Head)
@@ -30,7 +30,7 @@ void STable::SetHeaderList(QStringList _Head)
setColumnCount(_Head.size()); setColumnCount(_Head.size());
int i = 0; int i = 0;
foreach(QString str,_Head ) foreach(QString str,_Head )
setHorizontalHeaderItem(i++,new QTableWidgetItem(str)); setHorizontalHeaderItem(i++,new STableWidgetItem(str));
} }
@@ -50,7 +50,7 @@ void STable::menuInsert()
int nRow = currentRow(); int nRow = currentRow();
insertRow(nRow); insertRow(nRow);
for (int i = 0; i < columnCount() ; i++) for (int i = 0; i < columnCount() ; i++)
setItem(nRow,i,new QTableWidgetItem(" ")); setItem(nRow,i,new STableWidgetItem(" "));
} }
@@ -132,7 +132,7 @@ void STable::Paste()
{ {
for(int j = 0; j < columnCount(); j++) for(int j = 0; j < columnCount(); j++)
{ {
setItem(i, j, new QTableWidgetItem(QString(" "))); setItem(i, j, new STableWidgetItem(QString(" ")));
} }
} }
} }
@@ -147,7 +147,7 @@ void STable::Paste()
if (nCol >= columnCount()) continue; if (nCol >= columnCount()) continue;
QTableWidgetItem *pItem; QTableWidgetItem *pItem;
if (nRows >= nRows) if (nRows >= nRows)
pItem = new QTableWidgetItem; pItem = new STableWidgetItem;
else else
pItem = item(nRow,nCol); pItem = item(nRow,nCol);
pItem->setText(" "+strCol.trimmed()+" "); pItem->setText(" "+strCol.trimmed()+" ");

View File

@@ -23,6 +23,31 @@ public:
} }
}; };
class STableWidgetItem : public QTableWidgetItem
{
public:
STableWidgetItem(int type=Type):QTableWidgetItem(type){}
STableWidgetItem(const QString& text, int type=Type):QTableWidgetItem(text, type){}
STableWidgetItem(const QIcon& icon, const QString& text, int type = Type):QTableWidgetItem(icon, text, type){}
STableWidgetItem(const QTableWidgetItem& other):QTableWidgetItem(other){}
bool operator <(const QTableWidgetItem &other) const
{
bool tok = false;
bool ook = false;
int nThis = text().toInt(&tok);
int nOther = other.text().toInt(&ook);
if (!(tok && ook))
return text() < other.text();
else
return nThis < nOther;
}
};
class STable : public QTableWidget class STable : public QTableWidget
{ {
Q_OBJECT Q_OBJECT

View File

@@ -333,8 +333,10 @@ void Widget::CompanyItemChanged(QListWidgetItem* _current,QListWidgetItem*)
{ {
case E_SERVICE_INFLUENCER: case E_SERVICE_INFLUENCER:
{ {
/*
if (0 == nServiceCnt[E_SERVICE_INFLUENCER]++) if (0 == nServiceCnt[E_SERVICE_INFLUENCER]++)
continue; continue;
*/
strService = "[Influencer]"; strService = "[Influencer]";
break; break;
} }

View File

@@ -251,7 +251,7 @@ void SBatchRun::ViewResult()
for (int k = 0; k < pTable->columnCount() ; k++) for (int k = 0; k < pTable->columnCount() ; k++)
{ {
QString str = m_vecData[i][j][k].replace("\n"," "); QString str = m_vecData[i][j][k].replace("\n"," ");
pTable->setItem(nCount,k,new QTableWidgetItem(" "+str.replace("\t"," ")+" ")); pTable->setItem(nCount,k,new STableWidgetItem(" "+str.replace("\t"," ")+" "));
} }
nCount++; nCount++;
GetMainWindow()->m_progress.setValue(nCount); GetMainWindow()->m_progress.setValue(nCount);
@@ -319,7 +319,7 @@ void SBatchRun::ViewRawResult()
for (int k = 0; k < pTable->columnCount() ; k++) for (int k = 0; k < pTable->columnCount() ; k++)
{ {
QString str = m_vecData[i][j][k].replace("\n"," "); QString str = m_vecData[i][j][k].replace("\n"," ");
pTable->setItem(nCount,k,new QTableWidgetItem(" "+str.replace("\t"," ")+" ")); pTable->setItem(nCount,k,new STableWidgetItem(" "+str.replace("\t"," ")+" "));
} }
nCount++; nCount++;
GetMainWindow()->m_progress.setValue(nCount); GetMainWindow()->m_progress.setValue(nCount);
@@ -503,13 +503,13 @@ bool SBatchRun::loadData()
for(int j = 0; j < GetColumn().data().size(); j++) for(int j = 0; j < GetColumn().data().size(); j++)
//strList << " " + query.value(j).toString() + " "; //strList << " " + query.value(j).toString() + " ";
strList.append(query.value(j).toString()); strList.append(query.value(j).toString());
/*
if(strList[m_anData[E_DATA_platform_form]].trimmed() == "post" || strList[m_anData[E_DATA_platform_form]].trimmed() == "story" || strList[m_anData[E_DATA_platform_form]].trimmed() == "channel") if(strList[m_anData[E_DATA_platform_form]].trimmed() == "post" || strList[m_anData[E_DATA_platform_form]].trimmed() == "story" || strList[m_anData[E_DATA_platform_form]].trimmed() == "channel")
strList[m_anData[E_DATA_platform_form]] = "sns"; strList[m_anData[E_DATA_platform_form]] = "sns";
if(strList[m_anData[E_DATA_platform_form]].trimmed() == "group") if(strList[m_anData[E_DATA_platform_form]].trimmed() == "group")
strList[m_anData[E_DATA_platform_form]] = "community"; strList[m_anData[E_DATA_platform_form]] = "community";
*/
if(i == E_ARTICLE_BODY) if(i == E_ARTICLE_BODY)
{ {

View File

@@ -75,6 +75,7 @@ void SCountDlg::choose_1()
} }
} }
if (nCatalog == D_NOT_SELECT) return; if (nCatalog == D_NOT_SELECT) return;
m_pTable->clear();
m_pTable->SetHeaderList(QStringList() << GetColumn().data().at(nCatalog).at(SColumn::E_NAME) << "Count"); m_pTable->SetHeaderList(QStringList() << GetColumn().data().at(nCatalog).at(SColumn::E_NAME) << "Count");
QTableWidget *pCurrent = (QTableWidget *)GetMainWindow()->m_pDataDlg->GetCurrentWidget(); QTableWidget *pCurrent = (QTableWidget *)GetMainWindow()->m_pDataDlg->GetCurrentWidget();
GetMainWindow()->m_progress.setRange(0,pCurrent->rowCount()); GetMainWindow()->m_progress.setRange(0,pCurrent->rowCount());
@@ -103,7 +104,7 @@ void SCountDlg::choose_1()
{ {
int nCol = 0; int nCol = 0;
QString str = now.toString("yyyy-MM-dd").trimmed(); QString str = now.toString("yyyy-MM-dd").trimmed();
m_pTable->setItem(nCount,nCol++,new QTableWidgetItem(str)); m_pTable->setItem(nCount,nCol++,new STableWidgetItem(str));
if (mapCount.contains(now)) if (mapCount.contains(now))
m_pTable->setItem(nCount,nCol,new STableNumberItem(QString::number(mapCount[now]))); m_pTable->setItem(nCount,nCol,new STableNumberItem(QString::number(mapCount[now])));
else else
@@ -130,7 +131,7 @@ void SCountDlg::choose_1()
for (QMap<QString,int> ::iterator i = mapCount.begin(); i != mapCount.end(); ++i) for (QMap<QString,int> ::iterator i = mapCount.begin(); i != mapCount.end(); ++i)
{ {
int nCol = 0; int nCol = 0;
m_pTable->setItem(nCount,nCol++,new QTableWidgetItem(i.key())); m_pTable->setItem(nCount,nCol++,new STableWidgetItem(i.key()));
m_pTable->setItem(nCount,nCol++,new STableNumberItem(QString::number(i.value()))); m_pTable->setItem(nCount,nCol++,new STableNumberItem(QString::number(i.value())));
nCount++; nCount++;
} }
@@ -199,7 +200,7 @@ void SCountDlg::choose_2()
{ {
int nCol = 0; int nCol = 0;
QString str = now.toString("yyyy-MM-dd").trimmed(); QString str = now.toString("yyyy-MM-dd").trimmed();
m_pTable->setItem(nCount,nCol++,new QTableWidgetItem(str)); m_pTable->setItem(nCount,nCol++,new STableWidgetItem(str));
if (mapCount.contains(str)) if (mapCount.contains(str))
{ {
for (QSet<QString>::iterator j = setList.begin(); j != setList.end(); ++j) for (QSet<QString>::iterator j = setList.begin(); j != setList.end(); ++j)
@@ -224,7 +225,7 @@ void SCountDlg::choose_2()
for (QMap<QString,QMap<QString,int> >::iterator i = mapCount.begin(); i != mapCount.end(); ++i) for (QMap<QString,QMap<QString,int> >::iterator i = mapCount.begin(); i != mapCount.end(); ++i)
{ {
int nCol = 0; int nCol = 0;
m_pTable->setItem(nCount,nCol++,new QTableWidgetItem(i.key())); m_pTable->setItem(nCount,nCol++,new STableWidgetItem(i.key()));
for (QSet<QString>::iterator j = setList.begin(); j != setList.end(); ++j) for (QSet<QString>::iterator j = setList.begin(); j != setList.end(); ++j)
{ {
if (i->contains(*j)) if (i->contains(*j))

View File

@@ -86,11 +86,13 @@ void SDataDlg::DataReload(QString _strTableName,int _nSelect)
for (int i = 0; i < pTable->columnCount() ; i++) for (int i = 0; i < pTable->columnCount() ; i++)
{ {
QString str = query.value(i).toString().replace("\n"," "); QString str = query.value(i).toString().replace("\n"," ");
/*
if((i == GetColumn().getColumnIndex("platform_form")) && (str.trimmed() == "post" || str.trimmed() == "channel" || str.trimmed() == "story")) if((i == GetColumn().getColumnIndex("platform_form")) && (str.trimmed() == "post" || str.trimmed() == "channel" || str.trimmed() == "story"))
str = "sns"; str = "sns";
if((i == GetColumn().getColumnIndex("platform_form")) && (str.trimmed() == "group")) if((i == GetColumn().getColumnIndex("platform_form")) && (str.trimmed() == "group"))
str = "community"; str = "community";
pTable->setItem(nCount,i,new QTableWidgetItem(" "+str.replace("\t"," ")+" ")); */
pTable->setItem(nCount,i,new STableWidgetItem(" "+str.replace("\t"," ")+" "));
} }
nCount++; nCount++;
GetMainWindow()->m_progress.setValue(nCount); GetMainWindow()->m_progress.setValue(nCount);
@@ -102,7 +104,7 @@ void SDataDlg::InsertCopyRow(int _nRow,QTableWidget *_pCurrent,QTableWidget *_pN
{ {
_pNew->setRowCount(_pNew->rowCount()+1); _pNew->setRowCount(_pNew->rowCount()+1);
for (int nCount = 0;nCount < _pCurrent->columnCount() ;nCount++ ) for (int nCount = 0;nCount < _pCurrent->columnCount() ;nCount++ )
_pNew->setItem(_pNew->rowCount()-1,nCount,new QTableWidgetItem(*_pCurrent->item(_nRow,nCount))); _pNew->setItem(_pNew->rowCount()-1,nCount,new STableWidgetItem(*_pCurrent->item(_nRow,nCount)));
} }
void SDataDlg::SearchDate(QDate _dtStart,QDate _dtEnd) void SDataDlg::SearchDate(QDate _dtStart,QDate _dtEnd)
@@ -327,10 +329,10 @@ void SDataDlg::SearchReplace(int _nCatalogIndex,int _nReplaceFindIndex,int _nRep
strOut = strMiddle; strOut = strMiddle;
break; break;
} }
pNew->setItem(nCount,nColumnCount,new QTableWidgetItem(strOut)); pNew->setItem(nCount,nColumnCount,new STableWidgetItem(strOut));
} }
else else
pNew->setItem(nCount,nColumnCount,new QTableWidgetItem(*pCurrent->item(nCount,nColumnCount))); pNew->setItem(nCount,nColumnCount,new STableWidgetItem(*pCurrent->item(nCount,nColumnCount)));
} }
GetMainWindow()->m_progress.setValue(nCount); GetMainWindow()->m_progress.setValue(nCount);
GetMainWindow()->m_progress.repaint(); GetMainWindow()->m_progress.repaint();
@@ -432,7 +434,7 @@ void SDataDlg::Import(QVector <QByteArray> _vecImport )
if(column.at(j).at(SColumn::E_DATABASE).compare(strings.at(i)) == 0) if(column.at(j).at(SColumn::E_DATABASE).compare(strings.at(i)) == 0)
strings[i] = column.at(j).at(SColumn::E_NAME); strings[i] = column.at(j).at(SColumn::E_NAME);
} }
pNew->setHorizontalHeaderItem(i-1,new QTableWidgetItem(strings.at(i))); pNew->setHorizontalHeaderItem(i-1,new STableWidgetItem(strings.at(i)));
} }
bFirst = false; bFirst = false;
pNew->setRowCount(_vecImport.size()-1); pNew->setRowCount(_vecImport.size()-1);
@@ -446,7 +448,7 @@ void SDataDlg::Import(QVector <QByteArray> _vecImport )
QStringList strings = strLine.split(","); QStringList strings = strLine.split(",");
int ncCol=0; int ncCol=0;
foreach(QString str,strings) foreach(QString str,strings)
pNew->setItem(ncRow,ncCol++,new QTableWidgetItem(QString(" " + str + " "))); pNew->setItem(ncRow,ncCol++,new STableWidgetItem(QString(" " + str + " ")));
GetMainWindow()->m_progress.setValue(ncRow++); GetMainWindow()->m_progress.setValue(ncRow++);
GetMainWindow()->m_progress.repaint(); GetMainWindow()->m_progress.repaint();
} }

View File

@@ -22,7 +22,7 @@ void STable::SetHeaderList(QVector <QStringList>* _pvecHead,int _nColumn)
setColumnCount(_pvecHead->size()); setColumnCount(_pvecHead->size());
int i = 0; int i = 0;
foreach(QStringList strList, *_pvecHead ) foreach(QStringList strList, *_pvecHead )
setHorizontalHeaderItem(i++,new QTableWidgetItem(strList.at(_nColumn))); setHorizontalHeaderItem(i++,new STableWidgetItem(strList.at(_nColumn)));
} }
void STable::SetHeaderList(QStringList _Head) void STable::SetHeaderList(QStringList _Head)
@@ -30,7 +30,7 @@ void STable::SetHeaderList(QStringList _Head)
setColumnCount(_Head.size()); setColumnCount(_Head.size());
int i = 0; int i = 0;
foreach(QString str,_Head ) foreach(QString str,_Head )
setHorizontalHeaderItem(i++,new QTableWidgetItem(str)); setHorizontalHeaderItem(i++,new STableWidgetItem(str));
} }
@@ -50,7 +50,7 @@ void STable::menuInsert()
int nRow = currentRow(); int nRow = currentRow();
insertRow(nRow); insertRow(nRow);
for (int i = 0; i < columnCount() ; i++) for (int i = 0; i < columnCount() ; i++)
setItem(nRow,i,new QTableWidgetItem(" ")); setItem(nRow,i,new STableWidgetItem(" "));
} }
@@ -132,7 +132,7 @@ void STable::Paste()
{ {
for(int j = 0; j < columnCount(); j++) for(int j = 0; j < columnCount(); j++)
{ {
setItem(i, j, new QTableWidgetItem(QString(" "))); setItem(i, j, new STableWidgetItem(QString(" ")));
} }
} }
} }
@@ -147,7 +147,7 @@ void STable::Paste()
if (nCol >= columnCount()) continue; if (nCol >= columnCount()) continue;
QTableWidgetItem *pItem; QTableWidgetItem *pItem;
if (nRows >= nRows) if (nRows >= nRows)
pItem = new QTableWidgetItem; pItem = new STableWidgetItem;
else else
pItem = item(nRow,nCol); pItem = item(nRow,nCol);
pItem->setText(" "+strCol.trimmed()+" "); pItem->setText(" "+strCol.trimmed()+" ");

View File

@@ -23,6 +23,31 @@ public:
} }
}; };
class STableWidgetItem : public QTableWidgetItem
{
public:
STableWidgetItem(int type=Type):QTableWidgetItem(type){}
STableWidgetItem(const QString& text, int type=Type):QTableWidgetItem(text, type){}
STableWidgetItem(const QIcon& icon, const QString& text, int type = Type):QTableWidgetItem(icon, text, type){}
STableWidgetItem(const QTableWidgetItem& other):QTableWidgetItem(other){}
bool operator <(const QTableWidgetItem &other) const
{
bool tok = false;
bool ook = false;
int nThis = text().toInt(&tok);
int nOther = other.text().toInt(&ook);
if (!(tok && ook))
return text() < other.text();
else
return nThis < nOther;
}
};
class STable : public QTableWidget class STable : public QTableWidget
{ {
Q_OBJECT Q_OBJECT

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject> <!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.3.0, 2016-07-06T15:06:54. --> <!-- Written by QtCreator 3.3.0, 2016-07-08T16:55:53. -->
<qtcreator> <qtcreator>
<data> <data>
<variable>EnvironmentId</variable> <variable>EnvironmentId</variable>
@@ -787,7 +787,7 @@
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">sfilterprocess</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">sfilterprocess</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:C:/source/sfilterprocess/sfilterprocess.pro</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:C:/source/sfilterprocess/sfilterprocess.pro</value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments">&quot;510&quot; &quot;testall&quot;</value> <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments">&quot;514&quot; &quot;testall&quot;</value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">sfilterprocess.pro</value> <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">sfilterprocess.pro</value>
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value> <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value> <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value>