mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Disentangle status bar and zoom menu
- Moves the zoom menu to the zoom value
This commit is contained in:
parent
edc339dcc1
commit
974534f28a
@ -723,12 +723,17 @@ Menuset
|
||||
Item "Giant-sized Icons" "icon-size giant"
|
||||
End
|
||||
|
||||
#
|
||||
# Status bar zoom context menu
|
||||
#
|
||||
Menu "context-zoom"
|
||||
ZoomOptions
|
||||
End
|
||||
|
||||
#
|
||||
# Status bar context menu
|
||||
#
|
||||
Menu "context-statusbar"
|
||||
ZoomOptions
|
||||
Separator
|
||||
Item "Zoom Level|Z" "ui-toggle zoomlevel"
|
||||
Item "Zoom Slider|S" "ui-toggle zoomslider"
|
||||
Separator
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
#include "GuiClickableLabel.h"
|
||||
|
||||
#include <QStyle>
|
||||
#include <QMouseEvent>
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
@ -23,6 +23,11 @@ GuiClickableLabel::GuiClickableLabel(QWidget * parent)
|
||||
GuiClickableLabel::~GuiClickableLabel()
|
||||
{}
|
||||
|
||||
void GuiClickableLabel::mousePressEvent(QMouseEvent * e) {
|
||||
if (e->button() == Qt::LeftButton)
|
||||
Q_EMIT pressed();
|
||||
}
|
||||
|
||||
void GuiClickableLabel::mouseReleaseEvent(QMouseEvent *) {
|
||||
Q_EMIT clicked();
|
||||
}
|
||||
|
@ -25,8 +25,10 @@ public:
|
||||
|
||||
Q_SIGNALS:
|
||||
void clicked();
|
||||
void pressed();
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent *) override;
|
||||
void mouseReleaseEvent(QMouseEvent *) override;
|
||||
};
|
||||
|
||||
|
@ -706,7 +706,8 @@ GuiView::GuiView(int id)
|
||||
|
||||
// QPalette palette = statusBar()->palette();
|
||||
|
||||
zoom_value_ = new QLabel(statusBar());
|
||||
zoom_value_ = new GuiClickableLabel(statusBar());
|
||||
connect(zoom_value_, SIGNAL(pressed()), this, SLOT(showZoomContextMenu()));
|
||||
// zoom_value_->setPalette(palette);
|
||||
zoom_value_->setForegroundRole(statusBar()->foregroundRole());
|
||||
zoom_value_->setFixedHeight(fm.height());
|
||||
@ -722,7 +723,7 @@ GuiView::GuiView(int id)
|
||||
|
||||
statusBar()->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(statusBar(), SIGNAL(customContextMenuRequested(QPoint)),
|
||||
this, SLOT(showZoomContextMenu()));
|
||||
this, SLOT(showStatusBarContextMenu()));
|
||||
|
||||
// enable pinch to zoom
|
||||
grabGesture(Qt::PinchGesture);
|
||||
@ -862,6 +863,15 @@ void GuiView::zoomOutPressed()
|
||||
|
||||
|
||||
void GuiView::showZoomContextMenu()
|
||||
{
|
||||
QMenu * menu = guiApp->menus().menu(toqstr("context-zoom"), * this);
|
||||
if (!menu)
|
||||
return;
|
||||
menu->exec(QCursor::pos());
|
||||
}
|
||||
|
||||
|
||||
void GuiView::showStatusBarContextMenu()
|
||||
{
|
||||
QMenu * menu = guiApp->menus().menu(toqstr("context-statusbar"), * this);
|
||||
if (!menu)
|
||||
|
@ -263,6 +263,8 @@ private Q_SLOTS:
|
||||
///
|
||||
void showZoomContextMenu();
|
||||
///
|
||||
void showStatusBarContextMenu();
|
||||
///
|
||||
void on_currentWorkAreaChanged(GuiWorkArea *);
|
||||
///
|
||||
void onBufferViewChanged();
|
||||
@ -526,7 +528,7 @@ private:
|
||||
/// This excludes blanks
|
||||
bool char_nb_count_enabled_;
|
||||
/// Statusbar widget that shows zoom value
|
||||
QLabel * zoom_value_;
|
||||
GuiClickableLabel * zoom_value_;
|
||||
/// The zoom slider widget
|
||||
QSlider * zoom_slider_;
|
||||
/// Zoom in ("+") Button
|
||||
|
Loading…
Reference in New Issue
Block a user