- enhancement: select and delete multiple watches

This commit is contained in:
Roy Qu 2022-04-22 14:28:53 +08:00
parent 08c7ca3783
commit ec17cfcb99
4 changed files with 61 additions and 12 deletions

View File

@ -5,6 +5,7 @@ Red Panda C++ Version 1.0.5
- fix: research button doesn't show find in files dialog - fix: research button doesn't show find in files dialog
- enhancement: add project template for libmysqlclient(libmariadbclient) - enhancement: add project template for libmysqlclient(libmariadbclient)
- enhancement: add libmysqlclient to the x86-64 version gcc in distribution - enhancement: add libmysqlclient to the x86-64 version gcc in distribution
- enhancement: select and delete multiple watches
Red Panda C++ Version 1.0.4 Red Panda C++ Version 1.0.4
- fix: hide function tips, when move or resize the main window - fix: hide function tips, when move or resize the main window

View File

@ -5282,17 +5282,33 @@ void MainWindow::on_btnSearchAgain_clicked()
void MainWindow::on_actionRemove_Watch_triggered() void MainWindow::on_actionRemove_Watch_triggered()
{ {
QModelIndex index =ui->watchView->currentIndex(); QModelIndexList lst=ui->watchView->selectionModel()->selectedRows();
QModelIndex parent; if (lst.count()<=1) {
while (true) { QModelIndex index =ui->watchView->currentIndex();
parent = ui->watchView->model()->parent(index); QModelIndex parent;
if (parent.isValid()) { while (true) {
index=parent; parent = ui->watchView->model()->parent(index);
} else { if (parent.isValid()) {
break; 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);
} }

View File

@ -85,7 +85,7 @@
<enum>QTabWidget::West</enum> <enum>QTabWidget::West</enum>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>2</number>
</property> </property>
<property name="usesScrollButtons"> <property name="usesScrollButtons">
<bool>true</bool> <bool>true</bool>
@ -246,6 +246,9 @@
<property name="editTriggers"> <property name="editTriggers">
<set>QAbstractItemView::DoubleClicked</set> <set>QAbstractItemView::DoubleClicked</set>
</property> </property>
<property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum>
</property>
<property name="textElideMode"> <property name="textElideMode">
<enum>Qt::ElideNone</enum> <enum>Qt::ElideNone</enum>
</property> </property>

View File

@ -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 <mysql/mysql.h> #include <mysql/mysql.h>
#include <stdio.h> #include <stdio.h>
@ -28,7 +28,7 @@ int main(int argc, char **argv)
finish_with_error(con); finish_with_error(con);
} }
//Create table
if (mysql_query(con, "DROP TABLE IF EXISTS cars")) { if (mysql_query(con, "DROP TABLE IF EXISTS cars")) {
finish_with_error(con); finish_with_error(con);
} }
@ -37,6 +37,7 @@ int main(int argc, char **argv)
finish_with_error(con); finish_with_error(con);
} }
// insert datas
if (mysql_query(con, "INSERT INTO cars VALUES(1,'Audi',52642)")) { if (mysql_query(con, "INSERT INTO cars VALUES(1,'Audi',52642)")) {
finish_with_error(con); finish_with_error(con);
} }
@ -69,6 +70,34 @@ int main(int argc, char **argv)
finish_with_error(con); 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); mysql_close(con);
exit(0); exit(0);
} }