[LyX/master] Attempt to align slider and buttons in a widget
Juergen Spitzmueller
spitz at lyx.org
Tue Mar 9 13:18:22 UTC 2021
commit ad44f4f4483e1b7c2a358c8b6f28d7f9efdf40ff
Author: Juergen Spitzmueller <spitz at lyx.org>
Date: Tue Mar 9 14:23:13 2021 +0100
Attempt to align slider and buttons in a widget
---
src/frontends/qt/GuiView.cpp | 18 +++++++++---------
src/frontends/qt/GuiView.h | 3 +++
2 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/src/frontends/qt/GuiView.cpp b/src/frontends/qt/GuiView.cpp
index 679d84d..3dfad25 100644
--- a/src/frontends/qt/GuiView.cpp
+++ b/src/frontends/qt/GuiView.cpp
@@ -629,6 +629,9 @@ GuiView::GuiView(int id)
QFontMetrics const fm(statusBar()->fontMetrics());
+ zoomwidget_ = new QWidget(statusBar());
+ zoomwidget_->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
+ QHBoxLayout * zoomlayout = new QHBoxLayout(zoomwidget_);
zoom_slider_ = new QSlider(Qt::Horizontal, statusBar());
// Small size slider for macOS to prevent the status bar from enlarging
zoom_slider_->setAttribute(Qt::WA_MacSmallSize);
@@ -661,12 +664,11 @@ GuiView::GuiView(int id)
zoom_out_->setFixedSize(QSize(fm.height(), fm.height()));
zoom_out_->setFlat(true);
- statusBar()->addPermanentWidget(zoom_out_);
- zoom_out_->setEnabled(currentBufferView());
- statusBar()->addPermanentWidget(zoom_slider_);
- zoom_slider_->setEnabled(currentBufferView());
- zoom_in_->setEnabled(currentBufferView());
- statusBar()->addPermanentWidget(zoom_in_);
+ zoomlayout->addWidget(zoom_out_);
+ zoomlayout->addWidget(zoom_slider_);
+ zoomlayout->addWidget(zoom_in_);
+ zoomwidget_->setEnabled(currentBufferView());
+ statusBar()->addPermanentWidget(zoomwidget_);
connect(zoom_slider_, SIGNAL(sliderMoved(int)), this, SLOT(zoomSliderMoved(int)));
connect(zoom_slider_, SIGNAL(valueChanged(int)), this, SLOT(zoomValueChanged(int)));
@@ -1400,10 +1402,8 @@ void GuiView::onBufferViewChanged()
// Buffer-dependent dialogs must be updated. This is done here because
// some dialogs require buffer()->text.
updateDialogs();
- zoom_slider_->setEnabled(currentBufferView());
+ zoomwidget_->setEnabled(currentBufferView());
zoom_value_->setEnabled(currentBufferView());
- zoom_in_->setEnabled(currentBufferView());
- zoom_out_->setEnabled(currentBufferView());
}
diff --git a/src/frontends/qt/GuiView.h b/src/frontends/qt/GuiView.h
index 728ed0d..fc37bf4 100644
--- a/src/frontends/qt/GuiView.h
+++ b/src/frontends/qt/GuiView.h
@@ -29,6 +29,7 @@ class QPushButton;
class QLabel;
class QShowEvent;
class QSlider;
+class QWidget;
namespace lyx {
@@ -507,6 +508,8 @@ private:
QPushButton * zoom_in_;
/// Zoom out ("-") Button
QPushButton * zoom_out_;
+ /// The frame all slider elements are embedded in
+ QWidget * zoomwidget_;
/// The rate from which the actual zoom value is calculated
/// from the default zoom pref
More information about the lyx-cvs
mailing list