- enhancement: select and delete multiple watches
This commit is contained in:
parent
08c7ca3783
commit
ec17cfcb99
1
NEWS.md
1
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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@
|
|||
<enum>QTabWidget::West</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="usesScrollButtons">
|
||||
<bool>true</bool>
|
||||
|
@ -246,6 +246,9 @@
|
|||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::DoubleClicked</set>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::ExtendedSelection</enum>
|
||||
</property>
|
||||
<property name="textElideMode">
|
||||
<enum>Qt::ElideNone</enum>
|
||||
</property>
|
||||
|
|
|
@ -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 <stdio.h>
|
||||
|
@ -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);
|
||||
}
|
Loading…
Reference in New Issue