mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-12-04 15:39:34 +01:00
Fix pre-release issues with attachment viewer (#12244)
* Fix translation issues for "FIT" and "New Attachment" in attachment editor * Fix markdown preview persistence and enable external links in attachment editor * Update preview panel if manually moved from collapsed position * Match edit view scroll position (by percentage) when changed. This ensures the preview remains in relative sync with the edited document, for example when a large amount of HTML reduces down to a short preview document. * Fix default preview size to be half the width of the edit widget. * Set tab stop to 10 and remove base ui file --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Jonathan White <support@dmapps.us>
This commit is contained in:
@@ -37,8 +37,6 @@ namespace
|
||||
constexpr std::array ZoomList = {0.25, 0.5, 0.75, 1.0, 2.0};
|
||||
constexpr double WheelZoomStep = 1.1;
|
||||
|
||||
const QString FitText = QObject::tr("Fit");
|
||||
|
||||
QString formatZoomText(double zoomFactor)
|
||||
{
|
||||
return QString("%1%").arg(QString::number(zoomFactor * 100, 'f', 0));
|
||||
@@ -92,9 +90,10 @@ void ImageAttachmentsWidget::initZoomComboBox()
|
||||
{
|
||||
m_ui->zoomComboBox->clear();
|
||||
|
||||
auto textWidth = m_ui->zoomComboBox->fontMetrics().horizontalAdvance(FitText);
|
||||
auto fitText = tr("Fit");
|
||||
auto textWidth = m_ui->zoomComboBox->fontMetrics().horizontalAdvance(fitText);
|
||||
|
||||
m_ui->zoomComboBox->addItem(FitText, 0.0);
|
||||
m_ui->zoomComboBox->addItem(fitText, 0.0);
|
||||
|
||||
for (const auto& zoom : ZoomList) {
|
||||
auto zoomText = formatZoomText(zoom);
|
||||
@@ -146,7 +145,7 @@ void ImageAttachmentsWidget::onZoomChanged(const QString& zoomText)
|
||||
{
|
||||
auto zoomFactor = 1.0;
|
||||
|
||||
if (zoomText == FitText) {
|
||||
if (zoomText == tr("Fit")) {
|
||||
m_ui->imagesView->enableAutoFitInView();
|
||||
|
||||
zoomFactor = std::min(m_ui->imagesView->calculateFitInViewFactor(), zoomFactor);
|
||||
|
||||
Reference in New Issue
Block a user