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() {}
NavigationActionManager::NavigationActionManager(QObject *parent)
: QObject(parent)
, p(new PImpl(), [](PImpl *impl) { delete impl; })
, p(new PImpl(), deleter)
{
}
......
......@@ -15,12 +15,10 @@
#include <QLineEdit>
#include <QMenu>
#include <QMessageBox>
#include <QShortcut>
#include <QStandardItemModel>
#include <QTextDocument>
#include <QToolTip>
#include <QTreeView>
#include <QVBoxLayout>
#include <QtDebug>
namespace radix
......@@ -116,10 +114,9 @@ void NavigationWidget::contextMenuRequested(QPoint point)
void NavigationWidget::initLayout()
{
auto vlayout = new QVBoxLayout(this);
vlayout->addWidget(p->filter);
vlayout->addWidget(p->view);
mVertLayout = new QVBoxLayout(this);
mVertLayout->addWidget(p->filter);
mVertLayout->addWidget(p->view);
}
void NavigationWidget::initMembers()
......@@ -144,18 +141,18 @@ void NavigationWidget::initMembers()
p->proxy->setSourceModel(p->model);
// shortcuts
auto activateEnter = new QShortcut(p->view);
auto activateReturn = new QShortcut(p->view);
auto collapseBranch = new QShortcut(p->view);
mActivateEnter = new QShortcut(p->view);
mActivateReturn = new QShortcut(p->view);
mCollapseBranch = new QShortcut(p->view);
activateEnter->setContext(Qt::WidgetShortcut);
activateEnter->setKey(Qt::Key_Enter);
mActivateEnter->setContext(Qt::WidgetShortcut);
mActivateEnter->setKey(Qt::Key_Enter);
activateReturn->setContext(Qt::WidgetShortcut);
activateReturn->setKey(Qt::Key_Return);
mActivateReturn->setContext(Qt::WidgetShortcut);
mActivateReturn->setKey(Qt::Key_Return);
collapseBranch->setContext(Qt::WidgetShortcut);
collapseBranch->setKey(Qt::Key_Left);
mCollapseBranch->setContext(Qt::WidgetShortcut);
mCollapseBranch->setKey(Qt::Key_Left);
//
// connect signals/slots
......
#ifndef RADIX_RADIXWIDGETS_NAVIGATIONWIDGET_HH_
#define RADIX_RADIXWIDGETS_NAVIGATIONWIDGET_HH_
#include <QShortcut>
#include <QSortFilterProxyModel>
#include <QStandardItemModel>
#include <QStyledItemDelegate>
#include <QVBoxLayout>
#include <QWidget>
#include "radixcore/visibility.hh"
......@@ -69,6 +71,9 @@ class RADIX_PUBLIC NavigationWidget : public QWidget
void itemUnchecked(const QModelIndex& index);
private:
QVBoxLayout* mVertLayout;
QShortcut *mActivateEnter, *mActivateReturn, *mCollapseBranch;
void initLayout();
void initMembers();
......
......@@ -4,12 +4,9 @@
#include <QApplication>
#include <QDesktopWidget>
#include <QGridLayout>
#include <QKeyEvent>
#include <QPoint>
#include <QPushButton>
#include <QRect>
#include <QSignalMapper>
#define NEXT_ROW_MARKER 0
namespace radix
......@@ -53,12 +50,12 @@ QString keyToCharacter(int key)
NumberPadWidget::NumberPadWidget(QWidget *parent)
: QLineEdit(parent)
{
QSignalMapper *mapper = new QSignalMapper(this);
connect(mapper, SIGNAL(mapped(int)), SLOT(buttonClicked(int)));
mMapper = new QSignalMapper(this);
connect(mMapper, SIGNAL(mapped(int)), SLOT(buttonClicked(int)));
// add widget containing
mNumberWidget = new QWidget(this);
QGridLayout *numLayout = new QGridLayout(mNumberWidget);
mNumberWidget = new QWidget(this);
mNumLayout = new QGridLayout(mNumberWidget);
mNumberWidget->hide();
mNumberWidget->setWindowFlags(Qt::WindowDoesNotAcceptFocus | Qt::Tool |
......@@ -77,12 +74,12 @@ NumberPadWidget::NumberPadWidget(QWidget *parent)
col = 0;
continue;
}
QPushButton *button = new QPushButton(this);
button->setObjectName("number_pad_button");
button->setText(QString::fromLatin1(keyboardLayout[i].label));
mapper->setMapping(button, keyboardLayout[i].key);
connect(button, SIGNAL(clicked()), mapper, SLOT(map()));
numLayout->addWidget(button, row, col);
mButton = new QPushButton(this);
mButton->setObjectName("number_pad_button");
mButton->setText(QString::fromLatin1(keyboardLayout[i].label));
mMapper->setMapping(mButton, keyboardLayout[i].key);
connect(mButton, SIGNAL(clicked()), mMapper, SLOT(map()));
mNumLayout->addWidget(mButton, row, col);
col++;
}
}
......
#ifndef RADIX_RADIXWIDGETS_NUMBERPADWIDGET_HH_
#define RADIX_RADIXWIDGETS_NUMBERPADWIDGET_HH_
#include <QGridLayout>
#include <QLineEdit>
#include <QPushButton>
#include <QSignalMapper>
#include <QWidget>
#include "radixcore/visibility.hh"
......@@ -11,10 +14,13 @@ class RADIX_PUBLIC NumberPadWidget : public QLineEdit
{
Q_OBJECT
QSignalMapper* mMapper;
QWidget* mNumberWidget;
QGridLayout* mNumLayout;
QPushButton* mButton;
public:
NumberPadWidget(QWidget* parent = 0);
NumberPadWidget(QWidget* parent = nullptr);
public slots:
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