Adding a menu to a button seems to clear an icon set previously
until the button is clicked. Fix this by reordering things.
ui.boldButton->setIcon(QIcon::fromTheme("format-text-bold"));
ui.italicButton->setIcon(QIcon::fromTheme("format-text-italic"));
ui.underlineButton->setIcon(QIcon::fromTheme("format-text-underline"));
ui.boldButton->setIcon(QIcon::fromTheme("format-text-bold"));
ui.italicButton->setIcon(QIcon::fromTheme("format-text-italic"));
ui.underlineButton->setIcon(QIcon::fromTheme("format-text-underline"));
- ui.textcolorButton->setIcon(QIcon::fromTheme("format-text-color"));
- ui.highlightcolorButton->setIcon(QIcon::fromTheme("format-fill-color"));
ui.clearButton->setIcon(QIcon::fromTheme("edit-clear"));
ui.encryptionIconLabel->hide();
ui.clearButton->setIcon(QIcon::fromTheme("edit-clear"));
ui.encryptionIconLabel->hide();
ui.highlightcolorButton->setDefaultAction(_colorFillMenu->actions().last());
connect(_colorFillMenu, SIGNAL(triggered(QAction *)), this, SLOT(colorHighlightChosen(QAction *)));
ui.highlightcolorButton->setDefaultAction(_colorFillMenu->actions().last());
connect(_colorFillMenu, SIGNAL(triggered(QAction *)), this, SLOT(colorHighlightChosen(QAction *)));
+ // Needs to be done after adding the menu, otherwise the icon mysteriously vanishes until clicked
+ ui.textcolorButton->setIcon(QIcon::fromTheme("format-text-color"));
+ ui.highlightcolorButton->setIcon(QIcon::fromTheme("format-fill-color"));
+
// Show/hide style button
connect(ui.showStyleButton, SIGNAL(toggled(bool)), this, SLOT(setStyleOptionsExpanded(bool)));
// Show/hide style button
connect(ui.showStyleButton, SIGNAL(toggled(bool)), this, SLOT(setStyleOptionsExpanded(bool)));