mirror of https://github.com/vitalif/openscad
commit
dcb8c20119
|
@ -67,6 +67,9 @@ Preferences::Preferences(QWidget *parent) : QMainWindow(parent)
|
||||||
connect(this->fontSize, SIGNAL(currentIndexChanged(const QString&)),
|
connect(this->fontSize, SIGNAL(currentIndexChanged(const QString&)),
|
||||||
this, SLOT(on_fontSize_editTextChanged(const QString &)));
|
this, SLOT(on_fontSize_editTextChanged(const QString &)));
|
||||||
|
|
||||||
|
// reset GUI fontsize if fontSize->addItem emitted signals that changed it.
|
||||||
|
this->fontSize->setEditText( QString("%1").arg( savedsize ) );
|
||||||
|
|
||||||
// Setup default settings
|
// Setup default settings
|
||||||
this->defaultmap["3dview/colorscheme"] = this->colorSchemeChooser->currentItem()->text();
|
this->defaultmap["3dview/colorscheme"] = this->colorSchemeChooser->currentItem()->text();
|
||||||
this->defaultmap["advanced/opencsg_show_warning"] = true;
|
this->defaultmap["advanced/opencsg_show_warning"] = true;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "editor.h"
|
#include "editor.h"
|
||||||
|
#include "Preferences.h"
|
||||||
|
|
||||||
#ifndef _QCODE_EDIT_
|
#ifndef _QCODE_EDIT_
|
||||||
void Editor::indentSelection()
|
void Editor::indentSelection()
|
||||||
|
@ -70,4 +71,40 @@ void Editor::uncommentSelection()
|
||||||
cursor.setPosition(p2, QTextCursor::KeepAnchor);
|
cursor.setPosition(p2, QTextCursor::KeepAnchor);
|
||||||
setTextCursor(cursor);
|
setTextCursor(cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Editor::zoomIn()
|
||||||
|
{
|
||||||
|
// See also QT's implementation in QEditor.cpp
|
||||||
|
QSettings settings;
|
||||||
|
QFont tmp_font = this->font() ;
|
||||||
|
if ( font().pointSize() >= 1 )
|
||||||
|
tmp_font.setPointSize( 1 + font().pointSize() );
|
||||||
|
else
|
||||||
|
tmp_font.setPointSize( 1 );
|
||||||
|
settings.setValue("editor/fontsize", tmp_font.pointSize());
|
||||||
|
this->setFont( tmp_font );
|
||||||
|
}
|
||||||
|
|
||||||
|
void Editor::zoomOut()
|
||||||
|
{
|
||||||
|
QSettings settings;
|
||||||
|
QFont tmp_font = this->font();
|
||||||
|
if ( font().pointSize() >= 2 )
|
||||||
|
tmp_font.setPointSize( -1 + font().pointSize() );
|
||||||
|
else
|
||||||
|
tmp_font.setPointSize( 1 );
|
||||||
|
settings.setValue("editor/fontsize", tmp_font.pointSize());
|
||||||
|
this->setFont( tmp_font );
|
||||||
|
}
|
||||||
|
|
||||||
|
void Editor::wheelEvent ( QWheelEvent * event )
|
||||||
|
{
|
||||||
|
if (event->modifiers() == Qt::ControlModifier) {
|
||||||
|
if (event->delta() > 0 )
|
||||||
|
zoomIn();
|
||||||
|
else if (event->delta() < 0 )
|
||||||
|
zoomOut();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
#include <QWheelEvent>
|
||||||
|
|
||||||
#ifdef _QCODE_EDIT_
|
#ifdef _QCODE_EDIT_
|
||||||
#include <qeditor.h>
|
#include <qeditor.h>
|
||||||
|
@ -24,6 +25,8 @@ public slots:
|
||||||
#else
|
#else
|
||||||
Editor(QWidget *parent) : QTextEdit(parent) { setAcceptRichText(false); }
|
Editor(QWidget *parent) : QTextEdit(parent) { setAcceptRichText(false); }
|
||||||
public slots:
|
public slots:
|
||||||
|
void zoomIn();
|
||||||
|
void zoomOut();
|
||||||
void setLineWrapping(bool on) { if(on) setWordWrapMode(QTextOption::WrapAnywhere); }
|
void setLineWrapping(bool on) { if(on) setWordWrapMode(QTextOption::WrapAnywhere); }
|
||||||
void setContentModified(bool y) { document()->setModified(y); }
|
void setContentModified(bool y) { document()->setModified(y); }
|
||||||
bool isContentModified() { return document()->isModified(); }
|
bool isContentModified() { return document()->isModified(); }
|
||||||
|
@ -31,5 +34,7 @@ public slots:
|
||||||
void unindentSelection();
|
void unindentSelection();
|
||||||
void commentSelection();
|
void commentSelection();
|
||||||
void uncommentSelection();
|
void uncommentSelection();
|
||||||
|
private:
|
||||||
|
void wheelEvent ( QWheelEvent * event );
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue