diff options
author | Mavridis Philippe <[email protected]> | 2022-10-16 16:16:59 +0300 |
---|---|---|
committer | Mavridis Philippe <[email protected]> | 2022-10-19 11:48:37 +0300 |
commit | dae747a14cedb1b67380bf54239ef1616eaabb01 (patch) | |
tree | b019e45db1b624581c87d25d8a023b018c89db28 /konsole | |
parent | f620f70619f24f54fb5f5784a652cfd138146e88 (diff) | |
download | tdebase-dae747a14cedb1b67380bf54239ef1616eaabb01.tar.gz tdebase-dae747a14cedb1b67380bf54239ef1616eaabb01.zip |
Konsole Part: Ctrl+Mouse Scroll to change font size
Konsole: Move biggerFont() and smallerFont() into TEWidget
Signed-off-by: Mavridis Philippe <[email protected]>
Additional changes.
Signed-off-by: Michele Calgaro <[email protected]>
(cherry picked from commit a63df75361a3468c62a03ef55e6442d37603d381)
Diffstat (limited to 'konsole')
-rw-r--r-- | konsole/konsole/TEWidget.cpp | 24 | ||||
-rw-r--r-- | konsole/konsole/TEWidget.h | 4 | ||||
-rw-r--r-- | konsole/konsole/konsole.cpp | 11 | ||||
-rw-r--r-- | konsole/konsole/konsole_part.cpp | 11 |
4 files changed, 32 insertions, 18 deletions
diff --git a/konsole/konsole/TEWidget.cpp b/konsole/konsole/TEWidget.cpp index f151044fc..4ceaeb83d 100644 --- a/konsole/konsole/TEWidget.cpp +++ b/konsole/konsole/TEWidget.cpp @@ -308,6 +308,19 @@ void TEWidget::fontChange(const TQFont &) update(); } +void TEWidget::biggerFont(void) { + TQFont f = getVTFont(); + f.setPointSize( f.pointSize() + 1 ); + setVTFont( f ); +} + +void TEWidget::smallerFont(void) { + TQFont f = getVTFont(); + if ( f.pointSize() < 6 ) return; // A minimum size + f.setPointSize( f.pointSize() - 1 ); + setVTFont( f ); +} + void TEWidget::setVTFont(const TQFont& f) { TQFont font = f; @@ -1693,6 +1706,17 @@ void TEWidget::wheelEvent( TQWheelEvent* ev ) if (ev->orientation() != Qt::Vertical) return; + if (ev->state() & ControlButton) { + if (ev->delta() > 0) { + biggerFont(); + } + else { + smallerFont(); + } + ev->accept(); + return; + } + if ( mouse_marks ) TQApplication::sendEvent(scrollbar, ev); else diff --git a/konsole/konsole/TEWidget.h b/konsole/konsole/TEWidget.h index 2baa2531c..ba2d1f6cf 100644 --- a/konsole/konsole/TEWidget.h +++ b/konsole/konsole/TEWidget.h @@ -125,6 +125,10 @@ public: */ void setVTFont(const TQFont& font); + /** Changes font size by 1 point */ + void biggerFont(); + void smallerFont(); + void setMouseMarks(bool on); static void setAntialias( bool enable ) { s_antialias = enable; } static bool antialias() { return s_antialias; } diff --git a/konsole/konsole/konsole.cpp b/konsole/konsole/konsole.cpp index 4faef5239..11fae96d1 100644 --- a/konsole/konsole/konsole.cpp +++ b/konsole/konsole/konsole.cpp @@ -4387,20 +4387,13 @@ void Konsole::slotFontChanged() void Konsole::biggerFont(void) { if ( !se ) return; - - TQFont f = te->getVTFont(); - f.setPointSize( f.pointSize() + 1 ); - te->setVTFont( f ); + te->biggerFont(); activateSession(); } void Konsole::smallerFont(void) { if ( !se ) return; - - TQFont f = te->getVTFont(); - if ( f.pointSize() < 6 ) return; // A minimum size - f.setPointSize( f.pointSize() - 1 ); - te->setVTFont( f ); + te->smallerFont(); activateSession(); } diff --git a/konsole/konsole/konsole_part.cpp b/konsole/konsole/konsole_part.cpp index 1c0067bb9..ce3ebab57 100644 --- a/konsole/konsole/konsole_part.cpp +++ b/konsole/konsole/konsole_part.cpp @@ -695,19 +695,12 @@ void konsolePart::slotSelectFont() { void konsolePart::biggerFont(void) { if ( !se ) return; - - TQFont f = te->getVTFont(); - f.setPointSize( f.pointSize() + 1 ); - te->setVTFont( f ); + te->biggerFont(); } void konsolePart::smallerFont(void) { if ( !se ) return; - - TQFont f = te->getVTFont(); - if ( f.pointSize() < 6 ) return; // A minimum size - f.setPointSize( f.pointSize() - 1 ); - te->setVTFont( f ); + te->smallerFont(); } void konsolePart::updateKeytabMenu() |