-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmyorderstablewidget.cpp
More file actions
38 lines (33 loc) · 997 Bytes
/
Copy pathmyorderstablewidget.cpp
File metadata and controls
38 lines (33 loc) · 997 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include "myorderstablewidget.h"
#include "btctrader.h"
MyOrdersTableWidget::MyOrdersTableWidget(QWidget *parent) :
QTableWidget(parent)
{
cancelOrder = new QAction ( tr ( "Cancel Order" ), this );
contextMenu = new QMenu ();
contextMenu->addAction( cancelOrder );
connect ( cancelOrder, SIGNAL ( triggered () ), this, SLOT ( cancelOrderEvent() ) );
}
MyOrdersTableWidget::~MyOrdersTableWidget()
{
delete cancelOrder;
delete contextMenu;
}
void MyOrdersTableWidget::contextMenuEvent ( QContextMenuEvent * e )
{
contextMenu->move( e->globalPos() );
contextMenu->setVisible( true );
}
void MyOrdersTableWidget::cancelOrderEvent ()
{
int type;
if ( this->selectedItems().size() == 0 )
return;
int order = this->selectedItems().at(0)->row();
QString oid = this->item( order, 0 )->text();
if ( this->item ( order, 1 )->text().contains( "S" ) )
type = 1;
else
type = 2;
emit cancelOrderSignal ( oid, type );
}