2
0
forked from Ivasoft/DSView

fix: The toolbar text unable to fully display

This commit is contained in:
dreamsourcelabTAI
2023-05-08 18:56:44 +08:00
parent 5c286c09d7
commit abe91bcaac
6 changed files with 51 additions and 0 deletions

View File

@@ -116,6 +116,8 @@ void FileBar::retranslateUi()
_action_save->setText(L_S(STR_PAGE_TOOLBAR, S_ID(IDS_TOOLBAR_FILE_SAVE), "&Save..."));
_action_export->setText(L_S(STR_PAGE_TOOLBAR, S_ID(IDS_TOOLBAR_FILE_EXPORT), "&Export..."));
_action_capture->setText(L_S(STR_PAGE_TOOLBAR, S_ID(IDS_TOOLBAR_FILE_CAPTURE), "&Capture..."));
auto_resize();
}
void FileBar::reStyle()
@@ -253,5 +255,16 @@ void FileBar::update_view_status()
_menu_session->setEnabled(bEnable && is_hardware);
}
void FileBar::auto_resize()
{
std::vector<QToolButton*> wids;
wids.push_back(&_file_button);
for(auto bt : wids){
int w = bt->fontMetrics().boundingRect(bt->text()).width();
bt->setMinimumWidth(w+5);
}
}
} // namespace toolbars
} // namespace pv

View File

@@ -46,6 +46,8 @@ public:
QString genDefaultSessionFile();
void auto_resize();
private:
void changeEvent(QEvent *event);
void retranslateUi();

View File

@@ -214,6 +214,8 @@ namespace pv
_action_single->setText(L_S(STR_PAGE_TOOLBAR, S_ID(IDS_TOOLBAR_CAPTURE_MODE_SINGLE), "&Single"));
_action_repeat->setText(L_S(STR_PAGE_TOOLBAR, S_ID(IDS_TOOLBAR_CAPTURE_MODE_REPEAT), "&Repetitive"));
_action_loop->setText(L_S(STR_PAGE_TOOLBAR, S_ID(IDS_TOOLBAR_CAPTURE_MODE_LOOP), "&Loop"));
auto_resize();
}
void SamplingBar::reStyle()
@@ -1293,5 +1295,19 @@ namespace pv
on_instant_stop();
}
void SamplingBar::auto_resize()
{
std::vector<QToolButton*> wids;
wids.push_back(&_configure_button);
wids.push_back(&_mode_button);
wids.push_back(&_run_stop_button);
wids.push_back(&_instant_button);
for(auto bt : wids){
int w = bt->fontMetrics().boundingRect(bt->text()).width();
bt->setMinimumWidth(w+5);
}
}
} // namespace toolbars
} // namespace pv

View File

@@ -100,6 +100,8 @@ namespace pv
void commit_settings();
void auto_resize();
signals:
void sig_store_session_data();

View File

@@ -153,6 +153,8 @@ void TrigBar::retranslateUi()
_action_math->setText(L_S(STR_PAGE_TOOLBAR, S_ID(IDS_TOOLBAR_FUNCTION_MATH), "Math"));
_action_dispalyOptions->setText(L_S(STR_PAGE_TOOLBAR, S_ID(IDS_TOOLBAR_DISPLAY_OPTIONS), "Options"));
auto_resize();
}
void TrigBar::reStyle()
@@ -343,5 +345,20 @@ void TrigBar::on_actionLissajous_triggered()
}
}
void TrigBar::auto_resize()
{
std::vector<QToolButton*> wids;
wids.push_back(&_trig_button);
wids.push_back(&_protocol_button);
wids.push_back(&_measure_button);
wids.push_back(&_search_button);
wids.push_back(&_setting_button);
for(auto bt : wids){
int w = bt->fontMetrics().boundingRect(bt->text()).width();
bt->setMinimumWidth(w+5);
}
}
} // namespace toolbars
} // namespace pv

View File

@@ -46,6 +46,7 @@ public:
explicit TrigBar(SigSession *session, QWidget *parent = 0);
void reload();
void update_view_status();
void auto_resize();
private:
void changeEvent(QEvent *event);