tcStockSelectDialog::tcStockSelectDialog(QWidget *pParent) : QDialog(pParent) { setupUi(this); QStringList titles; titles<<tr("StockCode")<<tr("Name"); tbl1->setColumnCount(2); tbl1->setHorizontalHeaderLabels(titles); tbl1->horizontalHeader()->setResizeMode(1, QHeaderView::Stretch); tbl1->verticalHeader()->hide(); tbl1->setSelectionMode(QAbstractItemView::SingleSelection); tbl1->setSelectionBehavior(QAbstractItemView::SelectRows); tbl1->setEditTriggers(QAbstractItemView::NoEditTriggers); connect(cbo1, SIGNAL(currentIndexChanged(int)), this, SLOT(DoMarketIndexChanged(int))); connect(edt1, SIGNAL(textChanged(const QString &)), this, SLOT(DoFilterTextChanged(const QString &))); connect(edt2, SIGNAL(textChanged(const QString &)), this, SLOT(DoFilterTextChanged(const QString &))); disconnect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); connect(buttonBox, SIGNAL(accepted()), this, SLOT(DoOk())); connect(&mViewStockInfoList, SIGNAL(OnStockListNeedReload()), this, SLOT(DoStockListNeedReload())); LoadMarketList(); }
tcStockListWidget::tcStockListWidget(QWidget *pParent) : QWidget(pParent) { setupUi(this); QStringList titles; titles<<tr("Stock Code")<<tr("Stock Name"); tbl1->setColumnCount(2); tbl1->setHorizontalHeaderLabels(titles); //tbl1->horizontalHeader()->setResizeMode(1, QHeaderView::Stretch); tbl1->verticalHeader()->hide(); //tbl1->setSelectionMode(QAbstractItemView::SingleSelection); tbl1->setSelectionBehavior(QAbstractItemView::SelectRows); tbl1->setEditTriggers(QAbstractItemView::NoEditTriggers); connect(cbo1, SIGNAL(currentIndexChanged(int)), this, SLOT(DoMarketIndexChanged(int))); connect(btn1, SIGNAL(clicked()), this, SLOT(DoEditFavourite())); connect(edt1, SIGNAL(textChanged(const QString &)), this, SLOT(DoFilterTextChanged(const QString &))); connect(edt2, SIGNAL(textChanged(const QString &)), this, SLOT(DoFilterTextChanged(const QString &))); connect(tbl1, SIGNAL(itemSelectionChanged()), this, SLOT(DoStockSelectionChanged())); connect(&mViewStockInfoList, SIGNAL(OnGroupListNeedReload()), this, SLOT(DoGroupListNeedReload())); connect(&mViewStockInfoList, SIGNAL(OnStockListNeedReload()), this, SLOT(DoStockListNeedReload())); DoMarketModified(); }