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 check = connect(ui->tableView,
17 SIGNAL(customContextMenuRequested(
const QPoint&)),
18 this, SIGNAL(customContextMenuRequested(
const QPoint&)));
20 check = connect(pModel, SIGNAL(modelReset()),
21 ui->tableView, SLOT(resizeColumnsToContents()));
23 setWindowTitle(tr(
"Wake on lan"));
24 setWindowIcon(QIcon::fromTheme(
"lan"));
28 ui->tableView->horizontalHeader(),
29 &QHeaderView::sectionClicked,
31 if(0 == c || 1 == c) {
32 ui->tableView->horizontalHeader()->setSortIndicatorShown(true);
35 ui->tableView->horizontalHeader()->setSortIndicatorShown(false);
39 check = connect(ui->tableView->horizontalHeader(),
40 &QHeaderView::sortIndicatorChanged,
41 this, [&](
int logicalIndex, Qt::SortOrder order){
42 if(0 == logicalIndex || 1 == logicalIndex)
43 ui->tableView->model()->sort(logicalIndex, order);
47 ui->tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
55 ui->tableView->horizontalHeader()->setSectionResizeMode(
56 QHeaderView::Interactive);
62CFrmWakeOnLan::~CFrmWakeOnLan()
64 qDebug(log) <<
"CFrmWakeOnLan::~CFrmWakeOnLan()";
68void CFrmWakeOnLan::slotRemoveRow()
70 QModelIndex index = ui->tableView->currentIndex();
73 QMessageBox::information(
76 tr(
"Please select a item"));
80 ui->tableView->model()->removeRow(index.row());
83QModelIndex CFrmWakeOnLan::GetCurrentIndex()
85 return ui->tableView->currentIndex();
88QModelIndexList CFrmWakeOnLan::GetSelect()
90 return ui->tableView->selectionModel()->selectedRows();