mirror of
https://github.com/gamecreature/QtAwesome.git
synced 2025-02-05 10:46:46 +08:00
c9b70f3dc2
Some checks failed
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (macos-12, 5.12.12, OFF) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (macos-12, 5.12.12, ON) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (macos-12, 5.15.2, OFF) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (macos-12, 5.15.2, ON) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (macos-12, 6.4.0, OFF) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (macos-12, 6.4.0, ON) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (macos-12, 6.5.0, OFF) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (macos-12, 6.5.0, ON) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (macos-12, 6.6.0, OFF) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (macos-12, 6.6.0, ON) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (macos-12, 6.7.0, OFF) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (macos-12, 6.7.0, ON) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (macos-13, 5.12.12, OFF) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (macos-13, 5.12.12, ON) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (macos-13, 5.15.2, OFF) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (macos-13, 5.15.2, ON) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (macos-13, 6.4.0, OFF) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (macos-13, 6.4.0, ON) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (macos-13, 6.5.0, OFF) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (macos-13, 6.5.0, ON) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (macos-13, 6.6.0, OFF) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (macos-13, 6.6.0, ON) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (macos-13, 6.7.0, OFF) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (macos-13, 6.7.0, ON) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (macos-14, 6.4.0, OFF) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (macos-14, 6.4.0, ON) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (macos-14, 6.5.0, OFF) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (macos-14, 6.5.0, ON) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (macos-14, 6.6.0, OFF) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (macos-14, 6.6.0, ON) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (macos-14, 6.7.0, OFF) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (macos-14, 6.7.0, ON) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (ubuntu-20.04, 5.12.12, OFF) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (ubuntu-20.04, 5.12.12, ON) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (ubuntu-20.04, 5.15.2, OFF) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (ubuntu-20.04, 5.15.2, ON) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (ubuntu-20.04, 6.4.0, OFF) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (ubuntu-20.04, 6.4.0, ON) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (ubuntu-20.04, 6.5.0, OFF) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (ubuntu-20.04, 6.5.0, ON) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (ubuntu-20.04, 6.6.0, OFF) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (ubuntu-20.04, 6.6.0, ON) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (ubuntu-20.04, 6.7.0, OFF) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (ubuntu-20.04, 6.7.0, ON) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (ubuntu-22.04, 5.12.12, OFF) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (ubuntu-22.04, 5.12.12, ON) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (ubuntu-22.04, 5.15.2, OFF) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (ubuntu-22.04, 5.15.2, ON) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (ubuntu-22.04, 6.4.0, OFF) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (ubuntu-22.04, 6.4.0, ON) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (ubuntu-22.04, 6.5.0, OFF) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (ubuntu-22.04, 6.5.0, ON) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (ubuntu-22.04, 6.6.0, OFF) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (ubuntu-22.04, 6.6.0, ON) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (ubuntu-22.04, 6.7.0, OFF) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (ubuntu-22.04, 6.7.0, ON) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (ubuntu-24.04, 5.12.12, OFF) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (ubuntu-24.04, 5.12.12, ON) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (ubuntu-24.04, 5.15.2, OFF) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (ubuntu-24.04, 5.15.2, ON) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (ubuntu-24.04, 6.4.0, OFF) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (ubuntu-24.04, 6.4.0, ON) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (ubuntu-24.04, 6.5.0, OFF) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (ubuntu-24.04, 6.5.0, ON) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (ubuntu-24.04, 6.6.0, OFF) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (ubuntu-24.04, 6.6.0, ON) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (ubuntu-24.04, 6.7.0, OFF) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (ubuntu-24.04, 6.7.0, ON) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (windows-2019, 5.12.12, OFF) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (windows-2019, 5.12.12, ON) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (windows-2019, 5.15.2, OFF) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (windows-2019, 5.15.2, ON) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (windows-2019, 6.4.0, OFF) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (windows-2019, 6.4.0, ON) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (windows-2019, 6.5.0, OFF) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (windows-2019, 6.5.0, ON) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (windows-2019, 6.6.0, OFF) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (windows-2019, 6.6.0, ON) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (windows-2019, 6.7.0, OFF) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (windows-2019, 6.7.0, ON) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (windows-2022, 5.12.12, OFF) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (windows-2022, 5.12.12, ON) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (windows-2022, 5.15.2, OFF) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (windows-2022, 5.15.2, ON) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (windows-2022, 6.4.0, OFF) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (windows-2022, 6.4.0, ON) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (windows-2022, 6.5.0, OFF) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (windows-2022, 6.5.0, ON) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (windows-2022, 6.6.0, OFF) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (windows-2022, 6.6.0, ON) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (windows-2022, 6.7.0, OFF) (push) Has been cancelled
CMake / ${{ matrix.os }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} (windows-2022, 6.7.0, ON) (push) Has been cancelled
- Expand Duotone to support Solid, Regular, Light and Thin - Add Sharp Duoto styles - Deprecated Duotone (without style)
95 lines
3.4 KiB
C++
95 lines
3.4 KiB
C++
#include "mainwindow.h"
|
|
#include "ui_mainwindow.h"
|
|
#include "QtAwesome.h"
|
|
#include <QStandardItemModel>
|
|
#include <QMap>
|
|
#include <QDebug>
|
|
|
|
MainWindow::MainWindow(QWidget *parent) :
|
|
QMainWindow(parent),
|
|
ui(new Ui::MainWindow)
|
|
{
|
|
ui->setupUi(this);
|
|
awesome = new fa::QtAwesome(this);
|
|
awesome->initFontAwesome();
|
|
|
|
ui->comboBox->addItem("Solid", fa::fa_solid);
|
|
ui->comboBox->addItem("Brands", fa::fa_brands);
|
|
ui->comboBox->addItem("Regular", fa::fa_regular);
|
|
#ifdef FONT_AWESOME_PRO
|
|
ui->comboBox->addItem("Light", fa::fa_light);
|
|
ui->comboBox->addItem("Thin", fa::fa_thin);
|
|
// ui->comboBox->addItem("Duotone", fa::fa_duotone); // DEPRECATED
|
|
ui->comboBox->addItem("Duotone Solid", fa::fa_duotone);
|
|
ui->comboBox->addItem("Duotone Regular", fa::fa_duotone_regular);
|
|
ui->comboBox->addItem("Duotone Light", fa::fa_duotone_light);
|
|
ui->comboBox->addItem("Duotone Thin", fa::fa_duotone_thin);
|
|
ui->comboBox->addItem("Sharp Solid", fa::fa_sharp_solid);
|
|
ui->comboBox->addItem("Sharp Regular", fa::fa_sharp_regular);
|
|
ui->comboBox->addItem("Sharp Light", fa::fa_sharp_light);
|
|
ui->comboBox->addItem("Sharp Thin", fa::fa_sharp_thin);
|
|
ui->comboBox->addItem("Sharp Duotone Solid", fa::fa_sharp_duotone_solid);
|
|
ui->comboBox->addItem("Sharp Duotone Regular", fa::fa_sharp_duotone_regular);
|
|
ui->comboBox->addItem("Sharp Duotone Light", fa::fa_sharp_duotone_light);
|
|
ui->comboBox->addItem("Sharp Duotone Thin", fa::fa_sharp_duotone_thin);
|
|
#endif
|
|
|
|
// a simple beer button
|
|
//=====================
|
|
{
|
|
QPushButton* beerButton = ui->beerButton;
|
|
|
|
QVariantMap options;
|
|
options.insert("anim", QVariant::fromValue(new fa::QtAwesomeAnimation(beerButton)));
|
|
|
|
// below are the possible variation to show thi icon
|
|
beerButton->setIcon(awesome->icon(fa::fa_solid, fa::fa_beer_mug_empty, options));
|
|
// beerButton->setIcon(awesome->icon("fa-solid fa-beer-mug-empty", options));
|
|
// beerButton->setIcon(awesome->icon("beer-mug-empty", options));
|
|
// beerButton->setIcon(awesome->icon("solid beer-mug-empty", options));
|
|
}
|
|
|
|
// a simple checkbox button
|
|
//=========================
|
|
{
|
|
QPushButton* toggleButton = ui->toggleButton;
|
|
toggleButton->setCheckable(true);
|
|
|
|
QVariantMap options;
|
|
options.insert("color", QColor(Qt::yellow));
|
|
options.insert("text-off", QString(fa::fa_square));
|
|
options.insert("color-off", QColor(Qt::darkBlue));
|
|
toggleButton->setIcon( awesome->icon("fa_solid square-check", options));
|
|
}
|
|
|
|
QStandardItemModel* model = new QStandardItemModel(this);
|
|
ui->listView->setModel(model);
|
|
|
|
connect(ui->comboBox, SIGNAL(activated(int)), this, SLOT(styleChanged(int)));
|
|
styleChanged(fa::fa_solid);
|
|
}
|
|
|
|
MainWindow::~MainWindow()
|
|
{
|
|
delete ui;
|
|
}
|
|
|
|
void MainWindow::styleChanged(int index)
|
|
{
|
|
Q_UNUSED(index)
|
|
QVariant styleValue = ui->comboBox->currentData();
|
|
int style = styleValue.toInt();
|
|
|
|
QHash<QString, int> iconset = awesome->namedCodePoints(style);
|
|
|
|
QStandardItemModel *model = dynamic_cast<QStandardItemModel*>(ui->listView->model());
|
|
model->clear();
|
|
|
|
for (QHash<QString, int>::iterator i=iconset.begin(); i != iconset.end(); ++i) {
|
|
QString name = i.key();
|
|
int ic = i.value();
|
|
model->appendRow(new QStandardItem(awesome->icon(style, ic), name));
|
|
}
|
|
model->sort(0);
|
|
}
|