/***************************************************************************
- * Copyright (C) 2005-2015 by the Quassel Project *
+ * Copyright (C) 2005-2020 by the Quassel Project *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
+#include "fontselector.h"
+
#include <QEvent>
#include <QFontDialog>
#include <QHBoxLayout>
#include <QLabel>
#include <QPushButton>
-#include "fontselector.h"
-
-FontSelector::FontSelector(QWidget *parent) : QWidget(parent)
+FontSelector::FontSelector(QWidget* parent)
+ : QWidget(parent)
{
- QHBoxLayout *layout = new QHBoxLayout(this);
- QPushButton *chooseButton = new QPushButton(tr("Choose..."), this);
- connect(chooseButton, SIGNAL(clicked()), SLOT(chooseFont()));
+ auto* layout = new QHBoxLayout(this);
+ QPushButton* chooseButton = new QPushButton(tr("Choose..."), this);
+ connect(chooseButton, &QAbstractButton::clicked, this, &FontSelector::chooseFont);
layout->addWidget(_demo = new QLabel("Font"));
layout->addWidget(chooseButton);
_font = font();
}
-
-void FontSelector::setSelectedFont(const QFont &font)
+void FontSelector::setSelectedFont(const QFont& font)
{
_font = font;
_demo->setText(QString("%1 %2pt").arg(font.family()).arg(font.pointSize()));
emit fontChanged(font);
}
-
void FontSelector::chooseFont()
{
bool ok;
- QFont font = QFontDialog::getFont(&ok, _demo->font());
+ QFont font = QFontDialog::getFont(&ok, _demo->font(), nullptr, QString(), QFontDialog::DontUseNativeDialog);
if (ok) {
setSelectedFont(font);
}
}
-
-void FontSelector::changeEvent(QEvent *e)
+void FontSelector::changeEvent(QEvent* e)
{
if (e->type() == QEvent::StyleChange) {
_demo->setFont(_font);