1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-21 08:53:52 +00:00

Update script editor tab width (Bug #3286)

This commit is contained in:
Rob Cutmore 2016-04-07 07:45:33 -04:00
parent ba9058e19f
commit a3903d374f
2 changed files with 11 additions and 1 deletions

View file

@ -52,7 +52,7 @@ CSVWorld::ScriptEdit::ScriptEdit(
mWhiteListQoutes("^[a-z|_]{1}[a-z|0-9|_]{0,}$", Qt::CaseInsensitive) mWhiteListQoutes("^[a-z|_]{1}[a-z|0-9|_]{0,}$", Qt::CaseInsensitive)
{ {
wrapLines(false); wrapLines(false);
setTabStopWidth (4); setTabWidth();
setUndoRedoEnabled (false); // we use OpenCS-wide undo/redo instead setUndoRedoEnabled (false); // we use OpenCS-wide undo/redo instead
mAllowedTypes <<CSMWorld::UniversalId::Type_Journal mAllowedTypes <<CSMWorld::UniversalId::Type_Journal
@ -194,6 +194,13 @@ bool CSVWorld::ScriptEdit::stringNeedsQuote (const std::string& id) const
return !(string.contains(mWhiteListQoutes)); return !(string.contains(mWhiteListQoutes));
} }
void CSVWorld::ScriptEdit::setTabWidth()
{
const int numCharacters = 4;
QFontMetrics metrics(mMonoFont);
setTabStopWidth(numCharacters * metrics.width(' '));
}
void CSVWorld::ScriptEdit::wrapLines(bool wrap) void CSVWorld::ScriptEdit::wrapLines(bool wrap)
{ {
if (wrap) if (wrap)

View file

@ -91,6 +91,9 @@ namespace CSVWorld
bool stringNeedsQuote(const std::string& id) const; bool stringNeedsQuote(const std::string& id) const;
/// \brief Set tab width for script editor.
void setTabWidth();
/// \brief Turn line wrapping in script editor on or off. /// \brief Turn line wrapping in script editor on or off.
/// \param wrap Whether or not to wrap lines. /// \param wrap Whether or not to wrap lines.
void wrapLines(bool wrap); void wrapLines(bool wrap);