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"));
|
_period_label->setText(_view.get_measure("period"));
|
||||||
_freq_label->setText(_view.get_measure("frequency"));
|
_freq_label->setText(_view.get_measure("frequency"));
|
||||||
_duty_label->setText(_view.get_measure("duty"));
|
_duty_label->setText(_view.get_measure("duty"));
|
||||||
|
adjusLabelSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MeasureDock::build_dist_pannel()
|
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()
|
void MeasureDock::cursor_moving()
|
||||||
{
|
{
|
||||||
if (_view.cursors_shown()) {
|
if (_view.cursors_shown()) {
|
||||||
@@ -729,6 +735,8 @@ void MeasureDock::reCalc()
|
|||||||
cursor_update();
|
cursor_update();
|
||||||
update_dist();
|
update_dist();
|
||||||
update_edge();
|
update_edge();
|
||||||
|
|
||||||
|
adjusLabelSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MeasureDock::goto_cursor()
|
void MeasureDock::goto_cursor()
|
||||||
@@ -802,6 +810,8 @@ void MeasureDock::cursor_update()
|
|||||||
index++;
|
index++;
|
||||||
cursor_dex++;
|
cursor_dex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
adjusLabelSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MeasureDock::del_cursor()
|
void MeasureDock::del_cursor()
|
||||||
@@ -836,6 +846,8 @@ void MeasureDock::update_font()
|
|||||||
ui::set_form_font(this, font);
|
ui::set_form_font(this, font);
|
||||||
font.setPointSizeF(font.pointSizeF() + 1);
|
font.setPointSizeF(font.pointSizeF() + 1);
|
||||||
this->parentWidget()->setFont(font);
|
this->parentWidget()->setFont(font);
|
||||||
|
|
||||||
|
adjusLabelSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace dock
|
} // namespace dock
|
||||||
|
|||||||
@@ -100,6 +100,7 @@ private:
|
|||||||
private:
|
private:
|
||||||
QComboBox* create_probe_selector(QWidget *parent);
|
QComboBox* create_probe_selector(QWidget *parent);
|
||||||
void update_probe_selector(QComboBox *selector);
|
void update_probe_selector(QComboBox *selector);
|
||||||
|
void adjusLabelSize();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void goto_cursor();
|
void goto_cursor();
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
#include <QTextEdit>
|
#include <QTextEdit>
|
||||||
#include <QRadioButton>
|
#include <QRadioButton>
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
#include "../config/appconfig.h"
|
#include "../config/appconfig.h"
|
||||||
#include "../ui/xtoolbutton.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
|
} // namespace ui
|
||||||
@@ -37,6 +37,8 @@ namespace ui
|
|||||||
|
|
||||||
void set_form_font(QWidget *wid, QFont font);
|
void set_form_font(QWidget *wid, QFont font);
|
||||||
|
|
||||||
|
void adjust_form_size(QWidget *wid);
|
||||||
|
|
||||||
} // namespace ui
|
} // namespace ui
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
Reference in New Issue
Block a user