mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 13:59:52 +08:00
support input method on macOS in tag popup
This commit is contained in:
parent
e2fda18dbd
commit
4d41421fb8
@ -79,6 +79,12 @@ namespace vnotex
|
|||||||
case Type::EssentialFileMissing:
|
case Type::EssentialFileMissing:
|
||||||
return QString("EssentialFileMissing");
|
return QString("EssentialFileMissing");
|
||||||
|
|
||||||
|
case Type::FileExistsOnCreate:
|
||||||
|
return QString("FileExistsOnCreate");
|
||||||
|
|
||||||
|
case Type::DirExistsOnCreate:
|
||||||
|
return QString("DirExistsOnCreate");
|
||||||
|
|
||||||
case Type::InvalidArgument:
|
case Type::InvalidArgument:
|
||||||
return QString("InvalidArgument");
|
return QString("InvalidArgument");
|
||||||
}
|
}
|
||||||
|
@ -188,7 +188,6 @@ bool NotebookDatabaseAccess::addNode(Node *p_node, bool p_ignoreId)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const ID id = query.lastInsertId().toULongLong();
|
const ID id = query.lastInsertId().toULongLong();
|
||||||
const ID preId = p_node->getId();
|
|
||||||
p_node->updateId(id);
|
p_node->updateId(id);
|
||||||
|
|
||||||
qDebug() << "added node id" << id << p_node->getName();
|
qDebug() << "added node id" << id << p_node->getName();
|
||||||
|
@ -377,8 +377,9 @@ void NotebookMgr::addNotebook(const QSharedPointer<Notebook> &p_notebook)
|
|||||||
{
|
{
|
||||||
p_notebook->initialize();
|
p_notebook->initialize();
|
||||||
m_notebooks.push_back(p_notebook);
|
m_notebooks.push_back(p_notebook);
|
||||||
|
auto notebook = p_notebook.data();
|
||||||
connect(p_notebook.data(), &Notebook::updated,
|
connect(p_notebook.data(), &Notebook::updated,
|
||||||
this, [this, notebook = p_notebook.data()]() {
|
this, [this, notebook]() {
|
||||||
emit notebookUpdated(notebook);
|
emit notebookUpdated(notebook);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -196,7 +196,7 @@ class GraphPreviewer {
|
|||||||
// Fix SVG with stroke="currentColor" and fill="currentColor".
|
// Fix SVG with stroke="currentColor" and fill="currentColor".
|
||||||
fixSvgCurrentColor(p_svgNode) {
|
fixSvgCurrentColor(p_svgNode) {
|
||||||
let currentColor = this.currentColor;
|
let currentColor = this.currentColor;
|
||||||
if (currentColor) {
|
if (currentColor && p_svgNode) {
|
||||||
let nodes = p_svgNode.querySelectorAll("g[fill='currentColor']");
|
let nodes = p_svgNode.querySelectorAll("g[fill='currentColor']");
|
||||||
for (let i = 0; i < nodes.length; ++i) {
|
for (let i = 0; i < nodes.length; ++i) {
|
||||||
let node = nodes[i];
|
let node = nodes[i];
|
||||||
@ -212,7 +212,7 @@ class GraphPreviewer {
|
|||||||
|
|
||||||
scaleSvg(p_svgNode) {
|
scaleSvg(p_svgNode) {
|
||||||
let scaleFactor = window.devicePixelRatio;
|
let scaleFactor = window.devicePixelRatio;
|
||||||
if (scaleFactor == 1) {
|
if (scaleFactor == 1 || !p_svgNode) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ namespace vnotex
|
|||||||
|
|
||||||
void search(const QSharedPointer<SearchOption> &p_option,
|
void search(const QSharedPointer<SearchOption> &p_option,
|
||||||
const SearchToken &p_token,
|
const SearchToken &p_token,
|
||||||
const QVector<SearchSecondPhaseItem> &p_items);
|
const QVector<SearchSecondPhaseItem> &p_items) Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
void stop() Q_DECL_OVERRIDE;
|
void stop() Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
|
@ -53,5 +53,4 @@ namespace vnotex
|
|||||||
void logRequested(const QString &p_log);
|
void logRequested(const QString &p_log);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // ISEARCHENGINE_H
|
#endif // ISEARCHENGINE_H
|
||||||
|
@ -136,7 +136,7 @@ void ImageInsertDialog::setupUI(const QString &p_title,
|
|||||||
auto fixedWidthCheckBox = WidgetsFactory::createCheckBox(tr("Fixed scaling width"), mainWidget);
|
auto fixedWidthCheckBox = WidgetsFactory::createCheckBox(tr("Fixed scaling width"), mainWidget);
|
||||||
fixedWidthCheckBox->setChecked(s_fixedScaleWidth);
|
fixedWidthCheckBox->setChecked(s_fixedScaleWidth);
|
||||||
connect(fixedWidthCheckBox, &QCheckBox::stateChanged,
|
connect(fixedWidthCheckBox, &QCheckBox::stateChanged,
|
||||||
this, [this](int p_state) {
|
this, [](int p_state) {
|
||||||
s_fixedScaleWidth = p_state == Qt::Checked;
|
s_fixedScaleWidth = p_state == Qt::Checked;
|
||||||
});
|
});
|
||||||
gridLayout->addWidget(fixedWidthCheckBox, 4, 1, 1, 1);
|
gridLayout->addWidget(fixedWidthCheckBox, 4, 1, 1, 1);
|
||||||
|
@ -42,7 +42,7 @@ void Updater::setupUI()
|
|||||||
auto btnBox = getDialogButtonBox();
|
auto btnBox = getDialogButtonBox();
|
||||||
auto viewBtn = btnBox->addButton(tr("View Releases"), QDialogButtonBox::AcceptRole);
|
auto viewBtn = btnBox->addButton(tr("View Releases"), QDialogButtonBox::AcceptRole);
|
||||||
connect(viewBtn, &QPushButton::clicked,
|
connect(viewBtn, &QPushButton::clicked,
|
||||||
this, [this]() {
|
this, []() {
|
||||||
WidgetUtils::openUrlByDesktop(QUrl("https://github.com/vnotex/vnote/releases"));
|
WidgetUtils::openUrlByDesktop(QUrl("https://github.com/vnotex/vnote/releases"));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -230,4 +230,10 @@ void FramelessMainWindowLinux::showEvent(QShowEvent *p_event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
using namespace vnotex;
|
||||||
|
|
||||||
|
FramelessMainWindowLinuxDummy::FramelessMainWindowLinuxDummy()
|
||||||
|
{
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -64,6 +64,8 @@ namespace vnotex
|
|||||||
#else
|
#else
|
||||||
class FramelessMainWindowLinuxDummy
|
class FramelessMainWindowLinuxDummy
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
FramelessMainWindowLinuxDummy();
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -221,4 +221,10 @@ void FramelessMainWindowWin::forceRedraw()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
using namespace vnotex;
|
||||||
|
|
||||||
|
FramelessMainWindowWinDummy::FramelessMainWindowWinDummy()
|
||||||
|
{
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -40,6 +40,8 @@ namespace vnotex
|
|||||||
#else
|
#else
|
||||||
class FramelessMainWindowWinDummy
|
class FramelessMainWindowWinDummy
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
FramelessMainWindowWinDummy();
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -282,7 +282,7 @@ void MarkdownViewWindow::setupToolBar()
|
|||||||
{
|
{
|
||||||
auto act = addAction(toolBar, ViewWindowToolBarHelper::InplacePreview);
|
auto act = addAction(toolBar, ViewWindowToolBarHelper::InplacePreview);
|
||||||
connect(act, &QAction::triggered,
|
connect(act, &QAction::triggered,
|
||||||
this, [this, act](bool p_checked) {
|
this, [this](bool p_checked) {
|
||||||
if (!isReadMode()) {
|
if (!isReadMode()) {
|
||||||
m_editor->setInplacePreviewEnabled(p_checked);
|
m_editor->setInplacePreviewEnabled(p_checked);
|
||||||
}
|
}
|
||||||
|
@ -142,7 +142,7 @@ TitleBar *SearchPanel::setupTitleBar(const QString &p_title, QWidget *p_parent)
|
|||||||
|
|
||||||
auto toggleLocationListBtn = titleBar->addActionButton(QStringLiteral("search_location_list.svg"), tr("Toggle Location List"));
|
auto toggleLocationListBtn = titleBar->addActionButton(QStringLiteral("search_location_list.svg"), tr("Toggle Location List"));
|
||||||
connect(toggleLocationListBtn, &QToolButton::triggered,
|
connect(toggleLocationListBtn, &QToolButton::triggered,
|
||||||
this, [this]() {
|
this, []() {
|
||||||
VNoteX::getInst().getMainWindow()->toggleLocationListVisible();
|
VNoteX::getInst().getMainWindow()->toggleLocationListVisible();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ void SnippetPanel::setupTitleBar(const QString &p_title, QWidget *p_parent)
|
|||||||
{
|
{
|
||||||
auto openFolderBtn = m_titleBar->addActionButton(QStringLiteral("open_folder.svg"), tr("Open Folder"));
|
auto openFolderBtn = m_titleBar->addActionButton(QStringLiteral("open_folder.svg"), tr("Open Folder"));
|
||||||
connect(openFolderBtn, &QToolButton::triggered,
|
connect(openFolderBtn, &QToolButton::triggered,
|
||||||
this, [this]() {
|
this, []() {
|
||||||
WidgetUtils::openUrlByDesktop(QUrl::fromLocalFile(SnippetMgr::getInst().getSnippetFolder()));
|
WidgetUtils::openUrlByDesktop(QUrl::fromLocalFile(SnippetMgr::getInst().getSnippetFolder()));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -16,14 +16,14 @@
|
|||||||
using namespace vnotex;
|
using namespace vnotex;
|
||||||
|
|
||||||
StyledItemDelegateListWidget::StyledItemDelegateListWidget(const ListWidget *p_listWidget)
|
StyledItemDelegateListWidget::StyledItemDelegateListWidget(const ListWidget *p_listWidget)
|
||||||
: m_listWidget(p_listWidget)
|
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(p_listWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
StyledItemDelegateTreeWidget::StyledItemDelegateTreeWidget(const TreeWidget *p_treeWidget)
|
StyledItemDelegateTreeWidget::StyledItemDelegateTreeWidget(const TreeWidget *p_treeWidget)
|
||||||
: m_treeWidget(p_treeWidget)
|
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(p_treeWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -35,9 +35,6 @@ namespace vnotex
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit StyledItemDelegateListWidget(const ListWidget *p_listWidget);
|
explicit StyledItemDelegateListWidget(const ListWidget *p_listWidget);
|
||||||
|
|
||||||
private:
|
|
||||||
const ListWidget *m_listWidget = nullptr;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -45,9 +42,6 @@ namespace vnotex
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit StyledItemDelegateTreeWidget(const TreeWidget *p_treeWidget);
|
explicit StyledItemDelegateTreeWidget(const TreeWidget *p_treeWidget);
|
||||||
|
|
||||||
private:
|
|
||||||
const TreeWidget *m_treeWidget = nullptr;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@ QSystemTrayIcon *SystemTrayHelper::setupSystemTray(MainWindow *p_win)
|
|||||||
|
|
||||||
MainWindow::connect(trayIcon, &QSystemTrayIcon::activated,
|
MainWindow::connect(trayIcon, &QSystemTrayIcon::activated,
|
||||||
p_win, [p_win](QSystemTrayIcon::ActivationReason p_reason) {
|
p_win, [p_win](QSystemTrayIcon::ActivationReason p_reason) {
|
||||||
|
Q_UNUSED(p_reason);
|
||||||
#if !defined(Q_OS_MACOS)
|
#if !defined(Q_OS_MACOS)
|
||||||
if (p_reason == QSystemTrayIcon::Trigger) {
|
if (p_reason == QSystemTrayIcon::Trigger) {
|
||||||
p_win->showMainWindow();
|
p_win->showMainWindow();
|
||||||
|
@ -16,6 +16,12 @@ TagPopup::TagPopup(QToolButton *p_btn, QWidget *p_parent)
|
|||||||
{
|
{
|
||||||
setupUI();
|
setupUI();
|
||||||
|
|
||||||
|
#if defined(Q_OS_MACOS) || defined(Q_OS_MAC)
|
||||||
|
// Qt::Popup on macOS does not work well with input method.
|
||||||
|
setWindowFlags(Qt::Tool | Qt::NoDropShadowWindowHint);
|
||||||
|
setWindowModality(Qt::ApplicationModal);
|
||||||
|
#endif
|
||||||
|
|
||||||
connect(this, &QMenu::aboutToShow,
|
connect(this, &QMenu::aboutToShow,
|
||||||
this, [this]() {
|
this, [this]() {
|
||||||
m_tagViewer->setNode(m_buffer ? m_buffer->getNode() : nullptr);
|
m_tagViewer->setNode(m_buffer ? m_buffer->getNode() : nullptr);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user