Delete 기능 추가
\n 을 " " 로 변경 git-svn-id: svn://192.168.0.12/source@43 8346c931-da38-4b9b-9d4c-e48b93cbd075
This commit is contained in:
@@ -33,6 +33,8 @@ void STable::keyPressEvent(QKeyEvent* event)
|
||||
Copy();
|
||||
if (event->key() == Qt::Key_V && (event->modifiers() & Qt::ControlModifier))
|
||||
Paste();
|
||||
if (event->key() == Qt::Key_Delete)
|
||||
Delete();
|
||||
}
|
||||
|
||||
void STable::menuInsert()
|
||||
@@ -139,3 +141,16 @@ void STable::Paste()
|
||||
}
|
||||
}
|
||||
|
||||
void STable::Delete()
|
||||
{
|
||||
QModelIndexList cells = selectedIndexes();
|
||||
foreach (const QModelIndex& cell, cells)
|
||||
{
|
||||
QTableWidgetItem *pItem = item(cell.row(),cell.column());
|
||||
if (pItem != NULL)
|
||||
{
|
||||
pItem->setText("");
|
||||
setItem(cell.row(),cell.column(),pItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ public:
|
||||
int getArticleSelect(){return m_nArticle;}
|
||||
void Copy();
|
||||
void Paste();
|
||||
void Delete();
|
||||
private:
|
||||
int m_nArticle;
|
||||
public:
|
||||
|
||||
@@ -661,7 +661,10 @@ void Widget::DataReload(QString _strTableName,int _nSelect)
|
||||
while (query.next())
|
||||
{
|
||||
for (int i = 0; i < pTable->columnCount() ; i++)
|
||||
pTable->setItem(nCount,i,new QTableWidgetItem(" "+query.value(i).toString()+" "));
|
||||
{
|
||||
QString str = query.value(i).toString().replace("\n"," ");
|
||||
pTable->setItem(nCount,i,new QTableWidgetItem(" "+str.replace("\t"," ")+" "));
|
||||
}
|
||||
nCount++;
|
||||
m_pProgress->setValue(nCount);
|
||||
m_pProgress->repaint();
|
||||
|
||||
Reference in New Issue
Block a user