Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Stupan
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Hugo Hörnquist
Stupan
Commits
06022b76
Commit
06022b76
authored
Apr 20, 2018
by
Hugo Hörnquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add sqlQueryBuffer remove button
parent
838fdc30
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
0 deletions
+46
-0
admin/mainwindow.cpp
admin/mainwindow.cpp
+20
-0
admin/mainwindow.h
admin/mainwindow.h
+2
-0
admin/mainwindow.ui
admin/mainwindow.ui
+24
-0
No files found.
admin/mainwindow.cpp
View file @
06022b76
...
...
@@ -1064,3 +1064,23 @@ void MainWindow::on_sqlPrint_clicked()
connect
(
&
dialog
,
SIGNAL
(
paintRequested
(
QPrinter
*
)),
this
,
SLOT
(
printTable
(
QPrinter
*
)));
dialog
.
exec
();
}
void
MainWindow
::
on_sqlBufferDeleteButton_clicked
()
{
QSqlTableModel
*
model
=
(
QSqlTableModel
*
)
ui
->
sqlBufferList
->
model
();
QSqlQuery
query
;
query
.
prepare
(
"delete from sql_queries where id = ?"
);
QVariantList
ids
;
foreach
(
QModelIndex
index
,
ui
->
sqlBufferList
->
selectionModel
()
->
selectedRows
())
{
ids
<<
model
->
data
(
model
->
index
(
index
.
row
(),
0
));
}
query
.
addBindValue
(
ids
);
if
(
!
query
.
execBatch
())
qDebug
()
<<
query
.
lastError
();
model
->
select
();
}
admin/mainwindow.h
View file @
06022b76
...
...
@@ -98,6 +98,8 @@ private slots:
void
printTable
(
QPrinter
*
printer
);
void
on_sqlBufferDeleteButton_clicked
();
private:
Ui
::
MainWindow
*
ui
;
QSqlTableModel
*
model
;
...
...
admin/mainwindow.ui
View file @
06022b76
...
...
@@ -1020,6 +1020,30 @@
</property>
</widget>
</item>
<item>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_6"
>
<item>
<spacer
name=
"horizontalSpacer_8"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
40
</width>
<height>
20
</height>
</size>
</property>
</spacer>
</item>
<item>
<widget
class=
"QPushButton"
name=
"sqlBufferDeleteButton"
>
<property
name=
"text"
>
<string>
Ta bort
</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment