use dynamic casting
This commit is contained in:
parent
144051162d
commit
f3132e9315
|
@ -7,7 +7,7 @@
|
|||
#include "Bridge.h"
|
||||
#include "MiscUtil.h"
|
||||
|
||||
ReferenceView::ReferenceView(bool sourceView, QTabWidget* parent) : SearchListView(true, parent), mParent(parent)
|
||||
ReferenceView::ReferenceView(bool sourceView, QWidget* parent) : SearchListView(true, parent), mParent(dynamic_cast<QTabWidget*>(parent))
|
||||
{
|
||||
// Setup SearchListView settings
|
||||
mSearchStartCol = 1;
|
||||
|
@ -436,8 +436,11 @@ void ReferenceView::referenceExecCommand()
|
|||
|
||||
void ReferenceView::mouseReleaseEvent(QMouseEvent* event)
|
||||
{
|
||||
if(event->button() == Qt::ForwardButton)
|
||||
mParent->setCurrentIndex(std::min(mParent->currentIndex() + 1, mParent->count()));
|
||||
else if(event->button() == Qt::BackButton)
|
||||
mParent->setCurrentIndex(std::max(mParent->currentIndex() - 1, 0));
|
||||
if(mParent)
|
||||
{
|
||||
if(event->button() == Qt::ForwardButton)
|
||||
mParent->setCurrentIndex(std::min(mParent->currentIndex() + 1, mParent->count()));
|
||||
else if(event->button() == Qt::BackButton)
|
||||
mParent->setCurrentIndex(std::max(mParent->currentIndex() - 1, 0));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ class ReferenceView : public SearchListView
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ReferenceView(bool sourceView = false, QTabWidget* parent = nullptr);
|
||||
ReferenceView(bool sourceView = false, QWidget* parent = nullptr);
|
||||
void setupContextMenu();
|
||||
void connectBridge();
|
||||
void disconnectBridge();
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include <QDesktopServices>
|
||||
#include "Configuration.h"
|
||||
|
||||
SourceView::SourceView(QString path, int line, QTabWidget* parent)
|
||||
SourceView::SourceView(QString path, int line, QWidget* parent)
|
||||
: ReferenceView(true, parent),
|
||||
mIpLine(0)
|
||||
{
|
||||
|
|
|
@ -11,7 +11,7 @@ class SourceView : public ReferenceView
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit SourceView(QString path, int line = 0, QTabWidget* parent = 0);
|
||||
explicit SourceView(QString path, int line = 0, QWidget* parent = 0);
|
||||
QString getSourcePath();
|
||||
void setupContextMenu();
|
||||
void setSelection(int line);
|
||||
|
|
Loading…
Reference in New Issue