up down 기능 추가
git-svn-id: svn://192.168.0.12/source@135 8346c931-da38-4b9b-9d4c-e48b93cbd075
This commit is contained in:
@@ -427,8 +427,16 @@ QGroupBox *Widget::setFilterWidgets()
|
||||
m_plwFilter = new QListWidget;
|
||||
vlayout->addWidget(m_plwFilter);
|
||||
connect(m_plwFilter,SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),this,SLOT(currentFilterItemChanged(QListWidgetItem*,QListWidgetItem*)));
|
||||
QHBoxLayout *hlayout = new QHBoxLayout();
|
||||
QPushButton *pbUp = new QPushButton("Up");
|
||||
QPushButton *pbDown = new QPushButton("Down");
|
||||
QPushButton *pbDelete = new QPushButton("Delete");
|
||||
vlayout->addWidget(pbDelete);
|
||||
hlayout->addWidget(pbUp);
|
||||
hlayout->addWidget(pbDown);
|
||||
hlayout->addWidget(pbDelete);
|
||||
vlayout->addLayout(hlayout);
|
||||
connect(pbUp, SIGNAL(released()),this, SLOT(FilterUp()));
|
||||
connect(pbDown, SIGNAL(released()),this, SLOT(FilterDown()));
|
||||
connect(pbDelete, SIGNAL(released()),this, SLOT(FilterDelete()));
|
||||
hMainlayout->addLayout(vlayout);
|
||||
}
|
||||
@@ -790,7 +798,6 @@ void Widget::SearchCounterUpdate()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Widget::SearchLengthInsert()
|
||||
{
|
||||
STable *pNew = new STable;
|
||||
@@ -1416,6 +1423,60 @@ void Widget::FilterDelete()
|
||||
RefreshFilter(item->data(Qt::UserRole).toInt());
|
||||
}
|
||||
|
||||
void Widget::FilterUp()
|
||||
{
|
||||
int nSelect = m_plwFilter->currentRow();
|
||||
if (nSelect <= 0) return;
|
||||
QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
|
||||
db.setHostName("bigbird.iptime.org");
|
||||
db.setUserName("admin");
|
||||
db.setPassword("admin123");
|
||||
db.setDatabaseName("concepters");
|
||||
if (db.open() == false)
|
||||
{
|
||||
qDebug() << db.lastError().text();
|
||||
return;
|
||||
}
|
||||
|
||||
QString strID1 = m_plwFilter->item(nSelect)->data(Qt::UserRole).toString();
|
||||
QString strID2 = m_plwFilter->item(nSelect-1)->data(Qt::UserRole).toString();
|
||||
QString strQuery = "UPDATE filter t1 INNER JOIN filter t2 ON (t1.id, t2.id) IN ((" + strID1 + ","+ strID2 +"),("+ strID2 + "," + strID1 + ")) SET t1.type = t2.type,t1.filtergroup_id = t2.filtergroup_id,t1.data = t2.data";
|
||||
db.exec(strQuery.toUtf8());
|
||||
db.close();
|
||||
foreach (QListWidgetItem *item,m_plwFilterGroup->selectedItems())
|
||||
RefreshFilter(item->data(Qt::UserRole).toInt());
|
||||
|
||||
m_plwFilter->setCurrentRow(nSelect-1);
|
||||
}
|
||||
|
||||
void Widget::FilterDown()
|
||||
{
|
||||
int nSelect = m_plwFilter->currentRow();
|
||||
if (nSelect < 0) return;
|
||||
if (nSelect >= (m_plwFilter->count() - 1)) return;
|
||||
qDebug() << nSelect;
|
||||
QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
|
||||
db.setHostName("bigbird.iptime.org");
|
||||
db.setUserName("admin");
|
||||
db.setPassword("admin123");
|
||||
db.setDatabaseName("concepters");
|
||||
if (db.open() == false)
|
||||
{
|
||||
qDebug() << db.lastError().text();
|
||||
return;
|
||||
}
|
||||
QString strID1 = m_plwFilter->item(nSelect)->data(Qt::UserRole).toString();
|
||||
QString strID2 = m_plwFilter->item(nSelect+1)->data(Qt::UserRole).toString();
|
||||
QString strQuery = "UPDATE filter t1 INNER JOIN filter t2 ON (t1.id, t2.id) IN ((" + strID1 + ","+ strID2 +"),("+ strID2 + "," + strID1 + ")) SET t1.type = t2.type,t1.filtergroup_id = t2.filtergroup_id,t1.data = t2.data";
|
||||
db.exec(strQuery.toUtf8());
|
||||
db.close();
|
||||
foreach (QListWidgetItem *item,m_plwFilterGroup->selectedItems())
|
||||
RefreshFilter(item->data(Qt::UserRole).toInt());
|
||||
|
||||
m_plwFilter->setCurrentRow(nSelect+1);
|
||||
}
|
||||
|
||||
|
||||
void Widget::currentFilterItemChanged(QListWidgetItem *_pCurrent, QListWidgetItem *_pPrev)
|
||||
{
|
||||
Q_UNUSED(_pPrev);
|
||||
|
||||
@@ -136,7 +136,7 @@ private:
|
||||
void RefreshFilter(int _nGroup);
|
||||
void DataBaseCounterFilter(int _nArticle,int _nCategory,int _nComp, int _nInsDel,QString _str,int _nGroup,int _nCommand,QString _strFilterId ="");
|
||||
bool ReloadColumn();
|
||||
QString GetArticleType(int _nSelect);
|
||||
QString GetArticleType(int _nSelect);
|
||||
public slots:
|
||||
void CloseTab(int index);
|
||||
void DoubleClickTab(int index);
|
||||
@@ -153,7 +153,6 @@ public slots:
|
||||
void SearchCounterUpdate();
|
||||
void SearchCounterInsert();
|
||||
|
||||
|
||||
void DataGroupRefresh();
|
||||
void DataGroupItemChanged ( QListWidgetItem * item );
|
||||
void FilterGroupInsert();
|
||||
@@ -162,7 +161,11 @@ public slots:
|
||||
void FilterGroupRefresh();
|
||||
void FilterGroupCopyPaste();
|
||||
void currentGroupItemChanged(QListWidgetItem *_pCurrent, QListWidgetItem *_pPrev=0);
|
||||
|
||||
void FilterDelete();
|
||||
void FilterUp();
|
||||
void FilterDown();
|
||||
|
||||
void currentFilterItemChanged(QListWidgetItem *_pCurrent, QListWidgetItem *_pPrev=0);
|
||||
void FileNew();
|
||||
void FileImport();
|
||||
|
||||
Reference in New Issue
Block a user