diff --git a/src/ui/FortFirewallUI.pro b/src/ui/FortFirewallUI.pro index 8cee13c7..37014338 100644 --- a/src/ui/FortFirewallUI.pro +++ b/src/ui/FortFirewallUI.pro @@ -47,6 +47,7 @@ SOURCES += \ form/controls/labeldoublespin.cpp \ form/controls/labelspin.cpp \ form/controls/labelspincombo.cpp \ + form/controls/lineedit.cpp \ form/controls/listview.cpp \ form/controls/mainwindow.cpp \ form/controls/menuwidget.cpp \ @@ -258,6 +259,7 @@ HEADERS += \ form/controls/labeldoublespin.h \ form/controls/labelspin.h \ form/controls/labelspincombo.h \ + form/controls/lineedit.h \ form/controls/listview.h \ form/controls/mainwindow.h \ form/controls/menuwidget.h \ diff --git a/src/ui/form/controls/appinforow.cpp b/src/ui/form/controls/appinforow.cpp index 074033da..1fba4574 100644 --- a/src/ui/form/controls/appinforow.cpp +++ b/src/ui/form/controls/appinforow.cpp @@ -58,7 +58,6 @@ void AppInfoRow::refreshAppInfoVersion(const QString &appPath, AppInfoCache *app m_filePath = appInfo.filePath(appPath); m_lineAppPath->setText(appPath); - m_lineAppPath->setToolTip(appPath); m_labelAppProductName->setVisible(!appInfo.productName.isEmpty()); m_labelAppProductName->setText(appInfo.productName + ' ' + appInfo.productVersion); diff --git a/src/ui/form/controls/controlutil.cpp b/src/ui/form/controls/controlutil.cpp index 97815eb3..f90775e4 100644 --- a/src/ui/form/controls/controlutil.cpp +++ b/src/ui/form/controls/controlutil.cpp @@ -4,7 +4,6 @@ #include #include #include -#include #include #include #include @@ -19,6 +18,7 @@ #include "labeldoublespin.h" #include "labelspin.h" #include "labelspincombo.h" +#include "lineedit.h" #include "menuwidget.h" #include "sidebutton.h" #include "spinbox.h" @@ -188,7 +188,7 @@ QLabel *ControlUtil::createLabel(const QString &text) QLineEdit *ControlUtil::createLineLabel() { - auto c = new QLineEdit(); + auto c = new LineEdit(); c->setReadOnly(true); c->setFrame(false); diff --git a/src/ui/form/controls/lineedit.cpp b/src/ui/form/controls/lineedit.cpp new file mode 100644 index 00000000..17f466ba --- /dev/null +++ b/src/ui/form/controls/lineedit.cpp @@ -0,0 +1,16 @@ +#include "lineedit.h" + +#include + +LineEdit::LineEdit(QWidget *parent) : QLineEdit(parent) { } + +bool LineEdit::event(QEvent *event) +{ + switch (event->type()) { + case QEvent::ToolTip: { + setToolTip(text()); + } break; + } + + return QWidget::event(event); +} diff --git a/src/ui/form/controls/lineedit.h b/src/ui/form/controls/lineedit.h new file mode 100644 index 00000000..0a9ae2d7 --- /dev/null +++ b/src/ui/form/controls/lineedit.h @@ -0,0 +1,16 @@ +#ifndef LINEEDIT_H +#define LINEEDIT_H + +#include + +class LineEdit : public QLineEdit +{ + Q_OBJECT + +public: + explicit LineEdit(QWidget *parent = nullptr); + + bool event(QEvent *event) override; +}; + +#endif // LINEEDIT_H diff --git a/src/ui/form/opt/pages/applicationspage.cpp b/src/ui/form/opt/pages/applicationspage.cpp index 70759179..8249d0f5 100644 --- a/src/ui/form/opt/pages/applicationspage.cpp +++ b/src/ui/form/opt/pages/applicationspage.cpp @@ -3,7 +3,6 @@ #include #include #include -#include #include #include #include @@ -19,6 +18,7 @@ #include
#include #include +#include #include #include #include @@ -249,7 +249,7 @@ QLayout *ApplicationsPage::setupHeader() { auto layout = new QHBoxLayout(); - m_editGroupName = new QLineEdit(); + m_editGroupName = new LineEdit(); m_editGroupName->setClearButtonEnabled(true); m_editGroupName->setMaxLength(128); m_editGroupName->setFixedWidth(200); diff --git a/src/ui/form/opt/pages/applicationspage.h b/src/ui/form/opt/pages/applicationspage.h index c67da3c0..aab55bc7 100644 --- a/src/ui/form/opt/pages/applicationspage.h +++ b/src/ui/form/opt/pages/applicationspage.h @@ -9,6 +9,7 @@ class CheckSpinCombo; class CheckTimePeriod; class LabelDoubleSpin; class LabelSpin; +class LineEdit; class TabBar; class TextArea2Splitter; @@ -71,7 +72,7 @@ private: private: int m_appGroupIndex = -1; - QLineEdit *m_editGroupName = nullptr; + LineEdit *m_editGroupName = nullptr; QToolButton *m_btAddGroup = nullptr; QToolButton *m_btRenameGroup = nullptr; TabBar *m_tabBar = nullptr; diff --git a/src/ui/form/prog/programeditdialog.cpp b/src/ui/form/prog/programeditdialog.cpp index 31380f25..f0889a1b 100644 --- a/src/ui/form/prog/programeditdialog.cpp +++ b/src/ui/form/prog/programeditdialog.cpp @@ -6,7 +6,6 @@ #include #include #include -#include #include #include #include @@ -17,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -410,7 +410,7 @@ QLayout *ProgramEditDialog::setupFormLayout() QLayout *ProgramEditDialog::setupPathLayout() { // Path - m_editPath = new QLineEdit(); + m_editPath = new LineEdit(); m_editPath->setMaxLength(1024); // Wildcard @@ -450,7 +450,7 @@ QLayout *ProgramEditDialog::setupPathLayout() QLayout *ProgramEditDialog::setupNameLayout() { - m_editName = new QLineEdit(); + m_editName = new LineEdit(); m_editName->setMaxLength(1024); m_btGetName = ControlUtil::createIconToolButton( @@ -592,7 +592,7 @@ QLayout *ProgramEditDialog::setupZonesRuleLayout() QLayout *ProgramEditDialog::setupRuleLayout() { - m_editRuleName = new QLineEdit(); + m_editRuleName = new LineEdit(); m_editRuleName->setFocusPolicy(Qt::NoFocus); m_editRuleName->setContextMenuPolicy(Qt::PreventContextMenu); m_editRuleName->setMaximumWidth(300); diff --git a/src/ui/form/prog/programeditdialog.h b/src/ui/form/prog/programeditdialog.h index f7961ae6..830f7f0e 100644 --- a/src/ui/form/prog/programeditdialog.h +++ b/src/ui/form/prog/programeditdialog.h @@ -10,7 +10,6 @@ QT_FORWARD_DECLARE_CLASS(QComboBox) QT_FORWARD_DECLARE_CLASS(QDateTimeEdit) QT_FORWARD_DECLARE_CLASS(QFrame) QT_FORWARD_DECLARE_CLASS(QLabel) -QT_FORWARD_DECLARE_CLASS(QLineEdit) QT_FORWARD_DECLARE_CLASS(QPushButton) QT_FORWARD_DECLARE_CLASS(QRadioButton) QT_FORWARD_DECLARE_CLASS(QToolButton) @@ -20,11 +19,12 @@ class ConfManager; class FirewallConf; class FortManager; class IniUser; +class LineEdit; class PlainTextEdit; class ProgramsController; class SpinCombo; -class ZonesSelector; class WindowManager; +class ZonesSelector; class ProgramEditDialog : public WidgetWindow { @@ -107,11 +107,11 @@ private: ProgramsController *m_ctrl = nullptr; QLabel *m_labelEditPath = nullptr; - QLineEdit *m_editPath = nullptr; + LineEdit *m_editPath = nullptr; PlainTextEdit *m_editWildcard = nullptr; QToolButton *m_btSelectFile = nullptr; QLabel *m_labelEditName = nullptr; - QLineEdit *m_editName = nullptr; + LineEdit *m_editName = nullptr; QToolButton *m_btGetName = nullptr; QLabel *m_labelEditNotes = nullptr; PlainTextEdit *m_editNotes = nullptr; @@ -129,7 +129,7 @@ private: QCheckBox *m_cbLogConn = nullptr; QCheckBox *m_cbLanOnly = nullptr; ZonesSelector *m_btZones = nullptr; - QLineEdit *m_editRuleName = nullptr; + LineEdit *m_editRuleName = nullptr; QToolButton *m_btSelectRule = nullptr; QCheckBox *m_cbSchedule = nullptr; QComboBox *m_comboScheduleAction = nullptr; diff --git a/src/ui/form/rule/ruleeditdialog.cpp b/src/ui/form/rule/ruleeditdialog.cpp index 1b085296..1bd6b931 100644 --- a/src/ui/form/rule/ruleeditdialog.cpp +++ b/src/ui/form/rule/ruleeditdialog.cpp @@ -5,13 +5,13 @@ #include #include #include -#include #include #include #include #include #include +#include #include #include #include @@ -174,7 +174,7 @@ QLayout *RuleEditDialog::setupFormLayout() layout->setHorizontalSpacing(10); // Name - m_editName = new QLineEdit(); + m_editName = new LineEdit(); m_editName->setMaxLength(1024); layout->addRow("Name:", m_editName); diff --git a/src/ui/form/rule/ruleeditdialog.h b/src/ui/form/rule/ruleeditdialog.h index 29058987..06d097cf 100644 --- a/src/ui/form/rule/ruleeditdialog.h +++ b/src/ui/form/rule/ruleeditdialog.h @@ -8,11 +8,11 @@ QT_FORWARD_DECLARE_CLASS(QCheckBox) QT_FORWARD_DECLARE_CLASS(QComboBox) QT_FORWARD_DECLARE_CLASS(QLabel) -QT_FORWARD_DECLARE_CLASS(QLineEdit) QT_FORWARD_DECLARE_CLASS(QPushButton) QT_FORWARD_DECLARE_CLASS(QRadioButton) class ConfRuleManager; +class LineEdit; class PlainTextEdit; class Rule; class RulesController; @@ -59,7 +59,7 @@ private: RulesController *m_ctrl = nullptr; QLabel *m_labelEditName = nullptr; - QLineEdit *m_editName = nullptr; + LineEdit *m_editName = nullptr; QLabel *m_labelEditNotes = nullptr; PlainTextEdit *m_editNotes = nullptr; QLabel *m_labelRuleType = nullptr; diff --git a/src/ui/form/zone/zoneeditdialog.cpp b/src/ui/form/zone/zoneeditdialog.cpp index 7eaaff05..9bdbc8dd 100644 --- a/src/ui/form/zone/zoneeditdialog.cpp +++ b/src/ui/form/zone/zoneeditdialog.cpp @@ -5,11 +5,11 @@ #include #include #include -#include #include #include #include +#include #include #include #include @@ -140,7 +140,7 @@ QLayout *ZoneEditDialog::setupNameLayout() auto layout = new QFormLayout(); // Name - m_editName = new QLineEdit(); + m_editName = new LineEdit(); m_editName->setMaxLength(256); layout->addRow("Name:", m_editName); @@ -196,7 +196,7 @@ QLayout *ZoneEditDialog::setupUrlLayout() formLayout->addRow(QString(), m_cbCustomUrl); // URL - m_editUrl = new QLineEdit(); + m_editUrl = new LineEdit(); m_editUrl->setEnabled(false); m_editUrl->setMaxLength(1024); @@ -204,7 +204,7 @@ QLayout *ZoneEditDialog::setupUrlLayout() m_labelUrl = ControlUtil::formRowLabel(formLayout, m_editUrl); // Form Data - m_editFormData = new QLineEdit(); + m_editFormData = new LineEdit(); m_editFormData->setEnabled(false); formLayout->addRow("Form Data:", m_editFormData); diff --git a/src/ui/form/zone/zoneeditdialog.h b/src/ui/form/zone/zoneeditdialog.h index 750e3875..ebfcac54 100644 --- a/src/ui/form/zone/zoneeditdialog.h +++ b/src/ui/form/zone/zoneeditdialog.h @@ -9,9 +9,9 @@ QT_FORWARD_DECLARE_CLASS(QCheckBox) QT_FORWARD_DECLARE_CLASS(QComboBox) QT_FORWARD_DECLARE_CLASS(QFrame) QT_FORWARD_DECLARE_CLASS(QLabel) -QT_FORWARD_DECLARE_CLASS(QLineEdit) QT_FORWARD_DECLARE_CLASS(QPushButton) +class LineEdit; class PlainTextEdit; class Zone; class ZoneListModel; @@ -61,16 +61,16 @@ private: ZonesController *m_ctrl = nullptr; QLabel *m_labelName = nullptr; - QLineEdit *m_editName = nullptr; + LineEdit *m_editName = nullptr; QLabel *m_labelSource = nullptr; QCheckBox *m_cbEnabled = nullptr; QFrame *m_frameUrl = nullptr; QCheckBox *m_cbCustomUrl = nullptr; QComboBox *m_comboSources = nullptr; QLabel *m_labelUrl = nullptr; - QLineEdit *m_editUrl = nullptr; + LineEdit *m_editUrl = nullptr; QLabel *m_labelFormData = nullptr; - QLineEdit *m_editFormData = nullptr; + LineEdit *m_editFormData = nullptr; QFrame *m_frameText = nullptr; PlainTextEdit *m_editText = nullptr; QPushButton *m_btOk = nullptr;