Centerize the indicator in the address maps in the Section Widget when seek changed (#956)

This commit is contained in:
Vanellope 2018-11-23 16:21:49 +09:00 committed by Itay Cohen
parent b606ece545
commit 58fcd70fd2
2 changed files with 9 additions and 8 deletions

View File

@ -267,6 +267,7 @@ void SectionsWidget::updateIndicator(SectionAddrDock *targetDock, QString name,
QGraphicsRectItem *indicator = new QGraphicsRectItem(QRectF(0, y, indicatorWidth, indicatorHeight));
indicator->setBrush(QBrush(color));
targetDock->graphicsScene->addItem(indicator);
targetDock->graphicsView->centerOn(indicator);
targetDock->addTextItem(color, QPoint(targetDock->rectOffset + targetDock->rectWidth, y - indicatorParamPosY), name);
targetDock->addTextItem(color, QPoint(0, y - indicatorParamPosY), QString("0x%1").arg(offset, 0, 16));

View File

@ -91,7 +91,13 @@ class SectionAddrDock : public QDockWidget
{
Q_OBJECT
public:
friend SectionsWidget;
private slots:
void updateDock();
void addTextItem(QColor color, QPoint pos, QString string);
private:
enum AddrType { Raw = 0, Virtual };
int heightThreshold;
int rectOffset;
@ -99,17 +105,11 @@ public:
QColor indicatorColor;
explicit SectionAddrDock(SectionsModel *model, AddrType type, QWidget *parent = nullptr);
QGraphicsScene *graphicsScene;
QGraphicsView *graphicsView;
SectionsProxyModel *proxyModel;
AddrType addrType;
QHash<QString, int> namePosYMap;
QHash<QString, int> nameHeightMap;
public slots:
void updateDock();
void addTextItem(QColor color, QPoint pos, QString string);
private:
QGraphicsView *graphicsView;
};
#endif // SECTIONSWIDGET_H