diff options
author | Mavridis Philippe <mavridisf@gmail.com> | 2022-10-16 16:16:59 +0300 |
---|---|---|
committer | Mavridis Philippe <mavridisf@gmail.com> | 2022-10-19 11:44:38 +0300 |
commit | a63df75361a3468c62a03ef55e6442d37603d381 (patch) | |
tree | c12fde9801cc0577d608ac93c97d8bcac0f9b3c5 /konsole | |
parent | 8234a0478a64c0ee5916ad7b2f039d907049299a (diff) | |
download | tdebase-a63df75361a3468c62a03ef55e6442d37603d381.tar.gz tdebase-a63df75361a3468c62a03ef55e6442d37603d381.zip |
Konsole Part: Ctrl+Mouse Scroll to change font size
Konsole: Move biggerFont() and smallerFont() into TEWidget
Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
Additional changes.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
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 52cd1236b..026ee2df8 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; @@ -1695,6 +1708,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 ) { if (!screen || screen->hasScroll() || (scrollbar->maxValue() == 0 && screen_num == 0)) diff --git a/konsole/konsole/TEWidget.h b/konsole/konsole/TEWidget.h index 967896082..32c1ce9d5 100644 --- a/konsole/konsole/TEWidget.h +++ b/konsole/konsole/TEWidget.h @@ -126,6 +126,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 64fdfb700..5e1379a4e 100644 --- a/konsole/konsole/konsole_part.cpp +++ b/konsole/konsole/konsole_part.cpp @@ -705,19 +705,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() |