icons: Fix icons not showing for format color buttons
authorManuel Nickschas <sputnick@quassel-irc.org>
Thu, 14 Jun 2018 17:58:21 +0000 (19:58 +0200)
committerManuel Nickschas <sputnick@quassel-irc.org>
Fri, 15 Jun 2018 23:30:32 +0000 (01:30 +0200)
Adding a menu to a button seems to clear an icon set previously
until the button is clicked. Fix this by reordering things.

src/qtui/inputwidget.cpp

index f74903f..756d064 100644 (file)
@@ -64,8 +64,6 @@ InputWidget::InputWidget(QWidget *parent)
     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();
 
@@ -97,6 +95,10 @@ InputWidget::InputWidget(QWidget *parent)
     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)));