diff --git a/NEWS.md b/NEWS.md
index 7d5d1669..2e90b75f 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -5,6 +5,7 @@ Red Panda C++ Version 1.0.5
- fix: research button doesn't show find in files dialog
- enhancement: add project template for libmysqlclient(libmariadbclient)
- enhancement: add libmysqlclient to the x86-64 version gcc in distribution
+ - enhancement: select and delete multiple watches
Red Panda C++ Version 1.0.4
- fix: hide function tips, when move or resize the main window
diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp
index bc335f10..4a0f9395 100644
--- a/RedPandaIDE/mainwindow.cpp
+++ b/RedPandaIDE/mainwindow.cpp
@@ -5282,17 +5282,33 @@ void MainWindow::on_btnSearchAgain_clicked()
void MainWindow::on_actionRemove_Watch_triggered()
{
- QModelIndex index =ui->watchView->currentIndex();
- QModelIndex parent;
- while (true) {
- parent = ui->watchView->model()->parent(index);
- if (parent.isValid()) {
- index=parent;
- } else {
- break;
+ QModelIndexList lst=ui->watchView->selectionModel()->selectedRows();
+ if (lst.count()<=1) {
+ QModelIndex index =ui->watchView->currentIndex();
+ QModelIndex parent;
+ while (true) {
+ parent = ui->watchView->model()->parent(index);
+ if (parent.isValid()) {
+ index=parent;
+ } else {
+ break;
+ }
}
+ mDebugger->removeWatchVar(index);
+ } else {
+ QModelIndexList filteredList;
+ foreach(const QModelIndex& index,lst) {
+ if (!index.parent().isValid())
+ filteredList.append(index);
+ };
+ std::sort(filteredList.begin(),filteredList.end(), [](const QModelIndex& index1,
+ const QModelIndex& index2) {
+ return index1.row()>index2.row();
+ });
+ foreach(const QModelIndex& index,filteredList) {
+ mDebugger->removeWatchVar(index);
+ };
}
- mDebugger->removeWatchVar(index);
}
diff --git a/RedPandaIDE/mainwindow.ui b/RedPandaIDE/mainwindow.ui
index 39279471..c8f6981b 100644
--- a/RedPandaIDE/mainwindow.ui
+++ b/RedPandaIDE/mainwindow.ui
@@ -85,7 +85,7 @@
QTabWidget::West
- 0
+ 2
true
@@ -246,6 +246,9 @@
QAbstractItemView::DoubleClicked
+
+ QAbstractItemView::ExtendedSelection
+
Qt::ElideNone
diff --git a/windows/templates/mysql_c.txt b/windows/templates/mysql_c.txt
index a6fb3e1f..80b3384b 100644
--- a/windows/templates/mysql_c.txt
+++ b/windows/templates/mysql_c.txt
@@ -1,5 +1,5 @@
/*
- A demo for mysql C API , from https://zetcode.com/db/mysqlc/
+ A demo for mysql client, from https://zetcode.com/db/mysqlc/
*/
#include
#include
@@ -28,7 +28,7 @@ int main(int argc, char **argv)
finish_with_error(con);
}
-
+ //Create table
if (mysql_query(con, "DROP TABLE IF EXISTS cars")) {
finish_with_error(con);
}
@@ -37,6 +37,7 @@ int main(int argc, char **argv)
finish_with_error(con);
}
+ // insert datas
if (mysql_query(con, "INSERT INTO cars VALUES(1,'Audi',52642)")) {
finish_with_error(con);
}
@@ -69,6 +70,34 @@ int main(int argc, char **argv)
finish_with_error(con);
}
+ //query datas
+ if (mysql_query(con, "SELECT * FROM cars"))
+ {
+ finish_with_error(con);
+ }
+
+ MYSQL_RES *result = mysql_store_result(con);
+
+ if (result == NULL)
+ {
+ finish_with_error(con);
+ }
+
+ int num_fields = mysql_num_fields(result);
+
+ MYSQL_ROW row;
+
+ while ((row = mysql_fetch_row(result)))
+ {
+ for(int i = 0; i < num_fields; i++)
+ {
+ printf("%s ", row[i] ? row[i] : "NULL");
+ }
+
+ printf("\n");
+ }
+
+ mysql_free_result(result);
mysql_close(con);
exit(0);
}
\ No newline at end of file