mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-07-10 04:15:51 +00:00
fix (some) KF deprecation warnings
This commit is contained in:
82
sources/3rdparty/fontdialog/fontdialog.h
vendored
Normal file
82
sources/3rdparty/fontdialog/fontdialog.h
vendored
Normal file
@ -0,0 +1,82 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2014 Evgeniy Alekseev *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 3.0 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Lesser General Public *
|
||||
* License along with this library. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef FONTDIALOG_H
|
||||
#define FONTDIALOG_H
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QDialog>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QFontComboBox>
|
||||
#include <QSpinBox>
|
||||
|
||||
|
||||
class CFont : public QFont
|
||||
{
|
||||
public:
|
||||
explicit CFont(const QString family, int pointSize = -1,
|
||||
int weight = -1, bool italic = false,
|
||||
QColor color = QColor(QString("#000000")));
|
||||
// color properties
|
||||
QColor color();
|
||||
void setCurrentColor(const QColor color);
|
||||
// html weight properties
|
||||
static int html2QFont(const int htmlWeight);
|
||||
static int qFont2html(const int weight);
|
||||
int htmlWeight();
|
||||
void setHtmlWeight(const int htmlWeight);
|
||||
// conversion to QFont
|
||||
static CFont fromQFont(const QFont font,
|
||||
const QColor color = QColor(QString("#000000")));
|
||||
QFont toQFont();
|
||||
|
||||
private:
|
||||
QColor currentColor;
|
||||
};
|
||||
|
||||
|
||||
class CFontDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CFontDialog(QWidget *parent = 0,
|
||||
const bool needWeight = true,
|
||||
const bool needItalic = true);
|
||||
~CFontDialog();
|
||||
static CFont getFont(const QString title = tr("Select font"),
|
||||
CFont defaultFont = CFont(QString("Arial"),
|
||||
12, 400, false,
|
||||
QColor(QString("#000000"))),
|
||||
const bool needWeight = true,
|
||||
const bool needItalic = true,
|
||||
int *status = nullptr);
|
||||
|
||||
private slots:
|
||||
void updateColor(const QString color);
|
||||
|
||||
private:
|
||||
QComboBox *colorBox;
|
||||
QDialogButtonBox *buttons;
|
||||
QFontComboBox *fontBox;
|
||||
QComboBox *italicBox;
|
||||
QSpinBox *sizeBox;
|
||||
QSpinBox *weightBox;
|
||||
};
|
||||
|
||||
|
||||
#endif /* FONTDIALOG_H */
|
Reference in New Issue
Block a user