mirror of
https://github.com/DreamSourceLab/DSView.git
synced 2025-02-02 13:52:55 +08:00
add: keywordlineEdit class file
This commit is contained in:
parent
83a5708c8f
commit
470747cb89
@ -33,20 +33,23 @@
|
|||||||
namespace pv {
|
namespace pv {
|
||||||
namespace dialogs {
|
namespace dialogs {
|
||||||
|
|
||||||
DSDialog::DSDialog() : DSDialog(NULL, false, false)
|
DSDialog::DSDialog() :
|
||||||
|
DSDialog(NULL, false, false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
DSDialog::DSDialog(QWidget *parent): DSDialog(parent, false, false)
|
DSDialog::DSDialog(QWidget *parent):
|
||||||
|
DSDialog(parent, false, false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
DSDialog::DSDialog(QWidget *parent, bool hasClose): DSDialog(parent, hasClose, false)
|
DSDialog::DSDialog(QWidget *parent, bool hasClose):
|
||||||
|
DSDialog(parent, hasClose, false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
DSDialog::DSDialog(QWidget *parent, bool hasClose, bool bBaseButton) :
|
DSDialog::DSDialog(QWidget *parent, bool hasClose, bool bBaseButton) :
|
||||||
QDialog(NULL), //must be null, otherwise window can not able to move
|
QDialog(parent), //must be null, otherwise window can not able to move
|
||||||
m_bBaseButton(bBaseButton)
|
m_bBaseButton(bBaseButton)
|
||||||
{
|
{
|
||||||
(void)parent;
|
(void)parent;
|
||||||
|
48
DSView/pv/dock/keywordlineedit.cpp
Normal file
48
DSView/pv/dock/keywordlineedit.cpp
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the DSView project.
|
||||||
|
* DSView is based on PulseView.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022 DreamSourceLab <support@dreamsourcelab.com>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "keywordlineedit.h"
|
||||||
|
|
||||||
|
KeywordLineEdit::KeywordLineEdit(QComboBox *comboBox)
|
||||||
|
:QLineEdit()
|
||||||
|
{
|
||||||
|
assert(comboBox);
|
||||||
|
_comboBox = comboBox;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void KeywordLineEdit::focusInEvent(QFocusEvent *e)
|
||||||
|
{
|
||||||
|
QLineEdit::focusInEvent(e);
|
||||||
|
QString key(PROTOCOL_FIND_TITLE);
|
||||||
|
if (this->text() == key){
|
||||||
|
this->setText("");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void KeywordLineEdit::focusOutEvent(QFocusEvent *e)
|
||||||
|
{
|
||||||
|
QLineEdit::focusOutEvent(e);
|
||||||
|
|
||||||
|
if (this->text() == ""){
|
||||||
|
this->setText(PROTOCOL_FIND_TITLE);
|
||||||
|
}
|
||||||
|
}
|
48
DSView/pv/dock/keywordlineedit.h
Normal file
48
DSView/pv/dock/keywordlineedit.h
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the DSView project.
|
||||||
|
* DSView is based on PulseView.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022 DreamSourceLab <support@dreamsourcelab.com>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef KEY_WORD_LINE_EDIT_H
|
||||||
|
#define KEY_WORD_LINE_EDIT_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QLineEdit>
|
||||||
|
#include <QComboBox>
|
||||||
|
#include <QFocusEvent>
|
||||||
|
|
||||||
|
#define PROTOCOL_FIND_TITLE "Protocol search..."
|
||||||
|
|
||||||
|
class KeywordLineEdit : public QLineEdit
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
KeywordLineEdit(QComboBox *comboBox);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void focusInEvent(QFocusEvent *e) override;
|
||||||
|
void focusOutEvent(QFocusEvent *e) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
QComboBox *_comboBox;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
Loading…
x
Reference in New Issue
Block a user