Improve loading speed of the keyboard shortcut

This commit is contained in:
baydam
2020-04-15 20:36:01 +00:00
committed by Bay Dam
parent 280f3c5cf7
commit 8ab1780501
3 changed files with 10 additions and 6 deletions
+6 -3
View File
@@ -1598,6 +1598,9 @@ void MainWindow::createLayout()
// Create console logging output
consoleWindow = ConsoleWindow::console();
consoleWindow->setVisible(false);
// Create shortcut window
_shortcutWindow = new ShortcutWindow;
_shortcutWindow->setVisible(false);
// Create layout.
paintSplitter = new QSplitter(Qt::Vertical);
@@ -2202,6 +2205,7 @@ void MainWindow::createActions()
connect(feedbackAction, SIGNAL(triggered()), this, SLOT(sendFeedback()));
// Keyboard shortcuts
shortcutAction = new QAction(tr("&Keyboard shortcuts"), this);
shortcutAction->setShortcut(Qt::CTRL + Qt::Key_K);
connect(shortcutAction, SIGNAL(triggered()), this, SLOT(openShortcutWindow()));
// All available screen as action
@@ -3745,9 +3749,8 @@ void MainWindow::exitFullScreen()
void MainWindow::openShortcutWindow()
{
ShortcutWindow *shortcutWindow = new ShortcutWindow;
setAttribute(Qt::WA_DeleteOnClose);
shortcutWindow->show();
_shortcutWindow->reload(); // Important for speed
_shortcutWindow->setVisible(true);
}
void MainWindow::updateSettings()
+2
View File
@@ -560,6 +560,8 @@ private:
PreferenceDialog* _preferenceDialog;
// About dialog
AboutDialog *_aboutDialog;
// Shortcut Windows
ShortcutWindow *_shortcutWindow;
// UndoStack
QUndoStack *undoStack;
+2 -3
View File
@@ -64,13 +64,12 @@ ShortcutWindow::ShortcutWindow()
// Create and customize font
int sansSerif = QFontDatabase::addApplicationFont(":/base-font");
int serif = QFontDatabase::addApplicationFont(":/console-font");
QFont sansSerifFont(QFont(QFontDatabase::applicationFontFamilies(sansSerif).at(0), 9, QFont::Normal));
QFont serifFont(QFont(QFontDatabase::applicationFontFamilies(serif).at(0), 9, QFont::Normal));
QFont sansSerifFont(QFont(QFontDatabase::applicationFontFamilies(sansSerif).at(0), 11, QFont::Normal));
QFont serifFont(QFont(QFontDatabase::applicationFontFamilies(serif).at(0), 10, QFont::Normal));
// Apply font to the document
settings()->setFontFamily(QWebEngineSettings::SansSerifFont, sansSerifFont.family());
settings()->setFontFamily(QWebEngineSettings::SerifFont, serifFont.family());
}
}