forked from Ivasoft/DSView
fix: When using font sizes, the cursor information on the measurement panel may not be fully displayed
This commit is contained in:
@@ -235,6 +235,7 @@ void MeasureDock::measure_updated()
|
||||
_period_label->setText(_view.get_measure("period"));
|
||||
_freq_label->setText(_view.get_measure("frequency"));
|
||||
_duty_label->setText(_view.get_measure("duty"));
|
||||
adjusLabelSize();
|
||||
}
|
||||
|
||||
void MeasureDock::build_dist_pannel()
|
||||
@@ -702,6 +703,11 @@ void MeasureDock::update_probe_selector(QComboBox *selector)
|
||||
}
|
||||
}
|
||||
|
||||
void MeasureDock::adjusLabelSize()
|
||||
{
|
||||
ui::adjust_form_size(this);
|
||||
}
|
||||
|
||||
void MeasureDock::cursor_moving()
|
||||
{
|
||||
if (_view.cursors_shown()) {
|
||||
@@ -729,6 +735,8 @@ void MeasureDock::reCalc()
|
||||
cursor_update();
|
||||
update_dist();
|
||||
update_edge();
|
||||
|
||||
adjusLabelSize();
|
||||
}
|
||||
|
||||
void MeasureDock::goto_cursor()
|
||||
@@ -802,6 +810,8 @@ void MeasureDock::cursor_update()
|
||||
index++;
|
||||
cursor_dex++;
|
||||
}
|
||||
|
||||
adjusLabelSize();
|
||||
}
|
||||
|
||||
void MeasureDock::del_cursor()
|
||||
@@ -836,6 +846,8 @@ void MeasureDock::update_font()
|
||||
ui::set_form_font(this, font);
|
||||
font.setPointSizeF(font.pointSizeF() + 1);
|
||||
this->parentWidget()->setFont(font);
|
||||
|
||||
adjusLabelSize();
|
||||
}
|
||||
|
||||
} // namespace dock
|
||||
|
||||
@@ -100,6 +100,7 @@ private:
|
||||
private:
|
||||
QComboBox* create_probe_selector(QWidget *parent);
|
||||
void update_probe_selector(QComboBox *selector);
|
||||
void adjusLabelSize();
|
||||
|
||||
private slots:
|
||||
void goto_cursor();
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include <QTextEdit>
|
||||
#include <QRadioButton>
|
||||
#include <QCheckBox>
|
||||
#include <QDebug>
|
||||
|
||||
#include "../config/appconfig.h"
|
||||
#include "../ui/xtoolbutton.h"
|
||||
@@ -146,4 +147,40 @@ namespace ui
|
||||
}
|
||||
}
|
||||
|
||||
void adjust_form_size(QWidget *wid)
|
||||
{
|
||||
assert(wid);
|
||||
|
||||
auto labels = wid->findChildren<QLabel*>();
|
||||
for(auto o : labels)
|
||||
{
|
||||
QSize size = o->sizeHint();
|
||||
size.setWidth(size.width() + 5);
|
||||
o->setFixedSize(size);
|
||||
}
|
||||
|
||||
int groupMaxWith = 0;
|
||||
|
||||
auto groups = wid->findChildren<QGroupBox*>();
|
||||
for(auto o : groups)
|
||||
{
|
||||
QSize size = o->sizeHint();
|
||||
int w = size.width() + 5;
|
||||
if (w > groupMaxWith){
|
||||
groupMaxWith = w;
|
||||
}
|
||||
}
|
||||
|
||||
auto groups2 = wid->findChildren<QGroupBox*>();
|
||||
for(auto o : groups2)
|
||||
{
|
||||
o->setFixedWidth(groupMaxWith);
|
||||
|
||||
QWidget *parent = dynamic_cast<QWidget*>(o->parent());
|
||||
if (parent != NULL){
|
||||
parent->setFixedWidth(groupMaxWith + 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
@@ -37,6 +37,8 @@ namespace ui
|
||||
|
||||
void set_form_font(QWidget *wid, QFont font);
|
||||
|
||||
void adjust_form_size(QWidget *wid);
|
||||
|
||||
} // namespace ui
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user