1
0
mirror of https://gitee.com/drabel/LibQQt.git synced 2025-01-04 10:18:44 +08:00

add QQtNoFocusDelegate

This commit is contained in:
tianduanrui 2020-03-05 10:00:41 +08:00
parent b63b605195
commit 2f5e4b1256
12 changed files with 103 additions and 17 deletions

View File

@ -1,13 +1,25 @@
#include "qqtdicttreemodel.h"
#include "qqtcore.h"
#include "qqtdicttreemodel.h"
#include <QModelIndex>
#include <QFile>
#include "qqtcore.h"
QQtDictTreeModel::QQtDictTreeModel ( QObject* parent ) : QQtTreeModel ( parent )
{
}
void QQtDictTreeModel::setDictionary ( QQtDictionary* dict )
{
this->pdict = dict;
query ( "" );
}
QQtDictionary* QQtDictTreeModel::dictionary()
{
return pdict;
}
void QQtDictTreeModel::setFilePath ( QString dictfile )
{
QFile file ( dictfile );
@ -32,6 +44,11 @@ void QQtDictTreeModel::setFilePath ( QString dictfile )
return;
}
void QQtDictTreeModel::parseDictNodeToModel ( const QQtDictionary& node, QStandardItem& item )
{
}
bool QQtDictTreeModel::query ( QString condition )
{
Q_UNUSED ( condition )

View File

@ -1,4 +1,4 @@
#ifndef QQTDICTTREEMODEL_H
#ifndef QQTDICTTREEMODEL_H
#define QQTDICTTREEMODEL_H
#include <qqttreemodel.h>
@ -11,18 +11,26 @@ class QQTSHARED_EXPORT QQtDictTreeModel : public QQtTreeModel
public:
explicit QQtDictTreeModel ( QObject* parent = 0 );
//里面用的是外面的dictionary句柄所以外部句柄必须保持存在。
void setDictionary ( QQtDictionary* dict );
QQtDictionary* dictionary();
virtual bool query ( QString condition ) override;
signals:
public slots:
// QQtDictTreeModel interface
public:
bool query ( QString condition ) override;
void setFilePath ( QString dictfile ) override;
protected:
virtual void setFilePath ( QString dictfile ) override;
protected:
virtual void parseDictNodeToModel ( const QQtDictionary& node, QStandardItem& item );
private:
QQtDictionary* pdict;
};
#endif // QQTDICTTREEMODEL_H

View File

@ -1,8 +1,9 @@
#include "qqtfilesystemtreemodel.h"
#include "qqtfilesystemtreemodel.h"
#include <QFile>
#include "qqtcore.h"
#include <QModelIndex>
#include "qqtcore.h"
QQtFileSystemTreeModel::QQtFileSystemTreeModel ( QObject* parent ) : QFileSystemModel ( parent )
{

View File

@ -1,8 +1,7 @@
#ifndef QQTFILESYSTEMTREEMODEL_H
#ifndef QQTFILESYSTEMTREEMODEL_H
#define QQTFILESYSTEMTREEMODEL_H
#include <QFileSystemModel>
#include <QDomDocument>
#include <qqt-local.h>
/**
* @brief The QQtFileSystemTreeModel class

View File

@ -1,14 +1,19 @@
#ifndef QQTFTPTREEMODEL_H
#ifndef QQTFTPTREEMODEL_H
#define QQTFTPTREEMODEL_H
#include <QObject>
#include "qqt-local.h"
/**
* @brief The QQtFTPTreeModel class
* FTP解析到QQtDictionary里Model
*
*/
class QQTSHARED_EXPORT QQtFTPTreeModel : public QObject
{
Q_OBJECT
public:
explicit QQtFTPTreeModel(QObject* parent = 0);
explicit QQtFTPTreeModel ( QObject* parent = 0 );
signals:

View File

@ -1,10 +1,16 @@
#ifndef QQTJSONTREEMODEL_H
#ifndef QQTJSONTREEMODEL_H
#define QQTJSONTREEMODEL_H
#include <qqttreemodel.h>
#include <QDomDocument>
#include <qqt-local.h>
/**
* @brief The QQtJsonTreeModel class
* Json格式的内容解析到Tree里
*
* 使QQtDictTreeModel代替
*/
class QQTSHARED_EXPORT QQtJsonTreeModel : public QQtTreeModel
{
Q_OBJECT

View File

@ -0,0 +1,2 @@
#include <qqtnofocusdelegate.h>

View File

@ -0,0 +1,37 @@
#ifndef QQTNOFOCUSDELEGATE_H
#define QQTNOFOCUSDELEGATE_H
#include <QObject>
#include <QPainter>
#include <QModelIndex>
#include <QItemDelegate>
#include <QStyleOptionViewItem>
#include <qqt-local.h>
/**
* @brief The QQtNoFocusDelegate class
*/
class QQTSHARED_EXPORT QQtNoFocusDelegate : public QItemDelegate
{
Q_OBJECT
public:
explicit QQtNoFocusDelegate ( QObject* parent = 0 )
: QItemDelegate ( parent ) {}
virtual ~QQtNoFocusDelegate() {}
protected:
private:
// QItemDelegate interface
protected:
virtual void drawFocus ( QPainter* painter,
const QStyleOptionViewItem& option,
const QRect& rect ) const override {
}
};
#endif // QQTNOFOCUSDELEGATE_H

View File

@ -1,4 +1,4 @@
#ifndef QQTSQLTREEMODEL_H
#ifndef QQTSQLTREEMODEL_H
#define QQTSQLTREEMODEL_H
#include <qqttreemodel.h>
@ -16,7 +16,6 @@ class QQTSHARED_EXPORT QQtSqlTreeModel : public QQtTreeModel
public:
explicit QQtSqlTreeModel ( QObject* parent = 0 );
//TODO:
QSqlDatabase& database() { return m_db; }
void setAbsoluteFilePath ( QString dbname );

View File

@ -6,7 +6,7 @@
/**
* @brief The QQtTableModel class
* QQTSqlRelationalTableModel 便使model
* QSqlRelationalTableModel 便使model
*/
class QQTSHARED_EXPORT QQtTableModel : public QSqlRelationalTableModel
{

View File

@ -1,10 +1,16 @@
#ifndef QQTXMLTREEMODEL_H
#ifndef QQTXMLTREEMODEL_H
#define QQTXMLTREEMODEL_H
#include <qqttreemodel.h>
#include <QDomDocument>
#include <qqt-local.h>
/**
* @brief The QQtXmlTreeModel class
* XML格式的内容解析到Tree里
*
* 使QQtDictTreeModel代替
*/
class QQTSHARED_EXPORT QQtXmlTreeModel : public QQtTreeModel
{
Q_OBJECT

View File

@ -61,6 +61,12 @@ HEADERS += \
$$PWD/sql/qqtsqlquery.h
#gui
#add_object_class(QQtNoFocusDelegate, $$PWD/gui)
SOURCES += \
$$PWD/gui/qqtnofocusdelegate.cpp
HEADERS += \
$$PWD/gui/qqtnofocusdelegate.h
SOURCES += \
$$PWD/gui/qqttablemodel.cpp \
$$PWD/gui/qqtdicttreemodel.cpp \