Update script editor tab width (Bug #3286)

pull/1/head
Rob Cutmore 9 years ago
parent ba9058e19f
commit a3903d374f

@ -52,7 +52,7 @@ CSVWorld::ScriptEdit::ScriptEdit(
mWhiteListQoutes("^[a-z|_]{1}[a-z|0-9|_]{0,}$", Qt::CaseInsensitive)
{
wrapLines(false);
setTabStopWidth (4);
setTabWidth();
setUndoRedoEnabled (false); // we use OpenCS-wide undo/redo instead
mAllowedTypes <<CSMWorld::UniversalId::Type_Journal
@ -194,6 +194,13 @@ bool CSVWorld::ScriptEdit::stringNeedsQuote (const std::string& id) const
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)
{
if (wrap)

@ -91,6 +91,9 @@ namespace CSVWorld
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.
/// \param wrap Whether or not to wrap lines.
void wrapLines(bool wrap);

Loading…
Cancel
Save