Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3976816
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T04:50:59+00:00 2026-05-20T04:50:59+00:00

How would one extend the standard icons provided by the QStyle class with support

  • 0

How would one extend the standard icons provided by the QStyle class with support for Windows and Linux in mind?

namespace Ui {
  class TVLoader;
}

class TVLoader : public QMainWindow
{
  Q_OBJECT

public:
  explicit TVLoader(QWidget *parent = 0) :
  QMainWindow(parent),
  ui(new Ui::TVLoader)
{
  ui->setupUi(this);
  ui->actionAdd_TV_Show->setIcon(style()->standardIcon(?)); // this is where I would need some kind of "Add" icon which unfortunately doesn't exist
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T04:51:00+00:00Added an answer on May 20, 2026 at 4:51 am

    You man want to subclass QStyle if you want to provide your own icons, reimplement the standardIconImplementation() slot in your subclass and return a new icon from there. Below is an example:

    class MyProxyStyle : public QProxyStyle
    {
        Q_OBJECT
    
    public:
        MyProxyStyle(QStyle *style = 0) : QProxyStyle(style) { }
    
    public slots:
        QIcon standardIconImplementation(StandardPixmap standardIcon,
                                         const QStyleOption *option = 0,
                                         const QWidget *widget = 0) const
        {
            // check the standardIcon parameter for the icon type 
            if (standardIcon==QStyle::SP_DesktopIcon)
            {
                // return your new icon here
                standardIcon = QStyle::SP_DirIcon;
            }
            return QProxyStyle::standardIconImplementation(standardIcon, option, widget);
        }
    };
    

    here’s how can you use it:

    // set new style for your widget
    setStyle(new MyProxyStyle(style()));
    // return different icon for QStyle::SP_DesktopIcon
    action0->setIcon(style()->standardIcon(QStyle::SP_DesktopIcon));
    

    hope this helps, regards

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How would one extend the Paginator class in django.core.paginator to work with Google App
How would one switch a public bool to true from a child form in
Why would one use func( const Class &value ) rather than just func( Class
I have a google app engine app where I would like to extend one
Background: I am currently trying to extend standard C formatting with support for handling
How would one shorten the following using ternary operators? if ((pos - maxPos) ==
How would one insert an array full of smtp email addresses into an AD
How would one enumerate the installed browsers on an OS X system from a
How would one follow the proper steps in order to license a package under
How would one typically implement a service layer in an MVC architecture? Is it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.