1#include <QLoggingCategory>
4#include "FrmWakeOnLan.h"
5#include "ui_FrmWakeOnLan.h"
7static Q_LOGGING_CATEGORY(log,
"WakeOnLan.CFrmWakeOnLan")
14 ui->tableView->setModel(pModel);
15 ui->tableView->setContextMenuPolicy(Qt::CustomContextMenu);
16 ui->tableView->installEventFilter(
this);
17 check = connect(ui->tableView,
18 SIGNAL(customContextMenuRequested(
const QPoint&)),
19 this, SIGNAL(customContextMenuRequested(
const QPoint&)));
21 check = connect(pModel, SIGNAL(modelReset()),
22 ui->tableView, SLOT(resizeColumnsToContents()));
24 setWindowTitle(tr(
"Wake on lan"));
25 setWindowIcon(QIcon::fromTheme(
"lan"));
29 ui->tableView->horizontalHeader(),
30 &QHeaderView::sectionClicked,
32 if(0 == c || 1 == c) {
33 ui->tableView->horizontalHeader()->setSortIndicatorShown(true);
36 ui->tableView->horizontalHeader()->setSortIndicatorShown(false);
40 check = connect(ui->tableView->horizontalHeader(),
41 &QHeaderView::sortIndicatorChanged,
42 this, [&](
int logicalIndex, Qt::SortOrder order){
43 if(0 == logicalIndex || 1 == logicalIndex)
44 ui->tableView->model()->sort(logicalIndex, order);
48 ui->tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
56 ui->tableView->horizontalHeader()->setSectionResizeMode(
57 QHeaderView::Interactive);
63CFrmWakeOnLan::~CFrmWakeOnLan()
65 qDebug(log) <<
"CFrmWakeOnLan::~CFrmWakeOnLan()";
69void CFrmWakeOnLan::slotRemoveRow()
71 QModelIndex index = ui->tableView->currentIndex();
74 QMessageBox::information(
77 tr(
"Please select a item"));
81 ui->tableView->model()->removeRow(index.row());
84QModelIndex CFrmWakeOnLan::GetCurrentIndex()
86 return ui->tableView->currentIndex();
89QModelIndexList CFrmWakeOnLan::GetSelect()
91 return ui->tableView->selectionModel()->selectedRows();
94bool CFrmWakeOnLan::eventFilter(QObject *watched, QEvent *event)
96 if(ui->tableView == watched)
98 switch(event->type()){
void sigViewerFocusIn(QWidget *pView)
The view is focus.