+ pix.fill(Qt::transparent);
+ _colorMenu->addAction(pix, tr("Clear Color"))->setData("");
+ _colorFillMenu->addAction(pix, tr("Clear Color"))->setData("");
+
+ ui.textcolorButton->setMenu(_colorMenu);
+ // Set the default action to clear color (last added action)
+ ui.textcolorButton->setDefaultAction(_colorMenu->actions().last());
+ connect(_colorMenu, &QMenu::triggered, this, &InputWidget::colorChosen);
+
+ ui.highlightcolorButton->setMenu(_colorFillMenu);
+ // Set the default action to clear fill color (last added action)
+ ui.highlightcolorButton->setDefaultAction(_colorFillMenu->actions().last());
+ connect(_colorFillMenu, &QMenu::triggered, this, &InputWidget::colorHighlightChosen);
+
+ // Needs to be done after adding the menu, otherwise the icon mysteriously vanishes until clicked
+ ui.textcolorButton->setIcon(icon::get("format-text-color"));
+ ui.highlightcolorButton->setIcon(icon::get("format-fill-color"));
+
+ // Show/hide style button
+ connect(ui.showStyleButton, &QAbstractButton::toggled, this, &InputWidget::setStyleOptionsExpanded);
+
+ // Clear formatting button
+ connect(ui.clearButton, &QAbstractButton::clicked, this, &InputWidget::clearFormat);
+
+ new TabCompleter(ui.inputEdit);
+
+ UiStyleSettings fs("Fonts");
+ fs.notify("UseCustomInputWidgetFont", this, &InputWidget::setUseCustomFont);
+ fs.notify("InputWidget", this, &InputWidget::setCustomFont);
+ if (fs.value("UseCustomInputWidgetFont", false).toBool())
+ setCustomFont(fs.value("InputWidget", QFont()));
+
+ UiSettings s("InputWidget");
+ s.initAndNotify("EnableEmacsMode", this, &InputWidget::setEnableEmacsMode, false);
+ s.initAndNotify("ShowNickSelector", this, &InputWidget::setShowNickSelector, true);
+ s.initAndNotify("ShowStyleButtons", this, &InputWidget::setShowStyleButtons, true);
+ s.initAndNotify("EnablePerChatHistory", this, &InputWidget::setEnablePerChatHistory, true);
+ s.initAndNotify("MaxNumLines", this, &InputWidget::setMaxLines, 5);
+ s.initAndNotify("EnableScrollBars", this, &InputWidget::setScrollBarsEnabled, true);
+ s.initAndNotify("EnableLineWrap", this, &InputWidget::setLineWrapEnabled, true);
+ s.initAndNotify("EnableMultiLine", this, &InputWidget::setMultiLineEnabled, true);
+
+ ActionCollection* coll = QtUi::actionCollection();
+ coll->addAction("FocusInputLine",
+ new Action{tr("Focus Input Line"), coll, this, selectOverload<>(&QWidget::setFocus), QKeySequence(Qt::CTRL + Qt::Key_L)});
+
+ connect(inputLine(),
+ &MultiLineEdit::textEntered,
+ this,
+ &InputWidget::onTextEntered,
+ Qt::QueuedConnection); // make sure the line is already reset, bug #984
+ connect(inputLine(), &QTextEdit::currentCharFormatChanged, this, &InputWidget::currentCharFormatChanged);
+}