Added paste lang option for pasting programming code.
Expects you to paste only string literals with possible concatenation operators like . or +
This commit is contained in:
parent
35d1e75d35
commit
fbd630489e
8 changed files with 302 additions and 2 deletions
|
|
@ -141,14 +141,14 @@ void DatabaseWindow::createActions()
|
|||
icon.addFile(QString::fromUtf8(":/icons/token_shortland_character.png"), QSize(), QIcon::Normal, QIcon::On);
|
||||
auto action = actionCopyAsCString = new QAction(icon, tr("Copy as C string"), this);
|
||||
action->setObjectName("actionCopyAsCString");
|
||||
action->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_C));
|
||||
action->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_C));
|
||||
}
|
||||
{
|
||||
QIcon icon;
|
||||
icon.addFile(QString::fromUtf8(":/icons/token_shortland_character.png"), QSize(), QIcon::Normal, QIcon::On);
|
||||
auto action = actionCopyAsRawCppString = new QAction(icon, tr("Copy as raw C++-string"), this);
|
||||
action->setObjectName("actionCopyAsRawCppString");
|
||||
action->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_C));
|
||||
|
||||
}
|
||||
{
|
||||
QIcon icon;
|
||||
|
|
@ -213,6 +213,13 @@ void DatabaseWindow::createActions()
|
|||
action->setObjectName("actionOpenSql");
|
||||
action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_O));
|
||||
}
|
||||
{
|
||||
QIcon icon;
|
||||
//icon.addFile(QString::fromUtf8(":/icons/folder.png"), QSize(), QIcon::Normal, QIcon::On);
|
||||
auto action = actionPasteLangString = new QAction(icon, tr("Paste lang string"), this);
|
||||
action->setObjectName("actionPasteLangString");
|
||||
action->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_V));
|
||||
}
|
||||
{
|
||||
QIcon icon;
|
||||
icon.addFile(QString::fromUtf8(":/icons/script_save.png"), QSize(), QIcon::Normal, QIcon::On);
|
||||
|
|
@ -257,6 +264,8 @@ void DatabaseWindow::initMenus()
|
|||
actionCopy,
|
||||
actionCopyAsCString,
|
||||
actionCopyAsRawCppString,
|
||||
// standard Paste missing Ctrl+V works however by default
|
||||
actionPasteLangString,
|
||||
actionGenerateCode
|
||||
});
|
||||
|
||||
|
|
@ -482,6 +491,14 @@ void DatabaseWindow::on_actionOpenSql_triggered()
|
|||
}
|
||||
}
|
||||
|
||||
void DatabaseWindow::on_actionPasteLangString_triggered()
|
||||
{
|
||||
auto query_tool = GetActiveQueryTool();
|
||||
if (query_tool) {
|
||||
query_tool->pasteLangString();
|
||||
}
|
||||
}
|
||||
|
||||
void DatabaseWindow::on_actionSaveSql_triggered()
|
||||
{
|
||||
auto query_tool = GetActiveQueryTool();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue