Slide picker
This commit is contained in:
35
src/LogDateSelectDialog.cpp
Normal file
35
src/LogDateSelectDialog.cpp
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
//
|
||||||
|
// Created by Krad on 2021/11/24.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "LogDateSelectDialog.h"
|
||||||
|
#include "components/SlidePickerBox.h"
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
#include <QLabel>
|
||||||
|
LogDateSelectDialog::LogDateSelectDialog(QWidget *parent, Qt::WindowFlags f) : GUIFormBaseDialog(parent, f) {
|
||||||
|
this->setFixedSize(360,380);
|
||||||
|
QVBoxLayout* layout = new QVBoxLayout(formWidget);
|
||||||
|
box = new SlidePickerBox(formWidget);
|
||||||
|
box->setObjectName("slider_one");
|
||||||
|
layout->addWidget(box);
|
||||||
|
}
|
||||||
|
|
||||||
|
LogDateSelectDialog::~LogDateSelectDialog() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool LogDateSelectDialog::updateReferenceData() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LogDateSelectDialog::setAvailableDates(QStringList dates) {
|
||||||
|
box->setItems(dates);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString LogDateSelectDialog::getSelectedValue() {
|
||||||
|
return box->getSelectedValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
void LogDateSelectDialog::setSelectedValue(QString & val) {
|
||||||
|
box->setSelectedValue(val);
|
||||||
|
}
|
||||||
24
src/LogDateSelectDialog.h
Normal file
24
src/LogDateSelectDialog.h
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
//
|
||||||
|
// Created by Krad on 2021/11/24.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef GUI_LOGDATESELECTDIALOG_H
|
||||||
|
#define GUI_LOGDATESELECTDIALOG_H
|
||||||
|
|
||||||
|
#include "GUIFormBaseDialog.h"
|
||||||
|
class SlidePickerBox;
|
||||||
|
class LogDateSelectDialog :public GUIFormBaseDialog{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit LogDateSelectDialog(QWidget *parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
|
||||||
|
~LogDateSelectDialog() override;
|
||||||
|
void setAvailableDates(QStringList dates);
|
||||||
|
QString getSelectedValue();
|
||||||
|
void setSelectedValue(QString& val);
|
||||||
|
protected:
|
||||||
|
bool updateReferenceData() override;
|
||||||
|
SlidePickerBox* box = nullptr;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif //GUI_LOGDATESELECTDIALOG_H
|
||||||
@@ -13,9 +13,20 @@
|
|||||||
#include <QTableView>
|
#include <QTableView>
|
||||||
#include "components/SlideableTableView.h"
|
#include "components/SlideableTableView.h"
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
#include "LogDateSelectDialog.h"
|
||||||
|
#include "mainwindow.h"
|
||||||
|
|
||||||
|
QString fileNameToDate(QString fileName)
|
||||||
|
{
|
||||||
|
return fileName.split("log/")[1].replace("-op.log","");
|
||||||
|
}
|
||||||
|
QString dateToFileName(QString date)
|
||||||
|
{
|
||||||
|
return QString("./log/") + date + QString("-op.log");
|
||||||
|
}
|
||||||
|
|
||||||
UserOperationLogForm::UserOperationLogForm(QWidget *parent) {
|
UserOperationLogForm::UserOperationLogForm(QWidget *parent) {
|
||||||
QVBoxLayout* layout = new QVBoxLayout(this);
|
layout = new QVBoxLayout(this);
|
||||||
QWidget* header = new QWidget(this);
|
QWidget* header = new QWidget(this);
|
||||||
QHBoxLayout* headerLayout = new QHBoxLayout(header);
|
QHBoxLayout* headerLayout = new QHBoxLayout(header);
|
||||||
headerLayout->addWidget(new QLabel(tr("Log Date:")));
|
headerLayout->addWidget(new QLabel(tr("Log Date:")));
|
||||||
@@ -25,29 +36,59 @@ UserOperationLogForm::UserOperationLogForm(QWidget *parent) {
|
|||||||
table = new SlideableTableView(this);
|
table = new SlideableTableView(this);
|
||||||
layout->addWidget(header);
|
layout->addWidget(header);
|
||||||
layout->addWidget(table);
|
layout->addWidget(table);
|
||||||
|
model = new LogFileTableModel(this);
|
||||||
//暂时先放构造函数,之后需要移除,等需要时再调用
|
//暂时先放构造函数,之后需要移除,等需要时再调用
|
||||||
loadUserOperationLog();
|
loadUserOperationLog();
|
||||||
|
connect(btn,&QPushButton::clicked,[=](){
|
||||||
|
auto files = UserOperationLog::getHistoryLogFiles();
|
||||||
|
QStringList dates;
|
||||||
|
for (auto f :files)
|
||||||
|
{
|
||||||
|
dates<<fileNameToDate(f);
|
||||||
|
}
|
||||||
|
if(!dialog){
|
||||||
|
dialog = new LogDateSelectDialog(this);
|
||||||
|
dialog->setWindowModality(Qt::WindowModal);
|
||||||
|
}
|
||||||
|
dialog->setAvailableDates(dates);
|
||||||
|
if (!selectedDateStr.isEmpty()) dialog->setSelectedValue(selectedDateStr);
|
||||||
|
if (dialog->exec() == QDialog::Accepted)
|
||||||
|
{
|
||||||
|
QString date = dialog->getSelectedValue();
|
||||||
|
QString f = dateToFileName(date);
|
||||||
|
this->loadUserOperationLog(f,date);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UserOperationLogForm::~UserOperationLogForm() {
|
UserOperationLogForm::~UserOperationLogForm() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString fileNameToDate(QString fileName)
|
|
||||||
{
|
|
||||||
return fileName.replace("./log/","").replace("-op.log","");
|
|
||||||
}
|
|
||||||
|
|
||||||
void UserOperationLogForm::loadUserOperationLog() {
|
void UserOperationLogForm::loadUserOperationLog() {
|
||||||
LogFileTableModel* model = new LogFileTableModel(this);
|
|
||||||
QString filePath = UserOperationLog::Default()->currentLogFile();
|
QString filePath = UserOperationLog::Default()->currentLogFile();
|
||||||
model->setFileName(filePath);
|
model->setFileName(filePath);
|
||||||
btn->setText(fileNameToDate(filePath));
|
btn->setText(fileNameToDate(filePath));
|
||||||
|
loadUserOperationLog(filePath, fileNameToDate(filePath));
|
||||||
|
selectedDateStr = fileNameToDate(filePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
void UserOperationLogForm::loadUserOperationLog(const QString& fileName, const QString& date) {
|
||||||
|
selectedDateStr = date;
|
||||||
|
model->setFileName(dateToFileName(date));
|
||||||
|
btn->setText(date);
|
||||||
QStringList header;
|
QStringList header;
|
||||||
header<<"Operation Date"<<"Operation Time"<<"User"<<"Operation";
|
header<<"Operation Date"<<"Operation Time"<<"User"<<"Operation";
|
||||||
model->setHeader(header);
|
model->setHeader(header);
|
||||||
// UserOperationLog::getHistoryLogFiles();
|
// UserOperationLog::getHistoryLogFiles();
|
||||||
|
delete table;
|
||||||
|
table = new SlideableTableView(this);
|
||||||
|
layout->addWidget(table);
|
||||||
table->setModel(model);
|
table->setModel(model);
|
||||||
|
|
||||||
table->setAlternatingRowColors(true);
|
table->setAlternatingRowColors(true);
|
||||||
table->setSelectionMode(QAbstractItemView::NoSelection);
|
table->setSelectionMode(QAbstractItemView::NoSelection);
|
||||||
table->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
table->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||||
|
|||||||
@@ -8,16 +8,24 @@
|
|||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
class QTableView;
|
class QTableView;
|
||||||
class QPushButton;
|
class QPushButton;
|
||||||
|
class LogFileTableModel;
|
||||||
|
class QVBoxLayout;
|
||||||
|
class LogDateSelectDialog;
|
||||||
class UserOperationLogForm:public QWidget {
|
class UserOperationLogForm:public QWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit UserOperationLogForm(QWidget *parent = nullptr);
|
explicit UserOperationLogForm(QWidget *parent = nullptr);
|
||||||
~UserOperationLogForm();
|
~UserOperationLogForm();
|
||||||
void loadUserOperationLog();
|
void loadUserOperationLog();
|
||||||
|
void loadUserOperationLog(const QString& fileName, const QString& date);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QTableView * table = nullptr;
|
QTableView * table = nullptr;
|
||||||
QPushButton* btn = nullptr;
|
QPushButton* btn = nullptr;
|
||||||
|
LogFileTableModel* model = nullptr;
|
||||||
|
LogDateSelectDialog* dialog = nullptr;
|
||||||
|
QVBoxLayout* layout = nullptr;
|
||||||
|
QString selectedDateStr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
234
src/components/SlidePickerBox.cpp
Normal file
234
src/components/SlidePickerBox.cpp
Normal file
@@ -0,0 +1,234 @@
|
|||||||
|
//
|
||||||
|
// Created by Krad on 2021/11/24.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "SlidePickerBox.h"
|
||||||
|
#include <QPainter>
|
||||||
|
#include <QMouseEvent>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QFont>
|
||||||
|
#include <qdebug.h>
|
||||||
|
const int fontSize = 80;
|
||||||
|
SlidePickerBox::SlidePickerBox(QWidget *parent):QWidget(parent) {
|
||||||
|
this->setFixedHeight(360);
|
||||||
|
|
||||||
|
QLabel* label = new QLabel(this);
|
||||||
|
label->setText("1");
|
||||||
|
label->setFixedHeight(110);
|
||||||
|
label->setAlignment(Qt::AlignCenter);
|
||||||
|
label->setObjectName("sliderPickerLabel");
|
||||||
|
label->setFixedHeight(fontSize);
|
||||||
|
label->setFixedWidth(320);
|
||||||
|
QPoint p = this->mapToGlobal({this->contentsMargins().left(),50-fontSize/2});
|
||||||
|
label->move(p);
|
||||||
|
lbls.push_back(label);
|
||||||
|
QLabel* label1 = new QLabel(this);
|
||||||
|
label1->setText("2");
|
||||||
|
label1->setFixedHeight(110);
|
||||||
|
label1->setAlignment(Qt::AlignCenter);
|
||||||
|
label1->setObjectName("sliderPickerLabel");
|
||||||
|
label1->setFixedHeight(fontSize);
|
||||||
|
label1->setFixedWidth(320);
|
||||||
|
QPoint p1 = this->mapToGlobal({this->contentsMargins().left(),150-fontSize/2});
|
||||||
|
label1->move(p1);
|
||||||
|
lbls.push_back(label1);
|
||||||
|
QLabel* label2 = new QLabel(this);
|
||||||
|
label2->setText("3");
|
||||||
|
label2->setFixedHeight(110);
|
||||||
|
label2->setAlignment(Qt::AlignCenter);
|
||||||
|
label2->setObjectName("sliderPickerLabel");
|
||||||
|
label2->setFixedHeight(fontSize);
|
||||||
|
label2->setFixedWidth(320);
|
||||||
|
QPoint p2 = this->mapToGlobal({this->contentsMargins().left(),250-fontSize/2});
|
||||||
|
label2->move(p2);
|
||||||
|
lbls.push_back(label2);
|
||||||
|
|
||||||
|
selectedLbl = label1;
|
||||||
|
label1->setStyleSheet("color:white");
|
||||||
|
label->setStyleSheet("background:transparent");
|
||||||
|
label2->setStyleSheet("background:transparent" );
|
||||||
|
QWidget* line1 = new QWidget(this);
|
||||||
|
line1->setFixedSize(320,100);
|
||||||
|
line1->setObjectName("topBottomLine");
|
||||||
|
line1->raise();
|
||||||
|
QPoint lp = this->mapToGlobal({this->contentsMargins().left(),100});
|
||||||
|
line1->move(lp);
|
||||||
|
|
||||||
|
selectedIndex = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SlidePickerBox::mousePressEvent(QMouseEvent * ev) {
|
||||||
|
isDragging = true;
|
||||||
|
o_x = ev->pos().x();
|
||||||
|
o_y = ev->pos().y();
|
||||||
|
QWidget::mousePressEvent( ev);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SlidePickerBox::mouseMoveEvent(QMouseEvent *ev) {
|
||||||
|
if(lbls.count()<2) return;
|
||||||
|
if(isDragging)
|
||||||
|
{
|
||||||
|
int offset = (ev->pos().y()-o_y);
|
||||||
|
//防止速度过快
|
||||||
|
while(abs(offset)>50)
|
||||||
|
{
|
||||||
|
offset=offset/2;
|
||||||
|
}
|
||||||
|
//防止拉过头
|
||||||
|
int selectItemCenter = selectedLbl->geometry().center().y();
|
||||||
|
if (selectedLbl == lbls.last() && selectItemCenter<=150 && offset<0) return;
|
||||||
|
if (selectedLbl == lbls.first() && selectItemCenter>=150 && offset>0) return;
|
||||||
|
int i = 0;
|
||||||
|
for (auto item : lbls)
|
||||||
|
{
|
||||||
|
//不需要横向
|
||||||
|
//int nx = item->geometry().left()+(ev->pos().x()-o_x);
|
||||||
|
int ny = item->geometry().top() + offset;
|
||||||
|
|
||||||
|
item->move(item->geometry().left(),ny);
|
||||||
|
int nc = item->geometry().center().y();
|
||||||
|
|
||||||
|
if (nc<=200 && nc>100)
|
||||||
|
{
|
||||||
|
item->setStyleSheet("color:white");
|
||||||
|
selectedLbl = item;
|
||||||
|
selectedIndex = i;
|
||||||
|
} else{
|
||||||
|
item->setStyleSheet("background:transparent");
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
o_x = ev->pos().x();
|
||||||
|
o_y = ev->pos().y();
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
|
QWidget::mouseMoveEvent(ev);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SlidePickerBox::mouseReleaseEvent(QMouseEvent *ev) {
|
||||||
|
isDragging = false;
|
||||||
|
adjustPositon();
|
||||||
|
QWidget::mouseReleaseEvent(ev);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SlidePickerBox::adjustPositon() const {
|
||||||
|
if (selectedLbl->geometry().center().y() != 150)
|
||||||
|
{
|
||||||
|
//选择完毕,选中项回归正位
|
||||||
|
|
||||||
|
int offset = 150 - selectedLbl->geometry().center().y();
|
||||||
|
for (auto item : lbls)
|
||||||
|
{
|
||||||
|
int ny = item->geometry().top()+offset;
|
||||||
|
item->move(item->geometry().left(),ny);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SlidePickerBox::paintEvent(QPaintEvent *ev) {
|
||||||
|
QWidget::paintEvent(ev);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SlidePickerBox::paintText(QString txt, int x, int y, const QColor& color) {
|
||||||
|
QPainter painter(this);
|
||||||
|
painter.setRenderHint(QPainter::TextAntialiasing, true);
|
||||||
|
QFont f;
|
||||||
|
f.setPixelSize(30);
|
||||||
|
painter.setFont(f);
|
||||||
|
painter.setPen(color);
|
||||||
|
painter.drawText(x,y,txt);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SlidePickerBox::setItems(QStringList itemsList) {
|
||||||
|
this->items = itemsList;
|
||||||
|
hideLabel(selectedLbl);
|
||||||
|
hideLabel(prevLbl);
|
||||||
|
hideLabel(nextLbl);
|
||||||
|
for (auto item : lbls)
|
||||||
|
{
|
||||||
|
delete item;
|
||||||
|
}
|
||||||
|
selectedLbl = nullptr;
|
||||||
|
prevLbl = nullptr;
|
||||||
|
nextLbl = nullptr;
|
||||||
|
lbls.clear();
|
||||||
|
|
||||||
|
for (QString str : this->items)
|
||||||
|
{
|
||||||
|
QLabel* lbl = new QLabel(this);
|
||||||
|
lbl->setText(str);
|
||||||
|
lbl->setFixedHeight(110);
|
||||||
|
lbl->setAlignment(Qt::AlignCenter);
|
||||||
|
lbl->setObjectName("sliderPickerLabel");
|
||||||
|
lbl->setFixedHeight(fontSize);
|
||||||
|
lbl->setFixedWidth(320);
|
||||||
|
lbls.push_back(lbl);
|
||||||
|
QPoint p = this->mapToGlobal({this->contentsMargins().left(),-150});
|
||||||
|
lbl->move(p);
|
||||||
|
}
|
||||||
|
selectedIndex = lbls.count()-1;
|
||||||
|
setSelectedValue(this->items.last());
|
||||||
|
}
|
||||||
|
|
||||||
|
QString SlidePickerBox::getSelectedValue() {
|
||||||
|
if (!selectedLbl) return "";
|
||||||
|
return selectedLbl->text();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SlidePickerBox::setCurrentLabel(QLabel *label) {
|
||||||
|
if (selectedLbl)hideLabel(selectedLbl);
|
||||||
|
if (label) {
|
||||||
|
QPoint lp = this->mapToGlobal({this->contentsMargins().left(), 100});
|
||||||
|
label->move(lp);
|
||||||
|
label->show();
|
||||||
|
selectedLbl = label;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SlidePickerBox::setNextLabel(QLabel *label) {
|
||||||
|
if (nextLbl)hideLabel(nextLbl);
|
||||||
|
if (label){
|
||||||
|
QPoint lp = this->mapToGlobal({this->contentsMargins().left(),200});
|
||||||
|
label->move(lp);
|
||||||
|
label->show();
|
||||||
|
nextLbl = label;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SlidePickerBox::setPrevLabel(QLabel *label) {
|
||||||
|
if (prevLbl)hideLabel(prevLbl);
|
||||||
|
if (label) {
|
||||||
|
QPoint lp = this->mapToGlobal({this->contentsMargins().left(), 0});
|
||||||
|
label->move(lp);
|
||||||
|
label->show();
|
||||||
|
prevLbl = label;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SlidePickerBox::hideLabel(QLabel *label) {
|
||||||
|
if (!label) return;
|
||||||
|
QPoint lp = this->mapToGlobal({this->contentsMargins().left(), -150});
|
||||||
|
label->move(lp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SlidePickerBox::setSelectedValue(QString& val) {
|
||||||
|
qDebug()<<"set value:"<<val;
|
||||||
|
for (int i = 0; i < lbls.count() ; ++i) {
|
||||||
|
if(lbls[i]->text() == val) {
|
||||||
|
selectedIndex = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int first_y = -100 * (selectedIndex-1);
|
||||||
|
for (int i = 0; i < lbls.count() ; ++i) {
|
||||||
|
QPoint lp = {this->contentsMargins().left(), first_y+i*100};
|
||||||
|
lbls[i]->move(lp);
|
||||||
|
lbls[i]->show();
|
||||||
|
lbls[i]->setStyleSheet("background:transparent");
|
||||||
|
lbls[i]->lower();
|
||||||
|
}
|
||||||
|
selectedLbl = lbls[selectedIndex];
|
||||||
|
lbls[selectedIndex]->setStyleSheet("color:white");
|
||||||
|
adjustPositon();
|
||||||
|
}
|
||||||
|
|
||||||
52
src/components/SlidePickerBox.h
Normal file
52
src/components/SlidePickerBox.h
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
//
|
||||||
|
// Created by Krad on 2021/11/24.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef GUI_SLIDEPICKERBOX_H
|
||||||
|
#define GUI_SLIDEPICKERBOX_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
class QLabel;
|
||||||
|
class SlidePickerBox:public QWidget {
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit SlidePickerBox(QWidget *parent = nullptr);
|
||||||
|
QString getSelectedValue();
|
||||||
|
void setItems(QStringList itemsList);
|
||||||
|
void addItem(QString& item)
|
||||||
|
{
|
||||||
|
this->items.append(item);
|
||||||
|
}
|
||||||
|
void setSelectedValue(QString& val);
|
||||||
|
protected:
|
||||||
|
|
||||||
|
bool isDragging;
|
||||||
|
// QPropertyAnimation *homingAni;
|
||||||
|
|
||||||
|
void mousePressEvent(QMouseEvent * ev) override ;
|
||||||
|
void mouseMoveEvent(QMouseEvent * ev) override ;
|
||||||
|
void mouseReleaseEvent(QMouseEvent * ev) override ;
|
||||||
|
void paintEvent(QPaintEvent * ev) override ;
|
||||||
|
void paintText(QString txt,int x, int y, const QColor& color);
|
||||||
|
void paintText(QString txt,int x, int y){
|
||||||
|
paintText(txt, x, y, QColor(0,0,0));
|
||||||
|
}
|
||||||
|
void setCurrentLabel(QLabel* label);
|
||||||
|
|
||||||
|
void setPrevLabel(QLabel* label);
|
||||||
|
void setNextLabel(QLabel* label);
|
||||||
|
void hideLabel(QLabel* label);
|
||||||
|
private:
|
||||||
|
int o_x=0,o_y=10;
|
||||||
|
int selectedIndex = -1;
|
||||||
|
QLabel* selectedLbl = nullptr;
|
||||||
|
QLabel* prevLbl = nullptr;
|
||||||
|
QLabel* nextLbl = nullptr;
|
||||||
|
QList<QLabel*> lbls;
|
||||||
|
QStringList items;
|
||||||
|
|
||||||
|
void adjustPositon() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif //GUI_SLIDEPICKERBOX_H
|
||||||
@@ -6,6 +6,7 @@
|
|||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
SlideableTableView::SlideableTableView(QWidget *parent) : QTableView(parent) {
|
SlideableTableView::SlideableTableView(QWidget *parent) : QTableView(parent) {
|
||||||
|
|
||||||
|
|||||||
@@ -5,13 +5,15 @@
|
|||||||
#include <QtCore/QFile>
|
#include <QtCore/QFile>
|
||||||
#include <QtCore/QTextStream>
|
#include <QtCore/QTextStream>
|
||||||
#include "LogFileTableModel.h"
|
#include "LogFileTableModel.h"
|
||||||
|
#include <qDebug>
|
||||||
|
|
||||||
LogFileTableModel::LogFileTableModel(QObject *parent) : QAbstractTableModel(parent) {
|
LogFileTableModel::LogFileTableModel(QObject *parent) : QAbstractTableModel(parent) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LogFileTableModel::setFileName(QString fileName) {
|
void LogFileTableModel::setFileName(QString fileName) {
|
||||||
logdata.clear();
|
if (!logdata.isEmpty())logdata.clear();
|
||||||
|
qDebug()<<fileName;
|
||||||
QFile f;
|
QFile f;
|
||||||
f.setFileName(fileName);
|
f.setFileName(fileName);
|
||||||
if (!f.exists()) return;
|
if (!f.exists()) return;
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ void UserOperationLog::init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const char space = ' ';
|
const char space = ' ';
|
||||||
QString addSpace(char* str)
|
QString addSpace(const char* str)
|
||||||
{
|
{
|
||||||
QString s;
|
QString s;
|
||||||
|
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ int main(int argc, char* argv[])
|
|||||||
a.installEventFilter(obj);
|
a.installEventFilter(obj);
|
||||||
SQLHelper::Open();
|
SQLHelper::Open();
|
||||||
MainWindow w;
|
MainWindow w;
|
||||||
|
UserOperationLog::Default()->init();
|
||||||
QObject::connect(obj, SIGNAL(touchScreen()), &w, SLOT(refreshTimer()));
|
QObject::connect(obj, SIGNAL(touchScreen()), &w, SLOT(refreshTimer()));
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user