mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-19 18:40:13 -06:00
Move a connect in SqlTextEdit to avoid unnecessary slot calls
Move the connect for updating the line number area width from the reload settings method to the constructor to make sure it's only called once. Otherwise there would be more and more unnecessary connections made whenever the settings are reloaded.
This commit is contained in:
@@ -101,7 +101,7 @@ void MainWindow::init()
|
||||
ui->actionExecuteSql->setShortcuts(shortcuts);
|
||||
|
||||
QShortcut* shortcutBrowseRefresh = new QShortcut(QKeySequence("Ctrl+R"), this);
|
||||
QObject::connect(shortcutBrowseRefresh, SIGNAL(activated()), ui->buttonRefresh, SLOT(click()));
|
||||
connect(shortcutBrowseRefresh, SIGNAL(activated()), ui->buttonRefresh, SLOT(click()));
|
||||
|
||||
// Create the actions for the recently opened dbs list
|
||||
for(int i = 0; i < MaxRecentFiles; ++i) {
|
||||
@@ -214,7 +214,7 @@ void MainWindow::init()
|
||||
{
|
||||
// Check for a new release version, usually only enabled on windows
|
||||
m_NetworkManager = new QNetworkAccessManager(this);
|
||||
QObject::connect(m_NetworkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(httpresponse(QNetworkReply*)));
|
||||
connect(m_NetworkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(httpresponse(QNetworkReply*)));
|
||||
|
||||
QUrl url("https://raw.githubusercontent.com/sqlitebrowser/sqlitebrowser/master/currentrelease");
|
||||
m_NetworkManager->get(QNetworkRequest(url));
|
||||
|
||||
@@ -50,6 +50,9 @@ SqlTextEdit::SqlTextEdit(QWidget* parent) :
|
||||
|
||||
// Do rest of initialisation
|
||||
reloadSettings();
|
||||
|
||||
// Connect signals
|
||||
connect(this, SIGNAL(linesChanged()), this, SLOT(updateLineNumberAreaWidth()));
|
||||
}
|
||||
|
||||
SqlTextEdit::~SqlTextEdit()
|
||||
@@ -132,7 +135,6 @@ void SqlTextEdit::reloadSettings()
|
||||
setMarginsFont(marginsfont);
|
||||
setMarginLineNumbers(0, true);
|
||||
setMarginsBackgroundColor(Qt::lightGray);
|
||||
connect(this, SIGNAL(linesChanged()), this, SLOT(updateLineNumberAreaWidth()));
|
||||
updateLineNumberAreaWidth();
|
||||
|
||||
// Highlight current line
|
||||
|
||||
Reference in New Issue
Block a user