mirror of
https://github.com/mapmapteam/mapmap.git
synced 2026-06-16 12:33:19 +02:00
Improve loading speed of the keyboard shortcut
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -560,6 +560,8 @@ private:
|
||||
PreferenceDialog* _preferenceDialog;
|
||||
// About dialog
|
||||
AboutDialog *_aboutDialog;
|
||||
// Shortcut Windows
|
||||
ShortcutWindow *_shortcutWindow;
|
||||
|
||||
// UndoStack
|
||||
QUndoStack *undoStack;
|
||||
|
||||
@@ -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());
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user