Skip to content

Commit 6ba7605

Browse files
committed
Automatically update the element count when the type is changed in the create array dialog. Fix #5284
1 parent 803ac2f commit 6ba7605

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

ui/createarraydialog.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ class CreateArrayDialog : public QDialog
1212
BinaryViewRef m_data;
1313

1414
uint64_t m_startAddress;
15+
size_t m_size;
1516
TypeRef m_elementType;
16-
uint64_t m_elementCount;
17+
uint64_t m_elementCount{};
1718

1819
QLineEdit* m_startField;
1920
QComboBox* m_typeDropdown;
@@ -22,15 +23,16 @@ class CreateArrayDialog : public QDialog
2223
QPushButton* m_cancelButton;
2324
QPushButton* m_createButton;
2425

25-
void validate();
26+
void update();
27+
size_t guessElementCount(size_t elementWidth);
2628

2729
public:
28-
explicit CreateArrayDialog(BinaryViewRef data, QWidget* parent = nullptr);
30+
explicit CreateArrayDialog(BinaryViewRef data, BNAddressRange selection, QWidget* parent = nullptr);
2931

3032
/// Set the initial start address, element type, and element count for
3133
/// the dialog. The element type may be null if no default is desired; a
3234
/// default will be chosen by the dialog.
33-
void setInitialState(uint64_t start, const TypeRef& elementType, uint64_t count);
35+
void setInitialState();
3436

3537
/// Get the desired start address from the accepted dialog.
3638
[[nodiscard]] uint64_t startAddress() const;

0 commit comments

Comments
 (0)