Skip to content

Commit

Permalink
Fix button icon display on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
huxingyi committed Dec 16, 2022
1 parent 3717d55 commit 59829e7
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 25 deletions.
10 changes: 5 additions & 5 deletions application/sources/bone_manage_widget.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ BoneManageWidget::BoneManageWidget(Document* document, QWidget* parent)

setStyleSheet("QPushButton:disabled {border: 0; color: " + Theme::gray.name() + "}");

auto createButton = [](QChar icon, const QString& title) {
QPushButton* button = new QPushButton(icon);
auto createButton = [](QIcon icon, const QString& title) {
QPushButton* button = new QPushButton(icon, "");
Theme::initIconButton(button);
button->setToolTip(title);
return button;
};

m_addButton = createButton(QChar(fa::plus), tr("Add new bone"));
m_selectButton = createButton(QChar(fa::objectgroup), tr("Select them on canvas"));
m_propertyButton = createButton(QChar(fa::sliders), tr("Configure properties"));
m_addButton = createButton(Theme::awesome()->icon(fa::plus), tr("Add new bone"));
m_selectButton = createButton(Theme::awesome()->icon(fa::objectgroup), tr("Select them on canvas"));
m_propertyButton = createButton(Theme::awesome()->icon(fa::sliders), tr("Configure properties"));

toolsLayout->addWidget(m_addButton);
toolsLayout->addWidget(m_selectButton);
Expand Down
2 changes: 1 addition & 1 deletion application/sources/bone_property_widget.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ BonePropertyWidget::BonePropertyWidget(Document* document,
m_jointsWidget = new IntNumberWidget;
m_jointsWidget->setRange(2, 10);

QPushButton* nodePicker = new QPushButton(QChar(fa::eyedropper));
QPushButton* nodePicker = new QPushButton(Theme::awesome()->icon(fa::eyedropper), "");
nodePicker->setToolTip(tr("Click node one by one on canvas as joints in order"));
Theme::initIconButton(nodePicker);

Expand Down
16 changes: 8 additions & 8 deletions application/sources/component_property_widget.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ ComponentPropertyWidget::ComponentPropertyWidget(Document* document,
colorPreviewArea->setStyleSheet("QPushButton {background-color: " + m_color.name() + "; border-radius: 0;}");
colorPreviewArea->setFixedSize(Theme::toolIconSize * 1.8, Theme::toolIconSize);

QPushButton* colorPickerButton = new QPushButton(QChar(fa::eyedropper));
QPushButton* colorPickerButton = new QPushButton(Theme::awesome()->icon(fa::eyedropper), "");
Theme::initIconButton(colorPickerButton);
connect(colorPickerButton, &QPushButton::clicked, this, &ComponentPropertyWidget::showColorDialog);

Expand Down Expand Up @@ -91,15 +91,15 @@ ComponentPropertyWidget::ComponentPropertyWidget(Document* document,
emit groupOperationAdded();
});

QPushButton* thicknessEraser = new QPushButton(QChar(fa::eraser));
QPushButton* thicknessEraser = new QPushButton(Theme::awesome()->icon(fa::eraser), "");
Theme::initIconButton(thicknessEraser);

connect(thicknessEraser, &QPushButton::clicked, [=]() {
thicknessWidget->setValue(1.0);
emit groupOperationAdded();
});

QPushButton* widthEraser = new QPushButton(QChar(fa::eraser));
QPushButton* widthEraser = new QPushButton(Theme::awesome()->icon(fa::eraser), "");
Theme::initIconButton(widthEraser);

connect(widthEraser, &QPushButton::clicked, [=]() {
Expand Down Expand Up @@ -150,23 +150,23 @@ ComponentPropertyWidget::ComponentPropertyWidget(Document* document,
emit groupOperationAdded();
});

QPushButton* rotationEraser = new QPushButton(QChar(fa::eraser));
QPushButton* rotationEraser = new QPushButton(Theme::awesome()->icon(fa::eraser), "");
Theme::initIconButton(rotationEraser);

connect(rotationEraser, &QPushButton::clicked, [=]() {
rotationWidget->setValue(0.0);
emit groupOperationAdded();
});

QPushButton* rotationMinus5Button = new QPushButton(QChar(fa::rotateleft));
QPushButton* rotationMinus5Button = new QPushButton(Theme::awesome()->icon(fa::rotateleft), "");
Theme::initIconButton(rotationMinus5Button);

connect(rotationMinus5Button, &QPushButton::clicked, [=]() {
rotationWidget->setValue(-0.5);
emit groupOperationAdded();
});

QPushButton* rotation5Button = new QPushButton(QChar(fa::rotateright));
QPushButton* rotation5Button = new QPushButton(Theme::awesome()->icon(fa::rotateright), "");
Theme::initIconButton(rotation5Button);

connect(rotation5Button, &QPushButton::clicked, [=]() {
Expand Down Expand Up @@ -230,7 +230,7 @@ ComponentPropertyWidget::ComponentPropertyWidget(Document* document,
colorImagePreviewWidget->setFixedSize(Theme::partPreviewImageSize * 2, Theme::partPreviewImageSize * 2);
auto colorImageId = lastColorImageId();
colorImagePreviewWidget->updateImage(colorImageId.isNull() ? QImage() : *ImageForever::get(colorImageId));
QPushButton* colorImageEraser = new QPushButton(QChar(fa::eraser));
QPushButton* colorImageEraser = new QPushButton(Theme::awesome()->icon(fa::eraser), "");
Theme::initIconButton(colorImageEraser);

connect(colorImageEraser, &QPushButton::clicked, [=]() {
Expand All @@ -239,7 +239,7 @@ ComponentPropertyWidget::ComponentPropertyWidget(Document* document,
emit groupOperationAdded();
});

QPushButton* colorImagePicker = new QPushButton(QChar(fa::image));
QPushButton* colorImagePicker = new QPushButton(Theme::awesome()->icon(fa::image), "");
Theme::initIconButton(colorImagePicker);

connect(colorImagePicker, &QPushButton::clicked, [=]() {
Expand Down
22 changes: 11 additions & 11 deletions application/sources/part_manage_widget.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,22 @@ PartManageWidget::PartManageWidget(Document* document, QWidget* parent)

setStyleSheet("QPushButton:disabled {border: 0; color: " + Theme::gray.name() + "}");

auto createButton = [](QChar icon, const QString& title) {
QPushButton* button = new QPushButton(icon);
auto createButton = [](QIcon icon, const QString& title) {
QPushButton* button = new QPushButton(icon, "");
Theme::initIconButton(button);
button->setToolTip(title);
return button;
};

m_levelUpButton = createButton(QChar(fa::levelup), tr("Go level up"));
m_selectButton = createButton(QChar(fa::objectgroup), tr("Select them on canvas"));
m_lockButton = createButton(QChar(fa::lock), tr("Lock them on canvas"));
m_unlockButton = createButton(QChar(fa::unlock), tr("Unlock them on canvas"));
m_showButton = createButton(QChar(fa::eye), tr("Show them on canvas"));
m_hideButton = createButton(QChar(fa::eyeslash), tr("Hide them on canvas"));
m_unlinkButton = createButton(QChar(fa::unlink), tr("Exclude them from result generation"));
m_linkButton = createButton(QChar(fa::link), tr("Include them in result generation"));
m_propertyButton = createButton(QChar(fa::sliders), tr("Configure properties"));
m_levelUpButton = createButton(Theme::awesome()->icon(fa::levelup), tr("Go level up"));
m_selectButton = createButton(Theme::awesome()->icon(fa::objectgroup), tr("Select them on canvas"));
m_lockButton = createButton(Theme::awesome()->icon(fa::lock), tr("Lock them on canvas"));
m_unlockButton = createButton(Theme::awesome()->icon(fa::unlock), tr("Unlock them on canvas"));
m_showButton = createButton(Theme::awesome()->icon(fa::eye), tr("Show them on canvas"));
m_hideButton = createButton(Theme::awesome()->icon(fa::eyeslash), tr("Hide them on canvas"));
m_unlinkButton = createButton(Theme::awesome()->icon(fa::unlink), tr("Exclude them from result generation"));
m_linkButton = createButton(Theme::awesome()->icon(fa::link), tr("Include them in result generation"));
m_propertyButton = createButton(Theme::awesome()->icon(fa::sliders), tr("Configure properties"));

toolsLayout->addWidget(m_levelUpButton);
toolsLayout->addWidget(m_selectButton);
Expand Down

0 comments on commit 59829e7

Please sign in to comment.