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>
(cherry picked from commit a63df75361)
r14.0.x
Mavridis Philippe 2 years ago
parent f620f70619
commit dae747a14c
No known key found for this signature in database
GPG Key ID: F8D2D7E2F989A494

@ -308,6 +308,19 @@ void TEWidget::fontChange(const TQFont &)
update(); 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) void TEWidget::setVTFont(const TQFont& f)
{ {
TQFont font = f; TQFont font = f;
@ -1693,6 +1706,17 @@ void TEWidget::wheelEvent( TQWheelEvent* ev )
if (ev->orientation() != Qt::Vertical) if (ev->orientation() != Qt::Vertical)
return; return;
if (ev->state() & ControlButton) {
if (ev->delta() > 0) {
biggerFont();
}
else {
smallerFont();
}
ev->accept();
return;
}
if ( mouse_marks ) if ( mouse_marks )
TQApplication::sendEvent(scrollbar, ev); TQApplication::sendEvent(scrollbar, ev);
else else

@ -125,6 +125,10 @@ public:
*/ */
void setVTFont(const TQFont& font); void setVTFont(const TQFont& font);
/** Changes font size by 1 point */
void biggerFont();
void smallerFont();
void setMouseMarks(bool on); void setMouseMarks(bool on);
static void setAntialias( bool enable ) { s_antialias = enable; } static void setAntialias( bool enable ) { s_antialias = enable; }
static bool antialias() { return s_antialias; } static bool antialias() { return s_antialias; }

@ -4387,20 +4387,13 @@ void Konsole::slotFontChanged()
void Konsole::biggerFont(void) { void Konsole::biggerFont(void) {
if ( !se ) return; if ( !se ) return;
te->biggerFont();
TQFont f = te->getVTFont();
f.setPointSize( f.pointSize() + 1 );
te->setVTFont( f );
activateSession(); activateSession();
} }
void Konsole::smallerFont(void) { void Konsole::smallerFont(void) {
if ( !se ) return; if ( !se ) return;
te->smallerFont();
TQFont f = te->getVTFont();
if ( f.pointSize() < 6 ) return; // A minimum size
f.setPointSize( f.pointSize() - 1 );
te->setVTFont( f );
activateSession(); activateSession();
} }

@ -695,19 +695,12 @@ void konsolePart::slotSelectFont() {
void konsolePart::biggerFont(void) { void konsolePart::biggerFont(void) {
if ( !se ) return; if ( !se ) return;
te->biggerFont();
TQFont f = te->getVTFont();
f.setPointSize( f.pointSize() + 1 );
te->setVTFont( f );
} }
void konsolePart::smallerFont(void) { void konsolePart::smallerFont(void) {
if ( !se ) return; if ( !se ) return;
te->smallerFont();
TQFont f = te->getVTFont();
if ( f.pointSize() < 6 ) return; // A minimum size
f.setPointSize( f.pointSize() - 1 );
te->setVTFont( f );
} }
void konsolePart::updateKeytabMenu() void konsolePart::updateKeytabMenu()

Loading…
Cancel
Save