Commit 0a636677 authored by Huff, Israel's avatar Huff, Israel
Browse files

Fortify changes

parent ad788bbc
Pipeline #67526 passed with stages
in 16 minutes and 31 seconds
...@@ -20,7 +20,7 @@ NavigationActionManager::PImpl::~PImpl() {} ...@@ -20,7 +20,7 @@ NavigationActionManager::PImpl::~PImpl() {}
NavigationActionManager::NavigationActionManager(QObject *parent) NavigationActionManager::NavigationActionManager(QObject *parent)
: QObject(parent) : QObject(parent)
, p(new PImpl(), [](PImpl *impl) { delete impl; }) , p(new PImpl(), deleter)
{ {
} }
......
...@@ -15,12 +15,10 @@ ...@@ -15,12 +15,10 @@
#include <QLineEdit> #include <QLineEdit>
#include <QMenu> #include <QMenu>
#include <QMessageBox> #include <QMessageBox>
#include <QShortcut>
#include <QStandardItemModel> #include <QStandardItemModel>
#include <QTextDocument> #include <QTextDocument>
#include <QToolTip> #include <QToolTip>
#include <QTreeView> #include <QTreeView>
#include <QVBoxLayout>
#include <QtDebug> #include <QtDebug>
namespace radix namespace radix
...@@ -116,10 +114,9 @@ void NavigationWidget::contextMenuRequested(QPoint point) ...@@ -116,10 +114,9 @@ void NavigationWidget::contextMenuRequested(QPoint point)
void NavigationWidget::initLayout() void NavigationWidget::initLayout()
{ {
auto vlayout = new QVBoxLayout(this); mVertLayout = new QVBoxLayout(this);
mVertLayout->addWidget(p->filter);
vlayout->addWidget(p->filter); mVertLayout->addWidget(p->view);
vlayout->addWidget(p->view);
} }
void NavigationWidget::initMembers() void NavigationWidget::initMembers()
...@@ -144,18 +141,18 @@ void NavigationWidget::initMembers() ...@@ -144,18 +141,18 @@ void NavigationWidget::initMembers()
p->proxy->setSourceModel(p->model); p->proxy->setSourceModel(p->model);
// shortcuts // shortcuts
auto activateEnter = new QShortcut(p->view); mActivateEnter = new QShortcut(p->view);
auto activateReturn = new QShortcut(p->view); mActivateReturn = new QShortcut(p->view);
auto collapseBranch = new QShortcut(p->view); mCollapseBranch = new QShortcut(p->view);
activateEnter->setContext(Qt::WidgetShortcut); mActivateEnter->setContext(Qt::WidgetShortcut);
activateEnter->setKey(Qt::Key_Enter); mActivateEnter->setKey(Qt::Key_Enter);
activateReturn->setContext(Qt::WidgetShortcut); mActivateReturn->setContext(Qt::WidgetShortcut);
activateReturn->setKey(Qt::Key_Return); mActivateReturn->setKey(Qt::Key_Return);
collapseBranch->setContext(Qt::WidgetShortcut); mCollapseBranch->setContext(Qt::WidgetShortcut);
collapseBranch->setKey(Qt::Key_Left); mCollapseBranch->setKey(Qt::Key_Left);
// //
// connect signals/slots // connect signals/slots
......
#ifndef RADIX_RADIXWIDGETS_NAVIGATIONWIDGET_HH_ #ifndef RADIX_RADIXWIDGETS_NAVIGATIONWIDGET_HH_
#define RADIX_RADIXWIDGETS_NAVIGATIONWIDGET_HH_ #define RADIX_RADIXWIDGETS_NAVIGATIONWIDGET_HH_
#include <QShortcut>
#include <QSortFilterProxyModel> #include <QSortFilterProxyModel>
#include <QStandardItemModel> #include <QStandardItemModel>
#include <QStyledItemDelegate> #include <QStyledItemDelegate>
#include <QVBoxLayout>
#include <QWidget> #include <QWidget>
#include "radixcore/visibility.hh" #include "radixcore/visibility.hh"
...@@ -69,6 +71,9 @@ class RADIX_PUBLIC NavigationWidget : public QWidget ...@@ -69,6 +71,9 @@ class RADIX_PUBLIC NavigationWidget : public QWidget
void itemUnchecked(const QModelIndex& index); void itemUnchecked(const QModelIndex& index);
private: private:
QVBoxLayout* mVertLayout;
QShortcut *mActivateEnter, *mActivateReturn, *mCollapseBranch;
void initLayout(); void initLayout();
void initMembers(); void initMembers();
......
...@@ -4,12 +4,9 @@ ...@@ -4,12 +4,9 @@
#include <QApplication> #include <QApplication>
#include <QDesktopWidget> #include <QDesktopWidget>
#include <QGridLayout>
#include <QKeyEvent> #include <QKeyEvent>
#include <QPoint> #include <QPoint>
#include <QPushButton>
#include <QRect> #include <QRect>
#include <QSignalMapper>
#define NEXT_ROW_MARKER 0 #define NEXT_ROW_MARKER 0
namespace radix namespace radix
...@@ -53,12 +50,12 @@ QString keyToCharacter(int key) ...@@ -53,12 +50,12 @@ QString keyToCharacter(int key)
NumberPadWidget::NumberPadWidget(QWidget *parent) NumberPadWidget::NumberPadWidget(QWidget *parent)
: QLineEdit(parent) : QLineEdit(parent)
{ {
QSignalMapper *mapper = new QSignalMapper(this); mMapper = new QSignalMapper(this);
connect(mapper, SIGNAL(mapped(int)), SLOT(buttonClicked(int))); connect(mMapper, SIGNAL(mapped(int)), SLOT(buttonClicked(int)));
// add widget containing // add widget containing
mNumberWidget = new QWidget(this); mNumberWidget = new QWidget(this);
QGridLayout *numLayout = new QGridLayout(mNumberWidget); mNumLayout = new QGridLayout(mNumberWidget);
mNumberWidget->hide(); mNumberWidget->hide();
mNumberWidget->setWindowFlags(Qt::WindowDoesNotAcceptFocus | Qt::Tool | mNumberWidget->setWindowFlags(Qt::WindowDoesNotAcceptFocus | Qt::Tool |
...@@ -77,12 +74,12 @@ NumberPadWidget::NumberPadWidget(QWidget *parent) ...@@ -77,12 +74,12 @@ NumberPadWidget::NumberPadWidget(QWidget *parent)
col = 0; col = 0;
continue; continue;
} }
QPushButton *button = new QPushButton(this); mButton = new QPushButton(this);
button->setObjectName("number_pad_button"); mButton->setObjectName("number_pad_button");
button->setText(QString::fromLatin1(keyboardLayout[i].label)); mButton->setText(QString::fromLatin1(keyboardLayout[i].label));
mapper->setMapping(button, keyboardLayout[i].key); mMapper->setMapping(mButton, keyboardLayout[i].key);
connect(button, SIGNAL(clicked()), mapper, SLOT(map())); connect(mButton, SIGNAL(clicked()), mMapper, SLOT(map()));
numLayout->addWidget(button, row, col); mNumLayout->addWidget(mButton, row, col);
col++; col++;
} }
} }
......
#ifndef RADIX_RADIXWIDGETS_NUMBERPADWIDGET_HH_ #ifndef RADIX_RADIXWIDGETS_NUMBERPADWIDGET_HH_
#define RADIX_RADIXWIDGETS_NUMBERPADWIDGET_HH_ #define RADIX_RADIXWIDGETS_NUMBERPADWIDGET_HH_
#include <QGridLayout>
#include <QLineEdit> #include <QLineEdit>
#include <QPushButton>
#include <QSignalMapper>
#include <QWidget> #include <QWidget>
#include "radixcore/visibility.hh" #include "radixcore/visibility.hh"
...@@ -11,10 +14,13 @@ class RADIX_PUBLIC NumberPadWidget : public QLineEdit ...@@ -11,10 +14,13 @@ class RADIX_PUBLIC NumberPadWidget : public QLineEdit
{ {
Q_OBJECT Q_OBJECT
QSignalMapper* mMapper;
QWidget* mNumberWidget; QWidget* mNumberWidget;
QGridLayout* mNumLayout;
QPushButton* mButton;
public: public:
NumberPadWidget(QWidget* parent = 0); NumberPadWidget(QWidget* parent = nullptr);
public slots: public slots:
void focusInEvent(QFocusEvent*) override; void focusInEvent(QFocusEvent*) override;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment