43 setContentsMargins(0, 0, 0, 0);
46 value_.setSuffix(QString::fromUtf8(suffix));
48 connect(&
list_, SIGNAL(currentIndexChanged(
int)),
50 connect(&
list_, SIGNAL(editTextChanged(
const QString&)),
53 connect(&
value_, SIGNAL(editingFinished()),
57 #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) 58 layout_.setContentsMargins(0, 0, 0, 0);
70 list_.setEditable(value);
89 value_.setSingleStep(step);
100 for (
size_t i = 0; i < count; i++) {
101 char *
const s = sr_si_string_u64(vals[i],
suffix_);
102 list_.addItem(QString::fromUtf8(s), QVariant::fromValue(vals[i]));
115 const unsigned int FineScales[] = {1, 2, 5};
116 uint64_t
value, decade;
118 vector<uint64_t> values;
121 for (decade = 1; decade * 10 <=
min; decade *= 10);
124 for (fine = 0; fine <
countof(FineScales); fine++)
125 if (FineScales[fine] * decade >= min)
128 assert(fine <
countof(FineScales));
131 if (min != FineScales[fine] * decade)
132 values.push_back(min);
134 while ((value = FineScales[fine] * decade) < max) {
135 values.push_back(value);
136 if (++fine >=
countof(FineScales))
137 fine = 0, decade *= 10;
141 values.push_back(max);
144 uint64_t *
const values_array =
new uint64_t[values.size()];
145 copy(values.begin(), values.end(), values_array);
147 delete[] values_array;
156 return (uint64_t)
value_.value();
159 if (
list_.isEditable()) {
161 sr_parse_sizestring(
list_.currentText().toUtf8().data(), &
value);
165 const int index =
list_.currentIndex();
166 return (index >= 0) ?
list_.itemData(index).value<uint64_t>() : 0;
179 if (
list_.isEditable()) {
180 char *
const s = sr_si_string_u64(value,
suffix_);
181 list_.lineEdit()->setText(QString::fromUtf8(s));
184 int best_match =
list_.count() - 1;
185 int64_t best_variance = INT64_MAX;
187 for (
int i = 0; i <
list_.count(); i++) {
188 const int64_t this_variance = abs(
189 (int64_t)value -
list_.itemData(i).value<int64_t>());
190 if (this_variance < best_variance) {
191 best_variance = this_variance;
196 list_.setCurrentIndex(best_match);
T max(const T v0, const T v1)
T min(const T v0, const T v1)
it will come up with a session that has the demo device selected That you can get to know the program even when you don t have any hardware to use it you see a list of devices PulseView has recognized If the device you want to use is you can just select it here image::device_selector_dropdown png[] If it s not you ll need to scan for it first Since most serial port and Ethernet devices can t be auto this is usually required for those To do either choose the Connect to Device option from the list or click on the button itself You will see the following you ll need to pick a driver that you want to use In order to do this