I declared two icons in my GUI and resized them by using Adobe illustrator. But they still showed in different size in my GUI. Is there any method to resize them in Qt? Thanks a lot!
void WToolbar::setCandlesColor()
{
QIcon icon("./src/icon/toolbar/chart-histogram-01.png");
QPixmap pixmap = icon.pixmap(QSize(30, 30)); // set desired size here
SetColor = std::make_shared<QAction>(QIcon(pixmap), QString("Button"), toolbar_.get());
SetColor->setToolTip("Green Bullish/ Red Bearish");
SetColor->setIconVisibleInMenu(true);
toolbar_->addAction(SetColor.get());
connect(SetColor.get(), &QAction::triggered, plotter_.get(), &WPlotter::colorSwitch);
connect(SetColor.get(), &QAction::triggered, this, &WToolbar::iconSwitch);
}
void WToolbar::setMA5()
{
QIcon icon("./src/icon/toolbar/chart-line-up-ma5.png");
QPixmap pixmap = icon.pixmap(QSize(30, 30)).scaled(QSize(30, 30), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);; // set desired size here
PlotMA5 = std::make_shared<QAction>(QIcon(pixmap), QString("Button"), toolbar_.get());
PlotMA5->setToolTip("show/hide MA5");
PlotMA5->setIconVisibleInMenu(true);
toolbar_->addAction(PlotMA5.get());
connect(PlotMA5.get(), &QAction::triggered, plotter_.get(), &WPlotter::plotMA5);
}