mirror of
https://github.com/zoriya/ComSquare.git
synced 2026-06-02 02:05:26 +00:00
Creating a custom dialog for the goto
This commit is contained in:
@@ -105,22 +105,17 @@ namespace ComSquare::Debugger
|
||||
|
||||
void MemoryViewer::gotoAddr()
|
||||
{
|
||||
QInputDialog dialog(this, Qt::WindowFlags());
|
||||
dialog.setWindowTitle("Go to:");
|
||||
dialog.setLabelText("Address");
|
||||
dialog.setIntRange(0, 0xFFFFFF);
|
||||
dialog.setIntValue(0);
|
||||
dialog.setIntStep(1);
|
||||
dialog.setWindowModality(Qt::WindowModal);
|
||||
QSpinBox *spinbox = dialog.findChild<QSpinBox*>();
|
||||
spinbox->setDisplayIntegerBase(16);
|
||||
QFont font = spinbox->font();
|
||||
QDialog dialog(this);
|
||||
Ui::GotoDialog dialogUI;
|
||||
dialogUI.setupUi(&dialog);
|
||||
QFont font = dialogUI.spinBox->font();
|
||||
font.setCapitalization(QFont::AllUppercase);
|
||||
spinbox->setFont(font);
|
||||
dialogUI.spinBox->setFont(font);
|
||||
dialogUI.spinBox->selectAll();
|
||||
|
||||
if (dialog.exec() != QDialog::Accepted)
|
||||
return;
|
||||
long value = std::strtol(spinbox->text().toStdString().c_str(), nullptr, 16);
|
||||
long value = std::strtol(dialogUI.spinBox->text().toStdString().c_str() + 1, nullptr, 16);
|
||||
QModelIndex index = this->_ui.tableView->model()->index(value >> 4, value & 0x0000000F);
|
||||
this->_ui.tableView->scrollTo(index);
|
||||
this->_ui.tableView->selectionModel()->select(index, QItemSelectionModel::ClearAndSelect);
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include <QtWidgets/QMainWindow>
|
||||
#include "../../ui/ui_ramView.h"
|
||||
#include "../../ui/ui_gotoDialog.h"
|
||||
#include "../Ram/Ram.hpp"
|
||||
#include <memory>
|
||||
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>GotoDialog</class>
|
||||
<widget class="QDialog" name="GotoDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>236</width>
|
||||
<height>103</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Go to:</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="../resources/appResources.qrc">
|
||||
<normaloff>:/resources/Logo.png</normaloff>:/resources/Logo.png</iconset>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Address</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QSpinBox" name="spinBox">
|
||||
<property name="inputMethodHints">
|
||||
<set>Qt::ImhDigitsOnly</set>
|
||||
</property>
|
||||
<property name="prefix">
|
||||
<string>$</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>16777215</number>
|
||||
</property>
|
||||
<property name="displayIntegerBase">
|
||||
<number>16</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QCheckBox" name="checkBox">
|
||||
<property name="text">
|
||||
<string>Absolute</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../resources/appResources.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>GotoDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>GotoDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
Reference in New Issue
Block a user