File tree Expand file tree Collapse file tree 8 files changed +19
-21
lines changed
Expand file tree Collapse file tree 8 files changed +19
-21
lines changed Original file line number Diff line number Diff line change @@ -218,8 +218,6 @@ source_group ("mainwindow\\project" FILES
218218)
219219
220220set (mainwindow_pythonconsole_sources
221- mainwindow/pythonconsole/fontsizechangeable.cpp
222- mainwindow/pythonconsole/fontsizechangeable.h
223221 mainwindow/pythonconsole/linenumberarea.cpp
224222 mainwindow/pythonconsole/linenumberarea.h
225223 mainwindow/pythonconsole/outputredirector.cpp
@@ -232,6 +230,8 @@ set (mainwindow_pythonconsole_sources
232230 mainwindow/pythonconsole/pythonhighlighter.h
233231 mainwindow/pythonconsole/pythonoutput.cpp
234232 mainwindow/pythonconsole/pythonoutput.h
233+ mainwindow/pythonconsole/zoomableplaintextedit.cpp
234+ mainwindow/pythonconsole/zoomableplaintextedit.h
235235 )
236236list (APPEND appleseed.studio_sources
237237 ${mainwindow_pythonconsole_sources}
Original file line number Diff line number Diff line change @@ -76,8 +76,8 @@ PythonConsoleWidget::PythonConsoleWidget(QWidget* parent)
7676
7777 m_output = new PythonOutput (console_body);
7878
79- console_body->addWidget (m_input);
8079 console_body->addWidget (m_output);
80+ console_body->addWidget (m_input);
8181
8282 m_action_new_file =
8383 new QAction (load_icons (" project_new" ), " New Python Script" , this );
@@ -193,7 +193,7 @@ void PythonConsoleWidget::slot_clear_output()
193193
194194void PythonConsoleWidget::slot_change_exec_selection_button_state ()
195195{
196- bool is_enabled = m_input->textCursor ().selection ().isEmpty ();
196+ const bool is_enabled = m_input->textCursor ().selection ().isEmpty ();
197197 m_action_execute_selection->setEnabled (is_enabled);
198198}
199199
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ namespace appleseed {
4444namespace studio {
4545
4646PythonEditor::PythonEditor (QWidget* parent)
47- : FontSizeChangeable (parent)
47+ : ZoomablePlainTextEdit (parent)
4848{
4949 setObjectName (" python_editor" );
5050 setUndoRedoEnabled (true );
@@ -80,7 +80,7 @@ void PythonEditor::keyPressEvent(QKeyEvent* event)
8080 {
8181 if (event->key () == Qt::Key_Return || event->key () == Qt::Key_Enter)
8282 event->setModifiers (event->modifiers () & ~Qt::ShiftModifier);
83- FontSizeChangeable ::keyPressEvent (event);
83+ ZoomablePlainTextEdit ::keyPressEvent (event);
8484 if (event->key () == Qt::Key_Return || event->key () == Qt::Key_Enter)
8585 indent ();
8686 }
Original file line number Diff line number Diff line change 3030#define APPLESEED_STUDIO_MAINWINDOW_PYTHONCONSOLE_PYTHONEDITOR_H
3131
3232// appleseed.studio headers.
33- #include " mainwindow/pythonconsole/fontsizechangeable .h"
33+ #include " mainwindow/pythonconsole/zoomableplaintextedit .h"
3434
3535// Qt headers.
3636#include < QObject>
@@ -48,7 +48,7 @@ namespace appleseed {
4848namespace studio {
4949
5050class PythonEditor
51- : public FontSizeChangeable
51+ : public ZoomablePlainTextEdit
5252{
5353 Q_OBJECT
5454
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ namespace appleseed {
3333namespace studio {
3434
3535PythonOutput::PythonOutput (QWidget* parent)
36- : FontSizeChangeable (parent)
36+ : ZoomablePlainTextEdit (parent)
3737{
3838 setObjectName (" python_output" );
3939 setUndoRedoEnabled (false );
Original file line number Diff line number Diff line change 3030#define APPLESEED_STUDIO_MAINWINDOW_PYTHONCONSOLE_PYTHONOUTPUT_H
3131
3232// appleseed.studio headers.
33- #include " mainwindow/pythonconsole/fontsizechangeable .h"
33+ #include " mainwindow/pythonconsole/zoomableplaintextedit .h"
3434
3535// Qt headers.
3636#include < QObject>
@@ -43,7 +43,7 @@ namespace appleseed {
4343namespace studio {
4444
4545class PythonOutput
46- : public FontSizeChangeable
46+ : public ZoomablePlainTextEdit
4747{
4848 Q_OBJECT
4949
Original file line number Diff line number Diff line change 2727//
2828
2929// Interface header.
30- #include " fontsizechangeable .h"
30+ #include " zoomableplaintextedit .h"
3131
3232namespace appleseed {
3333namespace studio {
3434
35- FontSizeChangeable::FontSizeChangeable (QWidget* parent)
35+ ZoomablePlainTextEdit::ZoomablePlainTextEdit (QWidget* parent)
3636 : QPlainTextEdit(parent)
3737{
3838}
3939
40- void FontSizeChangeable ::keyPressEvent (QKeyEvent* event)
40+ void ZoomablePlainTextEdit ::keyPressEvent (QKeyEvent* event)
4141{
4242 if (event->modifiers () & Qt::ControlModifier &&
4343 (event->key () == Qt::Key_Plus || event->key () == Qt::Key_Equal))
@@ -50,17 +50,15 @@ void FontSizeChangeable::keyPressEvent(QKeyEvent* event)
5050 QPlainTextEdit::keyPressEvent (event);
5151}
5252
53- void FontSizeChangeable ::wheelEvent (QWheelEvent* event)
53+ void ZoomablePlainTextEdit ::wheelEvent (QWheelEvent* event)
5454{
5555 if (event->modifiers () & Qt::ControlModifier)
56- // Minus here because if you turn wheel up delta is negative
57- // while font should be incremented.
58- change_font_size (- event->delta () / 120 );
56+ change_font_size (event->delta () / 120 );
5957 else
6058 QPlainTextEdit::wheelEvent (event);
6159}
6260
63- void FontSizeChangeable ::change_font_size (const int delta)
61+ void ZoomablePlainTextEdit ::change_font_size (const int delta)
6462{
6563 int new_font_size = font ().pointSize () + delta;
6664 QFont new_font = font ();
Original file line number Diff line number Diff line change 3636namespace appleseed {
3737namespace studio {
3838
39- class FontSizeChangeable
39+ class ZoomablePlainTextEdit
4040 : public QPlainTextEdit
4141{
4242 Q_OBJECT
4343
4444 public:
45- FontSizeChangeable (QWidget* parent);
45+ ZoomablePlainTextEdit (QWidget* parent);
4646
4747 protected:
4848 void keyPressEvent (QKeyEvent* event);
You can’t perform that action at this time.
0 commit comments