Optimized some inappropriate code.
This commit is contained in:
parent
8164757937
commit
4c0d791052
|
@ -272,7 +272,7 @@ void AppMatch::appNameMatch(QString appname,QMap<NameString,QStringList> &instal
|
|||
installed.insert(name,list);
|
||||
return;
|
||||
}
|
||||
for(int i;i<pinyinlist.size()/2;i++){
|
||||
for(int i = 0;i<pinyinlist.size()/2;i++){
|
||||
QString shouzimu=pinyinlist.at(2*i+1);// 中文转首字母
|
||||
if(shouzimu.contains(m_sourceText,Qt::CaseInsensitive)){
|
||||
// installed.insert(name,m_installAppMap.value(name));
|
||||
|
|
|
@ -53,13 +53,13 @@ ContentWidget::~ContentWidget()
|
|||
* @brief initUI 初始化homepage和resultpage
|
||||
*/
|
||||
void ContentWidget::initUI() {
|
||||
m_homePage = new QWidget;
|
||||
m_homePage = new QWidget(this);
|
||||
m_homePageLyt = new QVBoxLayout(m_homePage);
|
||||
m_homePageLyt->setSpacing(0);
|
||||
m_homePageLyt->setContentsMargins(0,0,0,0);
|
||||
m_homePage->setLayout(m_homePageLyt);
|
||||
|
||||
m_resultPage = new QWidget;
|
||||
m_resultPage = new QWidget(this);
|
||||
m_resultPageLyt = new QHBoxLayout(m_resultPage);
|
||||
m_resultPageLyt->setSpacing(0);
|
||||
m_resultPageLyt->setContentsMargins(0, 0, 0, 0);
|
||||
|
@ -74,7 +74,7 @@ void ContentWidget::initUI() {
|
|||
m_resultPageLyt->addWidget(m_resultDetailArea);
|
||||
m_resultPage->setLayout(m_resultPageLyt);
|
||||
|
||||
m_resultList = new QWidget(m_resultDetailArea);
|
||||
m_resultList = new QWidget(m_resultListArea);
|
||||
m_resultDetail = new QWidget(m_resultDetailArea);
|
||||
m_listLyt = new QVBoxLayout(m_resultList);
|
||||
m_detailLyt = new QVBoxLayout(m_resultDetail);
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include <QTextDocument>
|
||||
#include <QAbstractTextDocumentLayout>
|
||||
|
||||
HighlightItemDelegate::HighlightItemDelegate()
|
||||
HighlightItemDelegate::HighlightItemDelegate(QObject *parent) : QStyledItemDelegate (parent)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ class HighlightItemDelegate : public QStyledItemDelegate
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit HighlightItemDelegate();
|
||||
explicit HighlightItemDelegate(QObject *parent = nullptr);
|
||||
void setSearchKeyword(const QString &);
|
||||
private:
|
||||
QString m_regFindKeyWords = 0;
|
||||
|
|
|
@ -27,7 +27,7 @@ SearchListView::SearchListView(QWidget * parent, const QStringList& list, const
|
|||
this->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
m_model = new SearchItemModel;
|
||||
m_model = new SearchItemModel(this);
|
||||
m_item = new SearchItem;
|
||||
m_item->setSearchList(type, list);
|
||||
m_model->setItem(m_item);
|
||||
|
@ -40,7 +40,7 @@ SearchListView::SearchListView(QWidget * parent, const QStringList& list, const
|
|||
this->setAttribute(Qt::WA_TranslucentBackground, true);
|
||||
this->setAutoFillBackground(false);
|
||||
this->setStyleSheet("QWidget{background:transparent;}");
|
||||
m_styleDelegate = new HighlightItemDelegate();
|
||||
m_styleDelegate = new HighlightItemDelegate(this);
|
||||
// m_styleDelegate->setSearchKeyword(keyword);
|
||||
this->setItemDelegate(m_styleDelegate);
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include "search-item-model.h"
|
||||
#include <QDebug>
|
||||
|
||||
SearchItemModel::SearchItemModel()
|
||||
SearchItemModel::SearchItemModel(QObject *parent) : QAbstractItemModel (parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ class SearchItemModel : public QAbstractItemModel
|
|||
friend class SearchItem;
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit SearchItemModel();
|
||||
explicit SearchItemModel(QObject *parent = nullptr);
|
||||
~SearchItemModel();
|
||||
|
||||
enum SearchInfo {
|
||||
|
|
Loading…
Reference in New Issue