mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-29 07:19:46 -06:00
Add option for word wrapping in Edit Database Cell
A new option, in the toolbar of the Edit Database Cell, is added for setting word wrapping for the text editor modes. It is now independent of the SQL preference. The configuration reading the editor/wrap_lines setting is moved to the particular SQL editor class. Added icon from the Silk icon set. See issue #1796
This commit is contained in:
@@ -22,6 +22,8 @@
|
||||
#include <QClipboard>
|
||||
#include <QTextDocument>
|
||||
|
||||
#include <Qsci/qsciscintilla.h>
|
||||
|
||||
EditDialog::EditDialog(QWidget* parent)
|
||||
: QDialog(parent),
|
||||
ui(new Ui::EditDialog),
|
||||
@@ -65,6 +67,8 @@ EditDialog::EditDialog(QWidget* parent)
|
||||
ui->actionIndent->setChecked(mustIndentAndCompact);
|
||||
|
||||
ui->buttonAutoSwitchMode->setChecked(Settings::getValue("databrowser", "auto_switch_mode").toBool());
|
||||
ui->actionWordWrap->setChecked(Settings::getValue("databrowser", "editor_word_wrap").toBool());
|
||||
setWordWrapping(ui->actionWordWrap->isChecked());
|
||||
|
||||
reloadSettings();
|
||||
}
|
||||
@@ -73,6 +77,7 @@ EditDialog::~EditDialog()
|
||||
{
|
||||
Settings::setValue("databrowser", "indent_compact", mustIndentAndCompact);
|
||||
Settings::setValue("databrowser", "auto_switch_mode", ui->buttonAutoSwitchMode->isChecked());
|
||||
Settings::setValue("databrowser", "editor_word_wrap", ui->actionWordWrap->isChecked());
|
||||
delete ui;
|
||||
}
|
||||
|
||||
@@ -1012,3 +1017,9 @@ void EditDialog::copyHexAscii()
|
||||
{
|
||||
QApplication::clipboard()->setText(hexEdit->selectionToReadableString());
|
||||
}
|
||||
|
||||
void EditDialog::setWordWrapping(bool value)
|
||||
{
|
||||
// Set wrap lines
|
||||
sciEdit->setWrapMode(value ? QsciScintilla::WrapWord : QsciScintilla::WrapNone);
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@ private slots:
|
||||
void openPrintDialog();
|
||||
void openPrintImageDialog();
|
||||
void copyHexAscii();
|
||||
void setWordWrapping(bool value);
|
||||
|
||||
signals:
|
||||
void recordTextUpdated(const QPersistentModelIndex& idx, const QByteArray& data, bool isBlob);
|
||||
|
||||
@@ -115,6 +115,7 @@
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolBar" name="editCellToolbar">
|
||||
<addaction name="actionWordWrap"/>
|
||||
<addaction name="actionIndent"/>
|
||||
<addaction name="actionImport"/>
|
||||
<addaction name="actionExport"/>
|
||||
@@ -150,8 +151,8 @@ Errors are indicated with a red squiggle underline.</string>
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>598</width>
|
||||
<height>265</height>
|
||||
<width>85</width>
|
||||
<height>35</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
@@ -359,6 +360,24 @@ Errors are indicated with a red squiggle underline.</string>
|
||||
<string>Erases the contents of the cell</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionWordWrap">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="icons/icons.qrc">
|
||||
<normaloff>:/icons/word_wrap</normaloff>:/icons/word_wrap</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Word Wrap</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Wrap lines on word boundaries</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>comboMode</tabstop>
|
||||
@@ -529,6 +548,22 @@ Errors are indicated with a red squiggle underline.</string>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>actionWordWrap</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>EditDialog</receiver>
|
||||
<slot>setWordWrapping(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>-1</x>
|
||||
<y>-1</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>308</x>
|
||||
<y>190</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
<slots>
|
||||
<slot>importData()</slot>
|
||||
|
||||
@@ -198,9 +198,6 @@ void ExtendedScintilla::reloadLexerSettings(QsciLexer *lexer)
|
||||
if(lexer)
|
||||
lexer->refreshProperties();
|
||||
|
||||
// Set wrap lines
|
||||
setWrapMode(static_cast<QsciScintilla::WrapMode>(Settings::getValue("editor", "wrap_lines").toInt()));
|
||||
|
||||
// Check if error indicators are enabled and clear them if they just got disabled
|
||||
showErrorIndicators = Settings::getValue("editor", "error_indicators").toBool();
|
||||
if(!showErrorIndicators)
|
||||
|
||||
@@ -207,6 +207,8 @@ QVariant Settings::getDefaultValue(const QString& group, const QString& name)
|
||||
return false;
|
||||
if(name == "auto_switch_mode")
|
||||
return true;
|
||||
if(name == "editor_word_wrap")
|
||||
return true;
|
||||
if(name == "null_text")
|
||||
return "NULL";
|
||||
if(name == "blob_text")
|
||||
|
||||
@@ -79,5 +79,6 @@
|
||||
<file alias="project_save_as">package_rename.png</file>
|
||||
<file alias="field_fk">page_foreign_key.png</file>
|
||||
<file alias="save_all">save_all.png</file>
|
||||
<file alias="word_wrap">page_white_text.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
BIN
src/icons/page_white_text.png
Normal file
BIN
src/icons/page_white_text.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 342 B |
@@ -61,6 +61,8 @@ void SqlTextEdit::reloadSettings()
|
||||
} else {
|
||||
setAutoCompletionThreshold(0);
|
||||
}
|
||||
// Set wrap lines
|
||||
setWrapMode(static_cast<QsciScintilla::WrapMode>(Settings::getValue("editor", "wrap_lines").toInt()));
|
||||
|
||||
ExtendedScintilla::reloadSettings();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user