Project

General

Profile

font-awesome icons in WMenuItem

Added by Lukáš Kopernický about 2 years ago

Hi, everyone.

I have a very newbie question. Can anyone tell me, how can I use a font-awesome icon in WMenuItem? I can't figure it out on my own.
Thanx


Replies (1)

RE: font-awesome icons in WMenuItem - Added by Pony Dazzler over 1 year ago

This will get the icon to appear on the menu. If you have text next to the icon then you will need CSS to make them align properly.

/* In your Application Setup */
this->useStyleSheet(Wt::WLink("//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"));

/* Adding your menu items */

auto menuItem2 = cellMenu->addItem(Wt::WString("Create Note"));
 menuItem2->setStyleClass("fa fa-car");
    (1-1/1)