1
0
mirror of https://gitee.com/drabel/LibQQt.git synced 2025-01-04 10:18:44 +08:00
LibQQt/qqttableview.cpp
tianduanrui 3f857669fc init
2016-12-29 16:49:18 +08:00

51 lines
1.3 KiB
C++
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include "qqttableview.h"
#include "ui_qqttableview.h"
#include <QFile>
#include <QScrollBar>
#include <QSqlRelationalDelegate>
QQTTableView::QQTTableView(QWidget *parent) :
QTableView(parent),
ui(new Ui::QQTTableView)
{
ui->setupUi(this);
m_header = new QQTHeaderView(Qt::Horizontal, this);
m_vheader = new QQTHeaderView(Qt::Vertical, this);
setSelectionMode(QAbstractItemView::SingleSelection);
setSelectionBehavior(QAbstractItemView::SelectRows);
setEditTriggers(QAbstractItemView::NoEditTriggers);
//如果没有这个中介release版本无故会崩溃。
setItemDelegate(new QSqlRelationalDelegate(this));
#ifdef __MIPS_LINUX__
setFocusPolicy(Qt::NoFocus);
#endif
}
QQTTableView::~QQTTableView()
{
delete ui;
}
void QQTTableView::setQQTHeader()
{
setHorizontalHeader(m_header);
}
void QQTTableView::setQQTVHeader()
{
setVerticalHeader(m_vheader);
}
void QQTTableView::setObjectName(const QString &name)
{
QTableView::setObjectName(name);
horizontalHeader()->setObjectName(QString("%1_Header").arg(name));
verticalHeader()->setObjectName(QString("%1_VHeader").arg(name));
m_header->setObjectName(QString("%1_QQTHeader").arg(name));
m_vheader->setObjectName(QString("%1_QQTVHeader").arg(name));
}