mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 13:59:52 +08:00
do not add icon for menu items in menu bar on macOS
This commit is contained in:
parent
b7f2690e96
commit
1c7e4576a4
@ -106,12 +106,6 @@ int main(int argc, char *argv[])
|
|||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
vconfig.initialize();
|
vconfig.initialize();
|
||||||
|
|
||||||
#if defined(Q_OS_MACOS)
|
|
||||||
// Do not show icons in menu on macOS since there is something wrong with
|
|
||||||
// the icon path on macOS.
|
|
||||||
app.setAttribute(Qt::AA_DontShowIconsInMenus);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QString locale = VUtils::getLocale();
|
QString locale = VUtils::getLocale();
|
||||||
qDebug() << "use locale" << locale;
|
qDebug() << "use locale" << locale;
|
||||||
|
|
||||||
|
@ -462,7 +462,7 @@ void VMainWindow::initFileMenu()
|
|||||||
fileMenu->setToolTipsVisible(true);
|
fileMenu->setToolTipsVisible(true);
|
||||||
|
|
||||||
// Import notes from files.
|
// Import notes from files.
|
||||||
m_importNoteAct = new QAction(QIcon(":/resources/icons/import_note.svg"),
|
m_importNoteAct = newAction(QIcon(":/resources/icons/import_note.svg"),
|
||||||
tr("&Import Notes From Files"), this);
|
tr("&Import Notes From Files"), this);
|
||||||
m_importNoteAct->setToolTip(tr("Import notes from external files into current folder"));
|
m_importNoteAct->setToolTip(tr("Import notes from external files into current folder"));
|
||||||
connect(m_importNoteAct, &QAction::triggered,
|
connect(m_importNoteAct, &QAction::triggered,
|
||||||
@ -493,7 +493,7 @@ void VMainWindow::initFileMenu()
|
|||||||
m_printAct->setEnabled(false);
|
m_printAct->setEnabled(false);
|
||||||
|
|
||||||
// Settings.
|
// Settings.
|
||||||
QAction *settingsAct = new QAction(QIcon(":/resources/icons/settings.svg"),
|
QAction *settingsAct = newAction(QIcon(":/resources/icons/settings.svg"),
|
||||||
tr("&Settings"), this);
|
tr("&Settings"), this);
|
||||||
settingsAct->setToolTip(tr("View and change settings for VNote"));
|
settingsAct->setToolTip(tr("View and change settings for VNote"));
|
||||||
connect(settingsAct, &QAction::triggered,
|
connect(settingsAct, &QAction::triggered,
|
||||||
@ -519,14 +519,14 @@ void VMainWindow::initEditMenu()
|
|||||||
editMenu->setToolTipsVisible(true);
|
editMenu->setToolTipsVisible(true);
|
||||||
|
|
||||||
// Insert image.
|
// Insert image.
|
||||||
m_insertImageAct = new QAction(QIcon(":/resources/icons/insert_image.svg"),
|
m_insertImageAct = newAction(QIcon(":/resources/icons/insert_image.svg"),
|
||||||
tr("Insert &Image"), this);
|
tr("Insert &Image"), this);
|
||||||
m_insertImageAct->setToolTip(tr("Insert an image from file into current note"));
|
m_insertImageAct->setToolTip(tr("Insert an image from file into current note"));
|
||||||
connect(m_insertImageAct, &QAction::triggered,
|
connect(m_insertImageAct, &QAction::triggered,
|
||||||
this, &VMainWindow::insertImage);
|
this, &VMainWindow::insertImage);
|
||||||
|
|
||||||
// Find/Replace.
|
// Find/Replace.
|
||||||
m_findReplaceAct = new QAction(QIcon(":/resources/icons/find_replace.svg"),
|
m_findReplaceAct = newAction(QIcon(":/resources/icons/find_replace.svg"),
|
||||||
tr("Find/Replace"), this);
|
tr("Find/Replace"), this);
|
||||||
m_findReplaceAct->setToolTip(tr("Open Find/Replace dialog to search in current note"));
|
m_findReplaceAct->setToolTip(tr("Open Find/Replace dialog to search in current note"));
|
||||||
m_findReplaceAct->setShortcut(QKeySequence::Find);
|
m_findReplaceAct->setShortcut(QKeySequence::Find);
|
||||||
@ -883,7 +883,11 @@ void VMainWindow::initRenderBackgroundMenu(QMenu *menu)
|
|||||||
tmpAct->setToolTip(tr("Set as the background color for Markdown rendering"));
|
tmpAct->setToolTip(tr("Set as the background color for Markdown rendering"));
|
||||||
tmpAct->setCheckable(true);
|
tmpAct->setCheckable(true);
|
||||||
tmpAct->setData(bgColors[i].name);
|
tmpAct->setData(bgColors[i].name);
|
||||||
|
|
||||||
|
#if !defined(Q_OS_MACOS)
|
||||||
tmpAct->setIcon(QIcon(predefinedColorPixmaps[i]));
|
tmpAct->setIcon(QIcon(predefinedColorPixmaps[i]));
|
||||||
|
#endif
|
||||||
|
|
||||||
if (curBgColor == bgColors[i].name) {
|
if (curBgColor == bgColors[i].name) {
|
||||||
tmpAct->setChecked(true);
|
tmpAct->setChecked(true);
|
||||||
}
|
}
|
||||||
@ -933,7 +937,7 @@ void VMainWindow::initRenderStyleMenu(QMenu *p_menu)
|
|||||||
connect(m_renderStyleActs, &QActionGroup::triggered,
|
connect(m_renderStyleActs, &QActionGroup::triggered,
|
||||||
this, &VMainWindow::setRenderStyle);
|
this, &VMainWindow::setRenderStyle);
|
||||||
|
|
||||||
QAction *addAct = new QAction(QIcon(":/resources/icons/add_style.svg"),
|
QAction *addAct = newAction(QIcon(":/resources/icons/add_style.svg"),
|
||||||
tr("&Add Style"), m_renderStyleActs);
|
tr("&Add Style"), m_renderStyleActs);
|
||||||
addAct->setToolTip(tr("Open the folder to add your custom CSS style files"));
|
addAct->setToolTip(tr("Open the folder to add your custom CSS style files"));
|
||||||
addAct->setCheckable(true);
|
addAct->setCheckable(true);
|
||||||
@ -967,7 +971,9 @@ void VMainWindow::initEditorBackgroundMenu(QMenu *menu)
|
|||||||
tmpAct->setToolTip(tr("Set as the background color for editor"));
|
tmpAct->setToolTip(tr("Set as the background color for editor"));
|
||||||
tmpAct->setCheckable(true);
|
tmpAct->setCheckable(true);
|
||||||
tmpAct->setData(bgColors[i].name);
|
tmpAct->setData(bgColors[i].name);
|
||||||
|
#if !defined(Q_OS_MACOS)
|
||||||
tmpAct->setIcon(QIcon(predefinedColorPixmaps[i]));
|
tmpAct->setIcon(QIcon(predefinedColorPixmaps[i]));
|
||||||
|
#endif
|
||||||
if (curBgColor == bgColors[i].name) {
|
if (curBgColor == bgColors[i].name) {
|
||||||
tmpAct->setChecked(true);
|
tmpAct->setChecked(true);
|
||||||
}
|
}
|
||||||
@ -1017,7 +1023,7 @@ void VMainWindow::initEditorStyleMenu(QMenu *p_menu)
|
|||||||
connect(m_editorStyleActs, &QActionGroup::triggered,
|
connect(m_editorStyleActs, &QActionGroup::triggered,
|
||||||
this, &VMainWindow::setEditorStyle);
|
this, &VMainWindow::setEditorStyle);
|
||||||
|
|
||||||
QAction *addAct = new QAction(QIcon(":/resources/icons/add_style.svg"),
|
QAction *addAct = newAction(QIcon(":/resources/icons/add_style.svg"),
|
||||||
tr("&Add Style"), m_editorStyleActs);
|
tr("&Add Style"), m_editorStyleActs);
|
||||||
addAct->setToolTip(tr("Open the folder to add your custom MDHL style files"));
|
addAct->setToolTip(tr("Open the folder to add your custom MDHL style files"));
|
||||||
addAct->setCheckable(true);
|
addAct->setCheckable(true);
|
||||||
@ -1471,3 +1477,14 @@ void VMainWindow::exportAsPDF()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QAction *VMainWindow::newAction(const QIcon &p_icon,
|
||||||
|
const QString &p_text,
|
||||||
|
QObject *p_parent)
|
||||||
|
{
|
||||||
|
#if defined(Q_OS_MACOS)
|
||||||
|
Q_UNUSED(p_icon);
|
||||||
|
return new QAction(p_text, p_parent);
|
||||||
|
#else
|
||||||
|
return new QAction(p_icon, p_text, p_parent);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
@ -124,6 +124,11 @@ private:
|
|||||||
void toggleOnePanelView();
|
void toggleOnePanelView();
|
||||||
void closeCurrentFile();
|
void closeCurrentFile();
|
||||||
|
|
||||||
|
// Wrapper to create a QAction.
|
||||||
|
QAction *newAction(const QIcon &p_icon,
|
||||||
|
const QString &p_text,
|
||||||
|
QObject *p_parent = nullptr);
|
||||||
|
|
||||||
VNote *vnote;
|
VNote *vnote;
|
||||||
QPointer<VFile> m_curFile;
|
QPointer<VFile> m_curFile;
|
||||||
QPointer<VEditTab> m_curTab;
|
QPointer<VEditTab> m_curTab;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user