<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5570325845627933731</id><updated>2025-09-19T06:07:37.562-07:00</updated><category term="Qt"/><category term="Qt4"/><category term="Symbian"/><category term="Listview"/><category term="Custombutton"/><category term="Qpushbutton"/><category term="Resources"/><category term="Delegates"/><category term="Files"/><category term="Internationalization"/><category term="Linguist"/><category term="Localization"/><category term="Nokia"/><category term="OVI"/><category term="Qlistview"/><category term="Qpainter"/><category term="QtLinguist"/><category term="SmartInstaller"/><category term="Stylesheet"/><category term="View switching"/><category term="Widgets"/><category term="menus"/><category term="sisfile"/><category term="softkeys"/><title type='text'>Qt Articles:Qt sample codes,Qt programming</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://qt-articles.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5570325845627933731/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://qt-articles.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Contributor</name><uri>http://www.blogger.com/profile/03464211634349148049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>9</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5570325845627933731.post-312499200300536459</id><published>2011-02-24T11:02:00.000-08:00</published><updated>2011-02-24T11:02:12.843-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Listview"/><category scheme="http://www.blogger.com/atom/ns#" term="Qt"/><category scheme="http://www.blogger.com/atom/ns#" term="View switching"/><category scheme="http://www.blogger.com/atom/ns#" term="Widgets"/><title type='text'>How to use Qstackedwidget in Qt (Switching between multiple views in Qt)</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Hi all today we shall see about how to use stackedwidget in QT.&lt;br /&gt;
&lt;br /&gt;
You might have confusion that how to handle mutiple views in QT?, for example you are in an inbox widget and you will switch to message widget. How to handle this sort of situations? you may think that hiding the inbox widget and going to message widget or delete the inbox widget and recreate it after coming back from message widget.But this could be a temporary solution not the better approach,the better approch is to use Qt Stackedwidget.&lt;br /&gt;
&lt;br /&gt;
The concept is very simple, when you are in one widget and you will switch to another widget just push the current widget into stack and proceed to next widget, when you are coming back to the previous widget just delete the current widget and pop up the previous widget from the stack.&lt;br /&gt;
&lt;br /&gt;
Most of Qt apps will have a Mainwindow and formed with multiple widgets, Mainwindow has menubar,when you switch to any widget just delete the current menu actions form window and load it with the new actions from widget. so if you do like this then, you always have a single class which is derived from &quot;Qmainwindow&quot;&amp;nbsp;thought&amp;nbsp;the application.&lt;br /&gt;
&lt;br /&gt;
In mainwindow itself, you need to handle all the possibalities like when setting back menu,setting exit or is exit required throught application and many other things depending on your requirements.&lt;br /&gt;
&lt;br /&gt;
Here is the simple example i have created which demonstrate how to use stackedwidget in QT.&lt;br /&gt;
in this i would like to explain few mainwindow functions which may be usefull.&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: yellow;&quot;&gt;&quot;Qt_Stackwidget::activeWidgetChanged(int index)&quot;&lt;/span&gt;---&amp;gt;; This gets called when the new widget is created with index of it, so clear the window menu bar and load it with new menus assosiated with new widget&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: yellow;&quot;&gt;&quot;Qt_Stackwidget::changeCBA(QBaseWidget* current)&quot;&lt;/span&gt;---&amp;gt;; This is for adding the back or exit based on the widget type, for example in first widget you should keep exit or else back would be preffered. &lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: yellow;&quot;&gt;&quot;Qt_Stackwidget::activatePerviousView()&quot;&lt;/span&gt;---&amp;gt;;This is for activating the previous view by deleting the current one when you hit back menu.&lt;br /&gt;
&lt;br /&gt;
Here is the simple source code, i have created widgets &amp;amp; view switching logic in the single file itself ,you can split it to multiple and use it accordingly.&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: yellow;&quot;&gt;Qt_Stackwidget.cpp&lt;/span&gt;&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;//Qt-articles.blogspot.com
#include &quot;Qt_Stackwidget.h&quot;

Qt_Stackwidget::Qt_Stackwidget(QWidget *parent)
    : QMainWindow(parent)
{
    //ui.setupUi(this);
    back = NULL;
    stack = new QStackedWidget();
    QObject::connect(stack, SIGNAL(currentChanged(int)),this, SLOT(activeWidgetChanged(int)));
    stack-&amp;gt;addWidget(new Homewidget(stack));
    setCentralWidget(stack);
}

Qt_Stackwidget::~Qt_Stackwidget()
{

}
//when new widget is inserted to stack
void Qt_Stackwidget::activeWidgetChanged(int index)
    {
    // Current widget changed, we use menubar of the new widget
    QBaseWidget* current = static_cast&amp;lt;QBaseWidget*&amp;gt;(stack-&amp;gt;widget(index));
    //changeCBA(current);
    if (current)
        {
        // NOTE: need to set focus for the active widget. 
        // Enviroment search CBA buttons from the active widget and use these.
        // CBA buttons for the active focused widget is set in changeCBA()
        current-&amp;gt;setFocus();
        // Update menubar of the QMainWindow
        QMenuBar* menubar = this-&amp;gt;menuBar();
        menubar-&amp;gt;clear();
        for (int i=0;i&amp;lt;current-&amp;gt;GetMenuBar()-&amp;gt;actions().count();i++)
            {
            QAction *act = current-&amp;gt;GetMenuBar()-&amp;gt;actions()[i];
           
            menubar-&amp;gt;addAction(act);
            }
        createBaseMenu();
        }
    // Set correct CBA buttons for the active widget
    changeCBA(current);
    }
//Qt-articles.blogspot.com
void Qt_Stackwidget::createBaseMenu()
    {
    // All widgets in QStackedWidget have this exit menu item
    menuBar()-&amp;gt;addAction(&quot;Exit&quot;,this,SLOT(close()));
    }

void Qt_Stackwidget::changeCBA(QBaseWidget* current)
    {
    if (current)
        {
        QString classname = current-&amp;gt;metaObject()-&amp;gt;className();
        if(back != NULL)
           {
                  delete back;
                 back = NULL;
           }
        if (classname == &quot;Firstwidget&quot; || classname == &quot;Secwidget&quot; || classname == &quot;Thiredwidget&quot;)
            {
            // Change Back left softkey for QMyWidget2 and QMyWidget3
            createOptionsBackCBA(current);
            }
        else
            {
            // rest have Exit left softkey
            createOptionsExitCBA(current);
            }
        }
    }

void Qt_Stackwidget::createOptionsExitCBA(QWidget* current)
    {
    
    back = new QAction(&quot;Exit&quot;, this);
    back-&amp;gt;setSoftKeyRole(QAction::NegativeSoftKey);
    QObject::connect(back, SIGNAL(triggered()), this, SLOT(close()));
    this-&amp;gt;addAction(back);
 
    }
//Qt-articles.blogspot.com
void Qt_Stackwidget::createOptionsBackCBA(QBaseWidget* current)
    { 
    // Create exit right CBA
    back = new QAction(&quot;Back&quot;, this);
    back-&amp;gt;setSoftKeyRole(QAction::NegativeSoftKey);
    QObject::connect(back, SIGNAL(triggered()), this, SLOT(activatePerviousView()));
    this-&amp;gt;addAction(back);
    }

int Qt_Stackwidget::activatePerviousView()
    {
    int ret = -1;
    QString currentName = stack-&amp;gt;currentWidget()-&amp;gt;metaObject()-&amp;gt;className();
    QString previous;
    
    int count = stack-&amp;gt;count();
    for (int i=stack-&amp;gt;count()-1;i&amp;gt;=0;i--)
        {
        QWidget* w = stack-&amp;gt;widget(i);
        if (w-&amp;gt;metaObject()-&amp;gt;className()==currentName)
            {
           
                {
                i--;
                previous = stack-&amp;gt;widget(i)-&amp;gt;metaObject()-&amp;gt;className();
                ret = 0;            
                stack-&amp;gt;setCurrentWidget(stack-&amp;gt;widget(i));
                stack-&amp;gt;removeWidget(w);
                delete w;
                // Activate prevous widget
                //activateWidget(previous);
                }
            break;
            }
        }
   return ret;
    }

Homewidget::Homewidget(QStackedWidget* stackedWidget,QWidget *parent)
    : QBaseWidget(parent)
{
    //Create 3 Buttonss
    BaseStackwidget = stackedWidget;
    widget1 = new QPushButton(&quot;Create message&quot;);
     QObject::connect(widget1,SIGNAL(clicked()),this, SLOT(CreateFirstwidget()));
    widget2 = new QPushButton(&quot;Inbox&quot;);
     QObject::connect(widget2,SIGNAL(clicked()),this, SLOT(CreateSecwidget()));
    widget3 = new QPushButton(&quot;Outbox&quot;);
     QObject::connect(widget3,SIGNAL(clicked()),this, SLOT(CreateThiredwidget()));
    
    createMenus();
    //Add the widget to layouts
    layout = new QVBoxLayout();
    layout-&amp;gt;addWidget(widget1);
    layout-&amp;gt;addWidget(widget2);
    layout-&amp;gt;addWidget(widget3);
    setLayout(layout);
}

Homewidget::~Homewidget()
{

}
//Create the first widget
void Homewidget::CreateFirstwidget()
    {
    Firstwidget *first= new Firstwidget(BaseStackwidget);
    BaseStackwidget-&amp;gt;addWidget(first);
    BaseStackwidget-&amp;gt;setCurrentWidget(first);
    }
//Create the sec widget
void Homewidget::CreateSecwidget()
    {
    
    Secwidget *sec= new Secwidget(BaseStackwidget);
    BaseStackwidget-&amp;gt;addWidget(sec);
    BaseStackwidget-&amp;gt;setCurrentWidget(sec);
    }
//Create the thired widget
void Homewidget::CreateThiredwidget()
    {
    Thiredwidget *thiredwid = new Thiredwidget(BaseStackwidget);
    BaseStackwidget-&amp;gt;addWidget(thiredwid);
    BaseStackwidget-&amp;gt;setCurrentWidget(thiredwid);
    }

QMenuBar* Homewidget::GetMenuBar() const
    {
      return menuBar;
    }
//Qt-articles.blogspot.com
void Homewidget::createMenus()
    {
    // Create menubar for this widget
    // We sets these menu items into into QMainWindow menu when this widget is active
    menuBar = new QMenuBar();

    FirstwidgetAction = new QAction(&quot;Create message&quot;,menuBar);
    menuBar-&amp;gt;addAction(FirstwidgetAction);
    connect(FirstwidgetAction, SIGNAL(triggered()),this, SLOT(CreateFirstwidget()));

    SecwidgetAction = new QAction(&quot;Inbox&quot;,menuBar);
    menuBar-&amp;gt;addAction(SecwidgetAction);
    connect(SecwidgetAction, SIGNAL(triggered()),this, SLOT(CreateSecwidget()));

    ThiredwidgetAction = new QAction(&quot;Outbox&quot;,menuBar);
    menuBar-&amp;gt;addAction(ThiredwidgetAction);
    connect(ThiredwidgetAction, SIGNAL(triggered()),this, SLOT(CreateThiredwidget()));
    }

Firstwidget::Firstwidget(QStackedWidget* stackedWidget,QWidget *parent)
    :QBaseWidget(parent)
{
    BaseStackwidget = stackedWidget;
    widget2 = new QPushButton(&quot;Text Message&quot;);
    bool val = QObject::connect(widget2,SIGNAL(clicked()),this, SLOT(CreateSecwidget()));
    widget3 = new QPushButton(&quot;Multimedia Message&quot;);
    QObject::connect(widget3,SIGNAL(clicked()),this, SLOT(CreateThiredwidget()));
         
    createMenus();
     
    layout = new QVBoxLayout();
    layout-&amp;gt;addWidget(widget2);
    layout-&amp;gt;addWidget(widget3);
        
    setLayout(layout);
}

void Firstwidget::CreateSecwidget()
    {
    Secwidget *sec= new Secwidget(BaseStackwidget);
    BaseStackwidget-&amp;gt;addWidget(sec);
    BaseStackwidget-&amp;gt;setCurrentWidget(sec);
    }
//Qt-articles.blogspot.com
void Firstwidget::CreateThiredwidget()
    {
    Thiredwidget *thired= new Thiredwidget(BaseStackwidget);
    BaseStackwidget-&amp;gt;addWidget(thired);
    BaseStackwidget-&amp;gt;setCurrentWidget(thired);
    }

void Firstwidget::createMenus()
{
    menuBar = new QMenuBar();
        
    SecwidgetAction = new QAction(&quot;Text Message&quot;,menuBar);
    menuBar-&amp;gt;addAction(SecwidgetAction);
    connect(SecwidgetAction, SIGNAL(triggered()),this, SLOT(CreateSecwidget()));

    ThiredwidgetAction = new QAction(&quot;Multimedia Message&quot;,menuBar);
    menuBar-&amp;gt;addAction(ThiredwidgetAction);
    connect(ThiredwidgetAction, SIGNAL(triggered()),this, SLOT(CreateThiredwidget()));
}

QMenuBar* Firstwidget::GetMenuBar() const
{
    return menuBar;
}

Secwidget::Secwidget(QStackedWidget* stackedWidget,QWidget *parent)
    :QBaseWidget(parent)
{
    BaseStackwidget = stackedWidget;
    widget3 = new QLabel(&quot;You are in the last screen, plese press back to go to previous screen&quot;);
        
    bool val = QObject::connect(widget3,SIGNAL(clicked()),this, SLOT(CreateThiredwidget()));
         
    createMenus();
    layout = new QVBoxLayout();
    layout-&amp;gt;addWidget(widget3);    
    setLayout(layout);
        
}
//Qt-articles.blogspot.com
void Secwidget::CreateThiredwidget()
{
    Thiredwidget *thired= new Thiredwidget(BaseStackwidget);
    BaseStackwidget-&amp;gt;addWidget(thired);
    BaseStackwidget-&amp;gt;setCurrentWidget(thired);
  //add the code to create thired widget, and with menu exit and right back
}

void Secwidget::createMenus()
{
    menuBar = new QMenuBar();
        //connect(menuBar, SIGNAL(triggered()),this, SLOT(CreateThiredwidget()));
    //ThiredwidgetAction = new QAction(&quot;Thired Widget&quot;,menuBar);
    //menuBar-&amp;gt;addAction(ThiredwidgetAction);
    
}

QMenuBar* Secwidget::GetMenuBar() const
{
    return menuBar;
}

Thiredwidget::Thiredwidget(QStackedWidget* stackedWidget,QWidget *parent)
    :QBaseWidget(parent)
{
    BaseStackwidget = stackedWidget;
    thiredwidgetLabel = new QLabel(&quot;You are in the last screen, plese press back to go to previous screen&quot;);
    createMenus();
    layout = new QVBoxLayout();    
    layout-&amp;gt;addWidget(thiredwidgetLabel);
    setLayout(layout);    
}

void Thiredwidget::createMenus()
{
    menuBar = new QMenuBar();
    //connect(menuAction2, SIGNAL(triggered()),this, SLOT(createWidget2()));
}

QMenuBar* Thiredwidget::GetMenuBar() const
{
    return menuBar;
}

&lt;/code&gt;&lt;/pre&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: yellow;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: yellow;&quot;&gt;Qt_Stackwidget.h&lt;/span&gt;&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;//Qt-articles.blogspot.com

#include &amp;lt;QtGui/QMainWindow&amp;gt;
#include &quot;ui_Qt_Stackwidget.h&quot;
#include &amp;lt;QtGui&amp;gt;

class QBaseWidget;

class Qt_Stackwidget : public QMainWindow
{
    Q_OBJECT

public:
    Qt_Stackwidget(QWidget *parent = 0);
    ~Qt_Stackwidget();
    void createBaseMenu();
    void changeCBA(QBaseWidget* current);
    void createOptionsBackCBA(QBaseWidget* current);
    void createOptionsExitCBA(QWidget* current); 
    QAction* back;
    
    public slots:
    int activatePerviousView();
    
 
   
public:
    Ui::Qt_Stackwidget ui;
    QStackedWidget *stack;
    
private slots:
    void activeWidgetChanged(int index);
};

class QBaseWidget : public QWidget
    {
    Q_OBJECT

    public:
        QBaseWidget(QWidget *parent = 0)
            {
        
            }
        virtual ~QBaseWidget()
            {
            
            }

    public:
       
        // Returns widget menu
        virtual QMenuBar* GetMenuBar() const=0;

        // Exit from the app        
    protected:
        // Widget own menubar
        QMenuBar*           menuBar;
        
        // Pointer to QStackedWidget where all views exists
        QStackedWidget*     BaseStackwidget;
    };

class Homewidget : public QBaseWidget
    {
     Q_OBJECT

    public:
     Homewidget(QStackedWidget* stackedWidget,QWidget *parent = 0);
        ~Homewidget();
        
        QMenuBar* GetMenuBar() const;
        void createMenus();
        
                
   public slots:
        void CreateFirstwidget();
        void CreateSecwidget();
        void CreateThiredwidget();

    private :
        QMenuBar *menuBar;
        QPushButton *widget1;
        QPushButton *widget2;
        QPushButton *widget3;
        QVBoxLayout *layout;
        
        QAction *FirstwidgetAction;
        QAction *SecwidgetAction;
        QAction *ThiredwidgetAction;
      
    
    };
//First widget class
class Firstwidget : public QBaseWidget
    {
     Q_OBJECT

    public:
     Firstwidget(QStackedWidget* stackedWidget,QWidget *parent = 0);
        ~Firstwidget()
            {
            
            }
        
        QMenuBar* GetMenuBar() const;
        void createMenus();
        
   public slots:
        void CreateSecwidget();
        void CreateThiredwidget();

    private :
        QMenuBar *menuBar;
        
        QPushButton *widget2;
        QPushButton *widget3;
        QVBoxLayout *layout;
        
        QAction *SecwidgetAction;
        QAction *ThiredwidgetAction;
    
    };
//Second widget class
class Secwidget : public QBaseWidget
    {
     Q_OBJECT

    public:
     Secwidget(QStackedWidget* stackedWidget,QWidget *parent = 0);
        ~Secwidget()
            {
            
            }
        
        QMenuBar* GetMenuBar() const;
        void createMenus();
        
   public slots:
        //void CreateSecwidget();
        void CreateThiredwidget();

    private :
        QMenuBar *menuBar;
        
        QLabel *widget3;
        QVBoxLayout *layout;
        QLabel *thiredwidgetlabel;
        
        QAction *ThiredwidgetAction;
    
    };

class Thiredwidget : public QBaseWidget
    {
     Q_OBJECT

    public:
     Thiredwidget(QStackedWidget* stackedWidget,QWidget *parent = 0);
        ~Thiredwidget()
            {
            
            }
        QMenuBar* GetMenuBar() const;
        void createMenus();
        
    private :
        QMenuBar *menuBar;
        QVBoxLayout *layout;
        QLabel *thiredwidgetLabel;
    };
#endif // QT_STACKWIDGET_H

&lt;/code&gt;&lt;/pre&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;Some of the screenshots of output.&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFwQnkiPRWuEilGv4U-GE1O0KcmPjVaAK9LEcEViLneQFxQP2GHmU2avA-Ch5PGou4Yac-bl-vjpwIrCFRe5XHQ4XydO1BD9FT6zziuYEA_TIqONPnFDRe7YkE1D2sDYANTCb_s0lTe_c/s1600/stack1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;248&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFwQnkiPRWuEilGv4U-GE1O0KcmPjVaAK9LEcEViLneQFxQP2GHmU2avA-Ch5PGou4Yac-bl-vjpwIrCFRe5XHQ4XydO1BD9FT6zziuYEA_TIqONPnFDRe7YkE1D2sDYANTCb_s0lTe_c/s320/stack1.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg3V4pqvcxRWdpbGMIxBmcby3Za8RZ48RUNhIBeSetZaWwexb8fF6bSikL7zsubUSsJh1tQDY5tPjm7WPr0Zd29fa_Xe6pqv5MHlYklBcodLvxFE6AjK7WTi4wlZHTIknaRUpc759TtsbQ/s1600/stack2.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;251&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg3V4pqvcxRWdpbGMIxBmcby3Za8RZ48RUNhIBeSetZaWwexb8fF6bSikL7zsubUSsJh1tQDY5tPjm7WPr0Zd29fa_Xe6pqv5MHlYklBcodLvxFE6AjK7WTi4wlZHTIknaRUpc759TtsbQ/s320/stack2.PNG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgBN4nHPjKMtsCJkZcs55d8UOhkdzDHqeMlrVqyc9UZ2bc-cHV-6dXx9kvLO4etMN-88lK64K-H4K_gUqV0a8pin5FGtIEYxXiOKZOMdHhvDEiLlNK5Mehvcu1gp0QjfvqUW6YV-u6BzC0/s1600/stack5.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;253&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgBN4nHPjKMtsCJkZcs55d8UOhkdzDHqeMlrVqyc9UZ2bc-cHV-6dXx9kvLO4etMN-88lK64K-H4K_gUqV0a8pin5FGtIEYxXiOKZOMdHhvDEiLlNK5Mehvcu1gp0QjfvqUW6YV-u6BzC0/s320/stack5.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKMSFryTck4uFBZRooyMl_Q5NnhfhIySVcWwmr9H-eCE1XiOSNkawk7KXqZm62Tep6X_5yTuPtdM-VhsqMGduXxXouZKV_hagIGMN5pDqw7xR7sYh0DqXXmM1MW-5jrHdS3yG-ywxwL2Y/s1600/stack3.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;242&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKMSFryTck4uFBZRooyMl_Q5NnhfhIySVcWwmr9H-eCE1XiOSNkawk7KXqZm62Tep6X_5yTuPtdM-VhsqMGduXxXouZKV_hagIGMN5pDqw7xR7sYh0DqXXmM1MW-5jrHdS3yG-ywxwL2Y/s320/stack3.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qt-articles.blogspot.com/feeds/312499200300536459/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://qt-articles.blogspot.com/2011/02/how-to-use-qstackedwidget-in-qt.html#comment-form' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5570325845627933731/posts/default/312499200300536459'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5570325845627933731/posts/default/312499200300536459'/><link rel='alternate' type='text/html' href='http://qt-articles.blogspot.com/2011/02/how-to-use-qstackedwidget-in-qt.html' title='How to use Qstackedwidget in Qt (Switching between multiple views in Qt)'/><author><name>Contributor</name><uri>http://www.blogger.com/profile/03464211634349148049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFwQnkiPRWuEilGv4U-GE1O0KcmPjVaAK9LEcEViLneQFxQP2GHmU2avA-Ch5PGou4Yac-bl-vjpwIrCFRe5XHQ4XydO1BD9FT6zziuYEA_TIqONPnFDRe7YkE1D2sDYANTCb_s0lTe_c/s72-c/stack1.png" height="72" width="72"/><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5570325845627933731.post-3403516407385144274</id><published>2011-02-10T10:02:00.000-08:00</published><updated>2011-02-10T10:02:13.127-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Nokia"/><title type='text'>Nokia CEO Stephen Elop&#39;s letter to Nokia employees</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;span style=&quot;font-family: Arial; font-style: italic;&quot;&gt;Here is the Letter from Nokia CEO to there employees&lt;/span&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-family: Arial; font-style: italic;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-family: Arial; font-style: italic;&quot;&gt;Hello there,&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-style: italic;&quot;&gt;There is a pertinent  story about a man who was working on an oil platform in the North Sea.  He woke up one night from a loud explosion, which suddenly set his  entire oil platform on fire. In mere moments, he was surrounded by  flames. Through the smoke and heat, he barely made his way out of the  chaos to the platform&#39;s edge. When he looked down over the edge, all he  could see were the dark, cold, foreboding Atlantic waters.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-style: italic;&quot;&gt;As the fire approached  him, the man had mere seconds to react. He could stand on the platform,  and inevitably be consumed by the burning flames. Or, he could plunge 30  meters in to the freezing waters. The man was standing upon a &quot;burning  platform,&quot; and he needed to make a choice.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-style: italic;&quot;&gt;He decided to jump. It  was unexpected. In ordinary circumstances, the man would never consider  plunging into icy waters. But these were not ordinary times - his  platform was on fire. The man survived the fall and the waters. After he  was rescued, he noted that a &quot;burning platform&quot; caused a radical change  in his behaviour.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-style: italic;&quot;&gt;We too, are standing on a &quot;burning platform,&quot; and we must decide how we are going to change our behaviour.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-style: italic;&quot;&gt;Over the past few months,  I&#39;ve shared with you what I&#39;ve heard from our shareholders, operators,  developers, suppliers and from you. Today, I&#39;m going to share what I&#39;ve  learned and what I have come to believe.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-style: italic;&quot;&gt;I have learned that we are standing on a burning platform.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-style: italic;&quot;&gt;And, we have more than one explosion - we have multiple points of scorching heat that are fuelling a blazing fire around us.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-style: italic;&quot;&gt;For example, there is  intense heat coming from our competitors, more rapidly than we ever  expected. Apple disrupted the market by redefining the smartphone and  attracting developers to a closed, but very powerful ecosystem.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-style: italic;&quot;&gt;In 2008, Apple&#39;s market  share in the $300+ price range was 25 percent; by 2010 it escalated to  61 percent. They are enjoying a tremendous growth trajectory with a 78  percent earnings growth year over year in Q4 2010. Apple demonstrated  that if designed well, consumers would buy a high-priced phone with a  great experience and developers would build applications. They changed  the game, and today, Apple owns the high-end range.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-style: italic;&quot;&gt;And then, there is  Android. In about two years, Android created a platform that attracts  application developers, service providers and hardware manufacturers.  Android came in at the high-end, they are now winning the mid-range, and  quickly they are going downstream to phones under €100. Google has  become a gravitational force, drawing much of the industry&#39;s innovation  to its core.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-style: italic;&quot;&gt;Let&#39;s not forget about  the low-end price range. In 2008, MediaTek supplied complete reference  designs for phone chipsets, which enabled manufacturers in the Shenzhen  region of&amp;nbsp;China&amp;nbsp;to produce phones at an unbelievable pace. By some  accounts, this ecosystem now produces more than one third of the phones  sold globally - taking share from us in emerging markets.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-style: italic;&quot;&gt;While competitors poured  flames on our market share, what happened at Nokia? We fell behind, we  missed big trends, and we lost time. At that time, we thought we were  making the right decisions; but, with the benefit of hindsight, we now  find ourselves years behind.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-style: italic;&quot;&gt;The first iPhone shipped  in 2007, and we still don&#39;t have a product that is close to their  experience. Android came on the scene just over 2 years ago, and this  week they took our leadership position in smartphone volumes.  Unbelievable.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-style: italic;&quot;&gt;We have some brilliant  sources of innovation inside Nokia, but we are not bringing it to market  fast enough. We thought MeeGo would be a platform for winning high-end  smartphones. However, at this rate, by the end of 2011, we might have  only one MeeGo product in the market.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-style: italic;&quot;&gt;At the midrange, we have  Symbian. It has proven to be non-competitive in leading markets  like&amp;nbsp;North America. Additionally,&amp;nbsp;Symbian&amp;nbsp;is proving to be an  increasingly difficult environment in which to develop to meet the  continuously expanding consumer requirements, leading to slowness in  product development and also creating a disadvantage when we seek to  take advantage of new hardware platforms. As a result, if we continue  like before, we will get further and further behind, while our  competitors advance further and further ahead.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-style: italic;&quot;&gt;At the lower-end price  range, Chinese OEMs are cranking out a device much faster than, as one  Nokia employee said only partially in jest, &quot;the time that it takes us  to polish a PowerPoint presentation.&quot; They are fast, they are cheap, and  they are challenging us.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-style: italic;&quot;&gt;And the truly perplexing  aspect is that we&#39;re not even fighting with the right weapons. We are  still too often trying to approach each price range on a  device-to-device basis.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-style: italic;&quot;&gt;The battle of devices has  now become a war of ecosystems, where ecosystems include not only the  hardware and software of the device, but developers, applications,  ecommerce, advertising, search, social applications, location-based  services, unified communications and many other things. Our competitors  aren&#39;t taking our market share with devices; they are taking our market  share with an entire ecosystem. This means we&#39;re going to have to decide  how we either build, catalyse or join an ecosystem.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-style: italic;&quot;&gt;This is one of the  decisions we need to make. In the meantime, we&#39;ve lost market share,  we&#39;ve lost mind share and we&#39;ve lost time.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-style: italic;&quot;&gt;On Tuesday, Standard  &amp;amp; Poor&#39;s informed that they will put our A long term and A-1 short  term ratings on negative credit watch. This is a similar rating action  to the one that Moody&#39;s took last week. Basically it means that during  the next few weeks they will make an analysis of Nokia, and decide on a  possible credit rating downgrade. Why are these credit agencies  contemplating these changes? Because they are concerned about our  competitiveness.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-style: italic;&quot;&gt;Consumer preference for  Nokia declined worldwide. In the UK, our brand preference has slipped to  20 percent, which is 8 percent lower than last year. That means only 1  out of 5 people in the UK prefer Nokia to other brands. It&#39;s also down  in the other markets, which are traditionally our strongholds:&amp;nbsp;Russia,  Germany,&amp;nbsp;Indonesia, UAE, and on and on and on.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-style: italic;&quot;&gt;How did we get to this point? Why did we fall behind when the world around us evolved?&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-style: italic;&quot;&gt;This is what I have been  trying to understand. I believe at least some of it has been due to our  attitude inside Nokia. We poured gasoline on our own burning platform. I  believe we have lacked accountability and leadership to align and  direct the company through these disruptive times. We had a series of  misses. We haven&#39;t been delivering innovation fast enough. We&#39;re not  collaborating internally.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-style: italic;&quot;&gt;Nokia, our platform is burning.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-style: italic;&quot;&gt;We are working on a path  forward -- a path to rebuild our market leadership. When we share the  new strategy on February 11, it will be a huge effort to transform our  company. But, I believe that together, we can face the challenges ahead  of us. Together, we can choose to define our future.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial;&quot;&gt;&lt;i&gt;The burning platform,  upon which the man found himself, caused the man to shift his&amp;nbsp;behavior,  and take a bold and brave step into an uncertain future. He was able to  tell his story. Now, we have a great opportunity to do the same.&amp;nbsp;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-style: italic;&quot;&gt;Stephen.&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial;&quot;&gt;&lt;b&gt;&lt;i&gt;&lt;br /&gt;
&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qt-articles.blogspot.com/feeds/3403516407385144274/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://qt-articles.blogspot.com/2011/02/nokia-ceo-stephen-elops-letter-to-nokia.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5570325845627933731/posts/default/3403516407385144274'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5570325845627933731/posts/default/3403516407385144274'/><link rel='alternate' type='text/html' href='http://qt-articles.blogspot.com/2011/02/nokia-ceo-stephen-elops-letter-to-nokia.html' title='Nokia CEO Stephen Elop&#39;s letter to Nokia employees'/><author><name>Contributor</name><uri>http://www.blogger.com/profile/03464211634349148049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5570325845627933731.post-3713941094316090637</id><published>2010-12-27T08:08:00.000-08:00</published><updated>2010-12-27T08:08:40.436-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Listview"/><category scheme="http://www.blogger.com/atom/ns#" term="menus"/><category scheme="http://www.blogger.com/atom/ns#" term="Qt"/><category scheme="http://www.blogger.com/atom/ns#" term="Qt4"/><category scheme="http://www.blogger.com/atom/ns#" term="softkeys"/><category scheme="http://www.blogger.com/atom/ns#" term="Symbian"/><title type='text'>Changing the positive &amp; negetive softkeys</title><content type='html'>Qt menu bar has two menu items, as you would have seen by default left side of the key is “Options” and the right side is “Exit”.&lt;br /&gt;
Today we shall see how to change the text of it.&lt;br /&gt;
The left key is “Positive Soft key” &amp;amp; the right key is “Negative soft key”. We need to create an action with the positive and negative soft key role and insert to the window, so the keys will get changed.&lt;br /&gt;
Ex: &lt;b&gt;For positive soft key&lt;/b&gt;:(Left side key)&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;QAction* Newkey = new QAction(&quot;New&quot;, this);
Newkey-&amp;gt;setSoftKeyRole(QAction::PositiveSoftKey);
this-&amp;gt;addAction(Newkey);

&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;b&gt;Negative soft key&lt;/b&gt;: (Right side key)&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;QAction* close = new QAction(&quot;close&quot;, this);
close-&amp;gt;setSoftKeyRole(QAction::NegativeSoftKey);
this-&amp;gt;addAction(close);

&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
Here is the sample code, just put these files in a sample application and run for the results&lt;br /&gt;
&lt;br /&gt;
.cpp file&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;#include &quot;QT_Softkeys.h&quot;
#include &amp;lt;qmessagebox.h&amp;gt;

QT_Softkeys::QT_Softkeys(QWidget *parent)
    : QMainWindow(parent)
{
        //ui.setupUi(this);
        
    
        QAction* Newkey = new QAction(&quot;New&quot;, this);
        Newkey-&amp;gt;setSoftKeyRole(QAction::PositiveSoftKey);
        this-&amp;gt;addAction(Newkey);
        
        QAction* close = new QAction(&quot;close&quot;, this);
        close-&amp;gt;setSoftKeyRole(QAction::NegativeSoftKey);
        connect(close,SIGNAL(triggered()),this,SLOT(closeClickked()));
        this-&amp;gt;addAction(close);
                       
        
}

QT_Softkeys::~QT_Softkeys()
{

}

void QT_Softkeys::closeClickked()
        {
        QMessageBox::information(this,&quot;Hi&quot;,&quot;Hi we r closing&quot;);
        QApplication::quit();
        }

&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
Header file&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;#ifndef QT_SOFTKEYS_H
#define QT_SOFTKEYS_H

#include &amp;lt;QtGui/QMainWindow&amp;gt;
#include &quot;ui_QT_Softkeys.h&quot;

class QT_Softkeys : public QMainWindow
{
    Q_OBJECT

public:
        QT_Softkeys(QWidget *parent = 0);
    ~QT_Softkeys();
    
    public slots:
    void closeClickked();

private:
    Ui::QT_Softkeys ui;
};

#endif // QT_SOFTKEYS_H

&lt;/code&gt;&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://qt-articles.blogspot.com/feeds/3713941094316090637/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://qt-articles.blogspot.com/2010/12/changing-positive-negetive-softkeys.html#comment-form' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5570325845627933731/posts/default/3713941094316090637'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5570325845627933731/posts/default/3713941094316090637'/><link rel='alternate' type='text/html' href='http://qt-articles.blogspot.com/2010/12/changing-positive-negetive-softkeys.html' title='Changing the positive &amp; negetive softkeys'/><author><name>Contributor</name><uri>http://www.blogger.com/profile/03464211634349148049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5570325845627933731.post-2416032847970742182</id><published>2010-10-10T01:48:00.000-07:00</published><updated>2010-10-10T01:48:33.592-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Internationalization"/><category scheme="http://www.blogger.com/atom/ns#" term="Linguist"/><category scheme="http://www.blogger.com/atom/ns#" term="Localization"/><category scheme="http://www.blogger.com/atom/ns#" term="Qt"/><category scheme="http://www.blogger.com/atom/ns#" term="Qt4"/><category scheme="http://www.blogger.com/atom/ns#" term="QtLinguist"/><category scheme="http://www.blogger.com/atom/ns#" term="Resources"/><title type='text'>Localization in QT</title><content type='html'>&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;Some instructions need to be followed in performing localization in Qt&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;Instructions:&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;1)Add tr macro for all the QString assignment.&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;2)Assigning the string to Non Qt objects pointer use QT_TRANSLATE_NOOP macro.&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;3)Assigning the string to Non Qt objects in some function use QT_NOOP macro.&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;Here are some samples,which shows how to add strings for Localization compatible.&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;Syntax to be used for global char*.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;background-color: yellow; color: black;&quot;&gt;const char* TestStr = QT_TRANSLATE_NOOP(&quot;StringList&quot;,&quot;Welcome To Qt&quot;);&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;background-color: yellow; color: black;&quot;&gt;QPushButton *pushBtn = new QPushButton(qApp-&amp;gt;translate(&quot;StringList&quot;,TestStr));&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;background-color: white; color: blue;&quot;&gt;For Qstring Objects.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;background-color: yellow;&quot;&gt;QString UIstr = QObject::tr(&quot;Qt is a Framework&quot;);&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;background-color: yellow;&quot;&gt;QPushButton *pushBtn = new QPushButton(tr(UIstr));&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;For local char*.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;background-color: yellow;&quot;&gt;const char * text = QT_TR_NOOP(&quot;Qt framework rocks&quot;);&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;background-color: yellow;&quot;&gt;QPushButton *pushBtn = new QPushButton(tr(text));&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;Steps needs to be followed in generation and usage of localized file in application.&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;1)Add the TRANSLATION Macro in the .pro file and save.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;background-color: yellow;&quot;&gt;example:&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;background-color: yellow;&quot;&gt;TRANSLATIONS += superapp_fr.ts\&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;background-color: yellow;&quot;&gt;TRANSLATIONS += superapp_jp.ts&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;like this, add all possible language translation file you need.&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;2)Use lupdate command in Qt Command prompt to generate the .ts file and .ts file will be in your project folder.&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9m-JelcJY5_POzol_i5e_iwBOztwzpD8eqaOhjWfIBptKTCoE-suhnA_wPyK-mMoMOmYNuIaz9yzL4f7c_F_WjY0g1QyUrksmPDiNo7hiJ8aVFwl1IHzTqarQ_XZRmsVCO8yf3pGqlL8/s1600/Qt_commandPromp_img1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; ex=&quot;true&quot; height=&quot;318&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9m-JelcJY5_POzol_i5e_iwBOztwzpD8eqaOhjWfIBptKTCoE-suhnA_wPyK-mMoMOmYNuIaz9yzL4f7c_F_WjY0g1QyUrksmPDiNo7hiJ8aVFwl1IHzTqarQ_XZRmsVCO8yf3pGqlL8/s320/Qt_commandPromp_img1.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&amp;nbsp;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;3)&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &lt;/span&gt;Open the .ts file in Qt linguist tool and add the mapping strings.&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Launch Qt Linguist From Start Menu&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhL-gatpc1nib09oD0s-OUdy21fn3dLGF77QKQajV1c5E80QfIoqlFftg12MvjeKOgwr5p0oPuQv3v9pz6jlOvfxcc-XTEwj4-RI12e5tEbDoqchh_5vbRWNxY39vPonKytLedUl7pNrnQ/s1600/Qt_linguest_path_img2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; ex=&quot;true&quot; height=&quot;299&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhL-gatpc1nib09oD0s-OUdy21fn3dLGF77QKQajV1c5E80QfIoqlFftg12MvjeKOgwr5p0oPuQv3v9pz6jlOvfxcc-XTEwj4-RI12e5tEbDoqchh_5vbRWNxY39vPonKytLedUl7pNrnQ/s320/Qt_linguest_path_img2.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;br /&gt;
&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;background-color: white; color: blue;&quot;&gt;&amp;nbsp;Adding mapping strings to the English equivalent strings.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjke25B4c3qQiW-nuEPcD3I5HaH4nJyKYcFjQsOa6mKrqMvptb9wuV3uzoEH8A77LtKAu_nx4mbRnEkx8e0S6Mjr_Quum7bmFyzipPYHNv9KEXM_RDcl8BjCDqnqD3GzhX5mjqG37yZ4Hw/s1600/linguist_img3.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; ex=&quot;true&quot; height=&quot;161&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjke25B4c3qQiW-nuEPcD3I5HaH4nJyKYcFjQsOa6mKrqMvptb9wuV3uzoEH8A77LtKAu_nx4mbRnEkx8e0S6Mjr_Quum7bmFyzipPYHNv9KEXM_RDcl8BjCDqnqD3GzhX5mjqG37yZ4Hw/s320/linguist_img3.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;4)Similar to step2 use lrelease to generate the .qm file and .qm file will be in your project folder.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;5)Copy .qm file and place it in desired location and load it on launching the application.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0in;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;&lt;br /&gt;
&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;Here how the loading part of code looks.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin-bottom: 0in;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;span style=&quot;background-color: yellow;&quot;&gt;QTranslator translator;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;span style=&quot;background-color: yellow;&quot;&gt;translator.load(&quot;c:\\Data\\MyStrings_fr&quot;);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;span style=&quot;background-color: yellow;&quot;&gt;a.installTranslator(&amp;amp;translator);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qt-articles.blogspot.com/feeds/2416032847970742182/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://qt-articles.blogspot.com/2010/10/localization-in-qt.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5570325845627933731/posts/default/2416032847970742182'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5570325845627933731/posts/default/2416032847970742182'/><link rel='alternate' type='text/html' href='http://qt-articles.blogspot.com/2010/10/localization-in-qt.html' title='Localization in QT'/><author><name>Contributor</name><uri>http://www.blogger.com/profile/03464211634349148049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9m-JelcJY5_POzol_i5e_iwBOztwzpD8eqaOhjWfIBptKTCoE-suhnA_wPyK-mMoMOmYNuIaz9yzL4f7c_F_WjY0g1QyUrksmPDiNo7hiJ8aVFwl1IHzTqarQ_XZRmsVCO8yf3pGqlL8/s72-c/Qt_commandPromp_img1.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5570325845627933731.post-5134132837786006941</id><published>2010-08-29T00:58:00.000-07:00</published><updated>2010-08-29T00:58:35.769-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="OVI"/><category scheme="http://www.blogger.com/atom/ns#" term="sisfile"/><category scheme="http://www.blogger.com/atom/ns#" term="SmartInstaller"/><title type='text'>Smart installer for The Symbian applications.</title><content type='html'>&lt;b&gt;Smart installer for The Symbian applications.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
This post describes in brief what smart installer is, and why it is essential for the Symbian applications.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;How will you run the Symbian applications in a phone which doesn’t have Qt SDK installed?&lt;/b&gt;&lt;br /&gt;
To overcome this problem Nokia has provided the simple solution i.e the Smart installer.&lt;br /&gt;
&lt;br /&gt;
Smart installer is pre embedded in your .sis file, when you download an application from the OVI store, first the smart installer checks, weather the Qt is installed in your phone, if not it will download the latest Qt from the Nokia server and install to the phone. application gets installed in the post installation phase. This is how it works.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Please Note: If you are using the Carbide editor for Symbian application development, then smart installer doesn’t work. To make smart installer you need to have the Nokia QT SDK only.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Requirements:&lt;/b&gt;&lt;br /&gt;
Nokia QT SDK. &lt;a href=&quot;http://www.forum.nokia.com/info/sw.nokia.com/id/e920da1a-5b18-42df-82c3-907413e525fb/Nokia_Qt_SDK.html&quot;&gt;Download link&lt;/a&gt;&lt;br /&gt;
Certificates for the Signed .sis file.&lt;br /&gt;
&lt;b&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;
How to make the Signed smart installer for the OVI store.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
1)&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;Launch Nokia Qt SDK command prompt.&lt;/b&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgxqxrPSx_xE446VMjIO-TgtVm7V_W4FwLN2deE058gyR2XcQ5UTqeWJiTYhTrGq5W3V_yp70Yc2GyY8EQZWW7xbz3M2ZJwNfSHA0RurVsAna8-iIunk09hZi2LZ0kc2m3-0UN8TSk2JWc/s1600/upload1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; ox=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgxqxrPSx_xE446VMjIO-TgtVm7V_W4FwLN2deE058gyR2XcQ5UTqeWJiTYhTrGq5W3V_yp70Yc2GyY8EQZWW7xbz3M2ZJwNfSHA0RurVsAna8-iIunk09hZi2LZ0kc2m3-0UN8TSk2JWc/s320/upload1.png&quot; width=&quot;298&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
2)&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;Go to application Directory,&lt;/b&gt;&lt;br /&gt;
&lt;strong&gt;3)&amp;nbsp;&amp;nbsp;&amp;nbsp; qmake&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;4)&amp;nbsp;&amp;nbsp;&amp;nbsp; make release-gcce&lt;/strong&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQw3-JN_XUWCp1xegPzC95P0_fQSsjZE7TYzI27gVt7yrKtOWzvkmXu97N03LGgs1WTKofEauvPzdKedPmev_1_zMf_CrDPF5ZYbgVaexhXoTd_UcolMH8rBQhKImbZZzNJBU-HEUT7jY/s1600/upload3.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; ox=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQw3-JN_XUWCp1xegPzC95P0_fQSsjZE7TYzI27gVt7yrKtOWzvkmXu97N03LGgs1WTKofEauvPzdKedPmev_1_zMf_CrDPF5ZYbgVaexhXoTd_UcolMH8rBQhKImbZZzNJBU-HEUT7jY/s320/upload3.png&quot; width=&quot;298&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
To sign the application, you can put the certificates in the current directory or you can refer it from the other drive also. If you are referring from the other drive please mention the Path properly.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&lt;b&gt;5) make sis QT_SIS_CERTIFICATE=publisherid.cer&amp;nbsp; QT_SIS_KEY=publisherid.key &lt;/b&gt;&lt;br /&gt;
&amp;nbsp;This will generate&amp;nbsp; signed sis file&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXaff6YSakv-uhlB6mjuWAe8FOSnc1Q-Ly4byLmk72CEiB1vbKqOyhavBzyoYYxzTwTlXnj9tKTlBKi0W0go1ZXGFAc823zWYHgr36mPSzizn9ByhyphenhyphenuKxFHs7HOWnMzzunIqwb3cDCX7w/s1600/upload5.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; ox=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXaff6YSakv-uhlB6mjuWAe8FOSnc1Q-Ly4byLmk72CEiB1vbKqOyhavBzyoYYxzTwTlXnj9tKTlBKi0W0go1ZXGFAc823zWYHgr36mPSzizn9ByhyphenhyphenuKxFHs7HOWnMzzunIqwb3cDCX7w/s320/upload5.png&quot; width=&quot;298&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&amp;nbsp;6) &lt;b&gt;make installer_sis QT_SIS_CERTIFICATE=publisherid.cer&amp;nbsp; QT_SIS_KEY=publisherid.key &lt;/b&gt;&lt;br /&gt;
&amp;nbsp;This will generate&amp;nbsp; smart installer signed sis file.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4foAHPV8aq4DSelW6Zef8gAaFXwyREU3cGDtkYswtSgjNBYSkqHWfATNAhvfDrUANtUabyDQ3QzR2wl8NE85FPhZBvRLxAMSJGeIQzNDYyJ-D3tfRneWsFVDb2k4rPusL3v1npEZObyc/s1600/upload7.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; ox=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4foAHPV8aq4DSelW6Zef8gAaFXwyREU3cGDtkYswtSgjNBYSkqHWfATNAhvfDrUANtUabyDQ3QzR2wl8NE85FPhZBvRLxAMSJGeIQzNDYyJ-D3tfRneWsFVDb2k4rPusL3v1npEZObyc/s320/upload7.png&quot; width=&quot;298&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Follow up these steps for the self self-signed Smart Installer package.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
1)&lt;b&gt;qmake &lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
2)&lt;b&gt;make release-gcce &lt;/b&gt;&lt;br /&gt;
Simple SIS file.&lt;br /&gt;
&lt;br /&gt;
3)&lt;b&gt;make installer_sis &lt;/b&gt;&lt;br /&gt;
Smart installer SIS file&lt;br /&gt;
&lt;br /&gt;
more information about Qt smart installer can be found here&lt;br /&gt;
&lt;a href=&quot;http://doc.qt.nokia.com/smart-installer-1.0/index.html&quot;&gt;http://doc.qt.nokia.com/smart-installer-1.0/index.html&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://qt-articles.blogspot.com/feeds/5134132837786006941/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://qt-articles.blogspot.com/2010/08/smart-installer-for-symbian.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5570325845627933731/posts/default/5134132837786006941'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5570325845627933731/posts/default/5134132837786006941'/><link rel='alternate' type='text/html' href='http://qt-articles.blogspot.com/2010/08/smart-installer-for-symbian.html' title='Smart installer for The Symbian applications.'/><author><name>Contributor</name><uri>http://www.blogger.com/profile/03464211634349148049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgxqxrPSx_xE446VMjIO-TgtVm7V_W4FwLN2deE058gyR2XcQ5UTqeWJiTYhTrGq5W3V_yp70Yc2GyY8EQZWW7xbz3M2ZJwNfSHA0RurVsAna8-iIunk09hZi2LZ0kc2m3-0UN8TSk2JWc/s72-c/upload1.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5570325845627933731.post-6759928151853008140</id><published>2010-07-25T07:45:00.000-07:00</published><updated>2010-07-25T08:47:45.820-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Delegates"/><category scheme="http://www.blogger.com/atom/ns#" term="Listview"/><category scheme="http://www.blogger.com/atom/ns#" term="Qlistview"/><category scheme="http://www.blogger.com/atom/ns#" term="Qt"/><category scheme="http://www.blogger.com/atom/ns#" term="Qt4"/><title type='text'>How to customize Listview in Qt using Delegates.</title><content type='html'>By default &lt;b&gt;listview &lt;/b&gt;in Qt takes a text and an icon. What if you want a Listview with more then one icon, what if you want listview with more then one text or both? To come up from this problem, Qt has concept called Delegates. &lt;br /&gt;
&lt;br /&gt;
Before knowing about Delegates, first we shall see the model and view concept in Qt.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;What is model and view class?&lt;/b&gt;&lt;br /&gt;
Model class is responsible for storing the data, view class is responsible for showing data.&lt;br /&gt;
Model and view can be separated, they are independent.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Listview in Qt&lt;/b&gt;:&lt;br /&gt;
Listview in Qt takes model and view class, first data should be filled in the model class and you need to tell view to show data, but how the data present in model should be displayed in view?&lt;br /&gt;
The answer is Delegates, delegates tell where and how the data should be displayed in view.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Sample inbox example, shows how to use delegate in Qt&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;The Requirement is displaying a image, One bigger text and a sub-text of small size.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
To make delegate class, you need to override couple of functions,&lt;br /&gt;
&lt;b&gt;sizeHint(const QStyleOptionViewItem &amp;amp;  option ,&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;const QModelIndex &amp;amp; index) const&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
sizeHint return you the item width. Which can be either predefined or you can calculate it using the data elements.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;paint(QPainter *painter, const QStyleOptionViewItem &amp;amp;option,&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;const QModelIndex &amp;amp;index) const&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
In paint you need to tell, how and were data should be displayed in view. i.e, where image should be displayed, where the text should come and the size of the text.&lt;br /&gt;
&lt;br /&gt;
here how the delegate cpp and header file looks.&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;/*
 * ListviewDelegate.cpp
 *
 *  Created on: Jul 17, 2010
 *      Author: http://qt-articles.blogspot.com
 */

#include &quot;ListviewDelegate.h&quot;

ListviewDelegate::ListviewDelegate()
    {
    // TODO Auto-generated constructor stub

    }

ListviewDelegate::~ListviewDelegate()
    {
    // TODO Auto-generated destructor stub
    }

//alocate each item size in listview.
QSize ListviewDelegate::sizeHint(const QStyleOptionViewItem &amp;amp;  option ,
                              const QModelIndex &amp;amp; index) const
{
    QIcon icon = qvariant_cast&amp;lt;QIcon&amp;gt;(index.data(IconRole));
    QSize iconsize = icon.actualSize(option.decorationSize);
    QFont font = QApplication::font();
    QFontMetrics fm(font);
    
    return(QSize(iconsize.width(),iconsize.height()+fm.height() +8 ));

}
void ListviewDelegate::paint(QPainter *painter, const QStyleOptionViewItem &amp;amp;option,
                           const QModelIndex &amp;amp;index) const
 {
    QStyledItemDelegate::paint(painter,option,index);
    
    painter-&amp;gt;save();
    
    QFont font = QApplication::font();
    QFont SubFont = QApplication::font();
    //font.setPixelSize(font.weight()+);
    font.setBold(true);
    SubFont.setWeight(SubFont.weight()-2);
    QFontMetrics fm(font);
    
    QIcon icon = qvariant_cast&amp;lt;QIcon&amp;gt;(index.data(IconRole));
    QString headerText = qvariant_cast&amp;lt;QString&amp;gt;(index.data(headerTextRole));
    QString subText = qvariant_cast&amp;lt;QString&amp;gt;(index.data(subHeaderTextrole));
    
    QSize iconsize = icon.actualSize(option.decorationSize);
    
    QRect headerRect = option.rect;
    QRect subheaderRect = option.rect;
    QRect iconRect = subheaderRect;
    
    iconRect.setRight(iconsize.width()+30);
    iconRect.setTop(iconRect.top()+5);
    headerRect.setLeft(iconRect.right());
    subheaderRect.setLeft(iconRect.right());
    headerRect.setTop(headerRect.top()+5);
    headerRect.setBottom(headerRect.top()+fm.height());
    
    subheaderRect.setTop(headerRect.bottom()+2);
    
    
    //painter-&amp;gt;drawPixmap(QPoint(iconRect.right()/2,iconRect.top()/2),icon.pixmap(iconsize.width(),iconsize.height()));
    painter-&amp;gt;drawPixmap(QPoint(iconRect.left()+iconsize.width()/2+2,iconRect.top()+iconsize.height()/2+3),icon.pixmap(iconsize.width(),iconsize.height()));
    
    painter-&amp;gt;setFont(font);
    painter-&amp;gt;drawText(headerRect,headerText);
    
    
    painter-&amp;gt;setFont(SubFont);
    painter-&amp;gt;drawText(subheaderRect.left(),subheaderRect.top()+17,subText);
    
    painter-&amp;gt;restore();
    
 }


&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;/*
 * ListviewDelegate.h
 *
 *  Created on: Jul 17, 2010
 *      Author: http://qt-articles.blogspot.com
 */

#ifndef ListviewDelegate_H_
#define ListviewDelegate_H_
#include &amp;lt;QtGui&amp;gt;

class ListviewDelegate : public QStyledItemDelegate
    {
public:
    ListviewDelegate();
    virtual ~ListviewDelegate();
    
    enum datarole {headerTextRole = Qt::UserRole + 100,subHeaderTextrole = Qt::UserRole+101,IconRole = Qt::UserRole+102};
    
    void paint(QPainter *painter, const QStyleOptionViewItem &amp;amp;option,
               const QModelIndex &amp;amp;index) const;

    QSize sizeHint(const QStyleOptionViewItem &amp;amp;option,
                   const QModelIndex &amp;amp;index ) const;

    };

#endif /* ListviewDelegate_H_ */

&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
How to connect Model,view and Delegates in Listview.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt; QListView *view;
 QStandardItemModel *model;
 ListviewDelegate *listdelegate;
       
 view = new QListView();
 model = new QStandardItemModel();
 listdelegate = new ListviewDelegate();
           
  view-&amp;gt;setItemDelegate(listdelegate); //connect the delegate to view
  view-&amp;gt;setModel(model);//connect the model to view.

&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
How to insert an item to model,&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;QStandardItem *item = new QStandardItem();
           QIcon icon(&quot;:/new/prefix1/about.png&quot;);
           
           item-&amp;gt;setData(&quot;Inbox&quot;,ListviewDelegate::headerTextRole);
           item-&amp;gt;setData(&quot;10 Messages&quot;,ListviewDelegate::subHeaderTextrole);
           item-&amp;gt;setData(icon,ListviewDelegate::IconRole);
           model-&amp;gt;appendRow(item);

&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
This is how the entire code of  inserting  item to view looks&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black;&quot;&gt; 

//http://qt-articles.blogspot.com
#include &quot;ListDeligates.h&quot;  
 #include &amp;lt;QtGui&amp;gt;  
 #include &amp;lt;QApplication&amp;gt;  
 #include &quot;ListviewDelegate.h&quot;  
 int main(int argc, char *argv[])  
 {  
   QApplication a(argc, argv);  
   QListView *view;  
   QStandardItemModel *model;  
   ListviewDelegate *listdelegate;  
   view = new QListView();  
   model = new QStandardItemModel();  
   listdelegate = new ListviewDelegate();  
   view-&amp;gt;setItemDelegate(listdelegate);  
   view-&amp;gt;setModel(model);  
          QStandardItem *item = new QStandardItem();  
          QIcon icon(&quot;:/new/prefix1/about.png&quot;);  
          item-&amp;gt;setData(&quot;Inbox&quot;,ListviewDelegate::headerTextRole);  
          item-&amp;gt;setData(&quot;10 Messages&quot;,ListviewDelegate::subHeaderTextrole);  
          item-&amp;gt;setData(icon,ListviewDelegate::IconRole);  
          model-&amp;gt;appendRow(item);  
          QStandardItem *item1 = new QStandardItem();  
          item1-&amp;gt;setData(&quot;Draft&quot;,ListviewDelegate::headerTextRole);  
          item1-&amp;gt;setData(&quot;5 Messages&quot;,ListviewDelegate::subHeaderTextrole);  
          item1-&amp;gt;setData(icon,ListviewDelegate::IconRole);  
          item1-&amp;gt;setEditable(false);  
          model-&amp;gt;appendRow(item1);  
          QStandardItem *item2 = new QStandardItem();  
      item2-&amp;gt;setData(&quot;Sent Items&quot;,ListviewDelegate::headerTextRole);  
      item2-&amp;gt;setData(&quot;5 Messages&quot;,ListviewDelegate::subHeaderTextrole);  
      item2-&amp;gt;setData(icon,ListviewDelegate::IconRole);  
      item2-&amp;gt;setEditable(false);  
      model-&amp;gt;appendRow(item2);  
      QStandardItem *item3 = new QStandardItem();  
      item3-&amp;gt;setData(&quot;Message Settings&quot;,ListviewDelegate::headerTextRole);  
      item3-&amp;gt;setData(&quot;&quot;,ListviewDelegate::subHeaderTextrole);  
      item3-&amp;gt;setData(icon,ListviewDelegate::IconRole);  
      item3-&amp;gt;setEditable(false);  
      model-&amp;gt;appendRow(item3);  
      QStandardItem *item4 = new QStandardItem();  
      item4-&amp;gt;setData(&quot;Delivery Reports&quot;,ListviewDelegate::headerTextRole);  
      item4-&amp;gt;setData(&quot;&quot;,ListviewDelegate::subHeaderTextrole);  
      item4-&amp;gt;setData(icon,ListviewDelegate::IconRole);  
      item4-&amp;gt;setEditable(false);  
           model-&amp;gt;appendRow(item4);  
     view-&amp;gt;showMaximized();  
     return a.exec();  
 }  
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
Here is the output&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjklH0vdl0-K74HGH4G_MArzKH6GqTYGA6J6TZFHGvSnyfJjpJvF0x5a5QXCR1hRHBPU7t5Zj-IKIjxMHsj5EjdfaGo22rNIGjIauDi3JwzNXJoM1t60U7q4Zyrsd_wl2SJ_Emh5HfkGbg/s1600/por1.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;240&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjklH0vdl0-K74HGH4G_MArzKH6GqTYGA6J6TZFHGvSnyfJjpJvF0x5a5QXCR1hRHBPU7t5Zj-IKIjxMHsj5EjdfaGo22rNIGjIauDi3JwzNXJoM1t60U7q4Zyrsd_wl2SJ_Emh5HfkGbg/s400/por1.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZvcVwLLh941m57m27VW7SFb1fqUw_SEN1g31o_LpqiYPmkeVu4LW-jr8kTDBW6c83CnbEFNitJrbLteK8qBCv70soZyslqO3fl9DZBA6oJ38YgVRB1iEOaEAufQKsDr5dkIMmrZ0Qq5k/s1600/por2.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: right; float: right; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZvcVwLLh941m57m27VW7SFb1fqUw_SEN1g31o_LpqiYPmkeVu4LW-jr8kTDBW6c83CnbEFNitJrbLteK8qBCv70soZyslqO3fl9DZBA6oJ38YgVRB1iEOaEAufQKsDr5dkIMmrZ0Qq5k/s400/por2.png&quot; width=&quot;357&quot; /&gt;&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qt-articles.blogspot.com/feeds/6759928151853008140/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://qt-articles.blogspot.com/2010/07/how-to-customize-listview-in-qt-using.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5570325845627933731/posts/default/6759928151853008140'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5570325845627933731/posts/default/6759928151853008140'/><link rel='alternate' type='text/html' href='http://qt-articles.blogspot.com/2010/07/how-to-customize-listview-in-qt-using.html' title='How to customize Listview in Qt using Delegates.'/><author><name>Contributor</name><uri>http://www.blogger.com/profile/03464211634349148049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjklH0vdl0-K74HGH4G_MArzKH6GqTYGA6J6TZFHGvSnyfJjpJvF0x5a5QXCR1hRHBPU7t5Zj-IKIjxMHsj5EjdfaGo22rNIGjIauDi3JwzNXJoM1t60U7q4Zyrsd_wl2SJ_Emh5HfkGbg/s72-c/por1.png" height="72" width="72"/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5570325845627933731.post-2768606296367133724</id><published>2010-06-13T07:00:00.000-07:00</published><updated>2010-06-13T07:29:37.295-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Custombutton"/><category scheme="http://www.blogger.com/atom/ns#" term="Qpushbutton"/><category scheme="http://www.blogger.com/atom/ns#" term="Qt"/><category scheme="http://www.blogger.com/atom/ns#" term="Qt4"/><category scheme="http://www.blogger.com/atom/ns#" term="Stylesheet"/><category scheme="http://www.blogger.com/atom/ns#" term="Symbian"/><title type='text'>How to add stylesheet for button in Qt</title><content type='html'>Here i am showing, how to set the button background color from stylesheet.&lt;br /&gt;&lt;br /&gt;&lt;pre style=&quot;BORDER-BOTTOM: #999999 1px dashed; BORDER-LEFT: #999999 1px dashed; PADDING-BOTTOM: 5px; LINE-HEIGHT: 14px; BACKGROUND-COLOR: #eee; PADDING-LEFT: 5px; WIDTH: 99.7%; PADDING-RIGHT: 5px; FONT-FAMILY: Andale Mono, Lucida Console, Monaco, fixed, monospace; HEIGHT: 64px; COLOR: #000000; FONT-SIZE: 12px; OVERFLOW: auto; BORDER-TOP: #999999 1px dashed; BORDER-RIGHT: #999999 1px dashed; PADDING-TOP: 5px&quot;&gt;&lt;code&gt;CustomButton *pushButton = new CustomButton();&lt;br /&gt;pushButton-&amp;gt;setStyleSheet(QString::fromUtf8(&quot;background-color: rgb(255, 255, 0);&quot;));&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;How to set background image for button using stylesheet.&lt;br /&gt;&lt;br /&gt;&lt;pre style=&quot;BORDER-BOTTOM: #999999 1px dashed; BORDER-LEFT: #999999 1px dashed; PADDING-BOTTOM: 5px; LINE-HEIGHT: 14px; BACKGROUND-COLOR: #eee; PADDING-LEFT: 5px; WIDTH: 99.4%; PADDING-RIGHT: 5px; FONT-FAMILY: Andale Mono, Lucida Console, Monaco, fixed, monospace; HEIGHT: 62px; COLOR: #000000; FONT-SIZE: 12px; OVERFLOW: auto; BORDER-TOP: #999999 1px dashed; BORDER-RIGHT: #999999 1px dashed; PADDING-TOP: 5px&quot;&gt;&lt;code&gt;CustomButton *pushButton = new CustomButton();&lt;br /&gt; pushButton_2-&amp;gt;setStyleSheet(QString::fromUtf8(&quot;background-image: url(:/new/prefix1/icon/Smiley.bmp);&quot;));&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;if you are using Qt GUI for designing, follow up these steps.&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEisgUUjMV7QMXczv6xVFbepw2gLOvM7s892iEwWRXivyuCwCoOYzPvCtFKTnCaveyC0SChMuyM9Dq38NkJU9xu5MlN7cRuGOdCV6EqPcCCUZ_U30wRwd6rdxOm1FrX764bsyTr6kFytzf8/s1600/style1.jpg&quot;&gt;&lt;img style=&quot;TEXT-ALIGN: center; MARGIN: 0px auto 10px; WIDTH: 320px; DISPLAY: block; HEIGHT: 180px; CURSOR: hand&quot; id=&quot;BLOGGER_PHOTO_ID_5482263520827431378&quot; border=&quot;0&quot; alt=&quot;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEisgUUjMV7QMXczv6xVFbepw2gLOvM7s892iEwWRXivyuCwCoOYzPvCtFKTnCaveyC0SChMuyM9Dq38NkJU9xu5MlN7cRuGOdCV6EqPcCCUZ_U30wRwd6rdxOm1FrX764bsyTr6kFytzf8/s320/style1.jpg&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfWRXU2tU2ig2h0yRLUEkwO6krAEOfWNQETsJLx8hFHkf6t141rWZ5dr7yY9-ND4lI7M_8FpgpNqgeTNOGNVknu_Eutszw2d358TqEgJoyPtPj9XOMqO3pQFLyrG22C1Ozupmqzn-8yec/s1600/2.jpg&quot;&gt;&lt;img style=&quot;TEXT-ALIGN: center; MARGIN: 0px auto 10px; WIDTH: 320px; DISPLAY: block; HEIGHT: 180px; CURSOR: hand&quot; id=&quot;BLOGGER_PHOTO_ID_5482263671707781778&quot; border=&quot;0&quot; alt=&quot;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfWRXU2tU2ig2h0yRLUEkwO6krAEOfWNQETsJLx8hFHkf6t141rWZ5dr7yY9-ND4lI7M_8FpgpNqgeTNOGNVknu_Eutszw2d358TqEgJoyPtPj9XOMqO3pQFLyrG22C1Ozupmqzn-8yec/s320/2.jpg&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCWfA1MJYW6UvpKvYz9cdyUNCw2Hdr72lMXl5UyWxLrMisOHsECk85XE8HbTPBHY7kbvWFrYZPBPwuMzwxDtij1yRRTO-APvOcxFdEQ0K23UHexmt1p8G9iMi5l8g7Tpvs0FvEOg3Wc5I/s1600/3.jpg&quot;&gt;&lt;img style=&quot;TEXT-ALIGN: center; MARGIN: 0px auto 10px; WIDTH: 320px; DISPLAY: block; HEIGHT: 180px; CURSOR: hand&quot; id=&quot;BLOGGER_PHOTO_ID_5482263850376935522&quot; border=&quot;0&quot; alt=&quot;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCWfA1MJYW6UvpKvYz9cdyUNCw2Hdr72lMXl5UyWxLrMisOHsECk85XE8HbTPBHY7kbvWFrYZPBPwuMzwxDtij1yRRTO-APvOcxFdEQ0K23UHexmt1p8G9iMi5l8g7Tpvs0FvEOg3Wc5I/s320/3.jpg&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiaqW4FuvvckxPLouQOQV0adjNRw_LXCUJDBC17RcVpxksf6BlmjdQ4i3TDf1Vzv_xzRvJnhHMcb_eYhtEA8JHT-CjrLcSo06dZYiyV8hIk5midmgIWPX5OFzuzBSekjOWZF-TAVz-GIZs/s1600/4.jpg&quot;&gt;&lt;img style=&quot;TEXT-ALIGN: center; MARGIN: 0px auto 10px; WIDTH: 320px; DISPLAY: block; HEIGHT: 180px; CURSOR: hand&quot; id=&quot;BLOGGER_PHOTO_ID_5482263853655866114&quot; border=&quot;0&quot; alt=&quot;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiaqW4FuvvckxPLouQOQV0adjNRw_LXCUJDBC17RcVpxksf6BlmjdQ4i3TDf1Vzv_xzRvJnhHMcb_eYhtEA8JHT-CjrLcSo06dZYiyV8hIk5midmgIWPX5OFzuzBSekjOWZF-TAVz-GIZs/s320/4.jpg&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMVC82D7vLJHXUKh0eVKlitcOhvVpLCHkJ1mhTaMIpppQ-8zjbu5qUFOEhmD_e7NpVKiZc4kA3Y4ssaUPzmgEeLPXAQAh0a1evWSBWxpRY3C4wTxTEIThEBzgxSseHBzvr4-1pPIzXBz4/s1600/5.png&quot;&gt;&lt;img style=&quot;TEXT-ALIGN: center; MARGIN: 0px auto 10px; WIDTH: 320px; DISPLAY: block; HEIGHT: 180px; CURSOR: hand&quot; id=&quot;BLOGGER_PHOTO_ID_5482264297177278082&quot; border=&quot;0&quot; alt=&quot;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMVC82D7vLJHXUKh0eVKlitcOhvVpLCHkJ1mhTaMIpppQ-8zjbu5qUFOEhmD_e7NpVKiZc4kA3Y4ssaUPzmgEeLPXAQAh0a1evWSBWxpRY3C4wTxTEIThEBzgxSseHBzvr4-1pPIzXBz4/s320/5.png&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmBRAZO9iokB0-Tmm7INpO7pwlQO8pBLjgM806ROKZyfkKxHqzSRpnPqrk4iYrw5zM3jiWn_tEqwkVtoqNL2xC5K6ORLL6kraemOfK5jSm11DncgSIZupYF043hlteIUO8Z1XwVtuJyq8/s1600/6.jpg&quot;&gt;&lt;img style=&quot;TEXT-ALIGN: center; MARGIN: 0px auto 10px; WIDTH: 320px; DISPLAY: block; HEIGHT: 180px; CURSOR: hand&quot; id=&quot;BLOGGER_PHOTO_ID_5482264291745534482&quot; border=&quot;0&quot; alt=&quot;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmBRAZO9iokB0-Tmm7INpO7pwlQO8pBLjgM806ROKZyfkKxHqzSRpnPqrk4iYrw5zM3jiWn_tEqwkVtoqNL2xC5K6ORLL6kraemOfK5jSm11DncgSIZupYF043hlteIUO8Z1XwVtuJyq8/s320/6.jpg&quot; /&gt;&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://qt-articles.blogspot.com/feeds/2768606296367133724/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://qt-articles.blogspot.com/2010/06/how-to-add-stylesheet-for-button-in-qt.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5570325845627933731/posts/default/2768606296367133724'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5570325845627933731/posts/default/2768606296367133724'/><link rel='alternate' type='text/html' href='http://qt-articles.blogspot.com/2010/06/how-to-add-stylesheet-for-button-in-qt.html' title='How to add stylesheet for button in Qt'/><author><name>Contributor</name><uri>http://www.blogger.com/profile/03464211634349148049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEisgUUjMV7QMXczv6xVFbepw2gLOvM7s892iEwWRXivyuCwCoOYzPvCtFKTnCaveyC0SChMuyM9Dq38NkJU9xu5MlN7cRuGOdCV6EqPcCCUZ_U30wRwd6rdxOm1FrX764bsyTr6kFytzf8/s72-c/style1.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5570325845627933731.post-4396791311270689069</id><published>2010-06-13T06:37:00.000-07:00</published><updated>2010-06-13T06:53:14.516-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Custombutton"/><category scheme="http://www.blogger.com/atom/ns#" term="Qpainter"/><category scheme="http://www.blogger.com/atom/ns#" term="Qpushbutton"/><category scheme="http://www.blogger.com/atom/ns#" term="Qt"/><category scheme="http://www.blogger.com/atom/ns#" term="Qt4"/><category scheme="http://www.blogger.com/atom/ns#" term="Symbian"/><title type='text'>How to customize the Button in Qt</title><content type='html'>In this article,we will see how to customize button.&lt;br /&gt;&lt;br /&gt;Qt has provided the option to place any number of Texts and images at desired location over a button, but now i am showing how to place 3 Text and 1 image over a button.&lt;br /&gt;&lt;br /&gt;First we need to subclass the Qpushbutton, then override the paintEvent() method. In the paint event method perform the drawing Text, images etc..&lt;br /&gt;&lt;br /&gt;sample code is provided here..&lt;br /&gt;&lt;br /&gt;&lt;pre style=&quot;BORDER-BOTTOM: #999999 1px dashed; BORDER-LEFT: #999999 1px dashed; PADDING-BOTTOM: 5px; LINE-HEIGHT: 14px; BACKGROUND-COLOR: #eee; PADDING-LEFT: 5px; WIDTH: 100%; PADDING-RIGHT: 5px; FONT-FAMILY: Andale Mono, Lucida Console, Monaco, fixed, monospace; COLOR: #000000; FONT-SIZE: 12px; OVERFLOW: auto; BORDER-TOP: #999999 1px dashed; BORDER-RIGHT: #999999 1px dashed; PADDING-TOP: 5px&quot;&gt;&lt;code&gt;//Custom button class&lt;br /&gt;//Qt-articles.blogspot.com&lt;br /&gt;&lt;br /&gt;class CustomButton : public QPushButton&lt;br /&gt;    {&lt;br /&gt;    Q_OBJECT&lt;br /&gt; &lt;br /&gt;public:&lt;br /&gt;    CustomButton(QWidget *parent = 0);&lt;br /&gt;    ~CustomButton();&lt;br /&gt; &lt;br /&gt;public:&lt;br /&gt;    QString FirstName,MiddleName,Lastname;&lt;br /&gt;    QImage SimileIcon;&lt;br /&gt;    bool IsBkColorEnabled;&lt;br /&gt;    QColor Bkclor;&lt;br /&gt; &lt;br /&gt;protected:&lt;br /&gt;    void paintEvent(QPaintEvent *);&lt;br /&gt; &lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style=&quot;BORDER-BOTTOM: #999999 1px dashed; BORDER-LEFT: #999999 1px dashed; PADDING-BOTTOM: 5px; LINE-HEIGHT: 14px; BACKGROUND-COLOR: #eee; PADDING-LEFT: 5px; WIDTH: 100%; PADDING-RIGHT: 5px; FONT-FAMILY: Andale Mono, Lucida Console, Monaco, fixed, monospace; COLOR: #000000; FONT-SIZE: 12px; OVERFLOW: auto; BORDER-TOP: #999999 1px dashed; BORDER-RIGHT: #999999 1px dashed; PADDING-TOP: 5px&quot;&gt;&lt;code&gt;//Custom button implimentation file&lt;br /&gt;//Qt-articles.blogspot.com&lt;br /&gt;CustomButton::CustomButton(QWidget *parent)&lt;br /&gt;    : QPushButton(parent)&lt;br /&gt;{&lt;br /&gt;   &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;CustomButton::~CustomButton()&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;//Paint event of button&lt;br /&gt;void CustomButton::paintEvent(QPaintEvent *paint)&lt;br /&gt;{&lt;br /&gt;    QPushButton::paintEvent(paint);&lt;br /&gt;    QPainter p(this);&lt;br /&gt;    p.save();&lt;br /&gt;   &lt;br /&gt;    p.drawText(QPoint(100,100),FirstName); //Simple Text.&lt;br /&gt;    p.setPen(Qt::blue);                       //changing the color of pen.&lt;br /&gt;    p.setFont(QFont(&quot;Arial&quot;, 30));     //Changing the font.&lt;br /&gt;    p.drawText(QPoint(100,200),MiddleName);&lt;br /&gt;    p.drawText(QPoint(100,300),Lastname);&lt;br /&gt;    p.drawImage(QPoint(300,300),SimileIcon);&lt;br /&gt;    p.restore();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://qt-articles.blogspot.com/feeds/4396791311270689069/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://qt-articles.blogspot.com/2010/06/how-to-customize-button-in-qt.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5570325845627933731/posts/default/4396791311270689069'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5570325845627933731/posts/default/4396791311270689069'/><link rel='alternate' type='text/html' href='http://qt-articles.blogspot.com/2010/06/how-to-customize-button-in-qt.html' title='How to customize the Button in Qt'/><author><name>Contributor</name><uri>http://www.blogger.com/profile/03464211634349148049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5570325845627933731.post-139083590088897420</id><published>2010-06-13T01:27:00.000-07:00</published><updated>2010-06-13T06:32:23.996-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Files"/><category scheme="http://www.blogger.com/atom/ns#" term="Qt"/><category scheme="http://www.blogger.com/atom/ns#" term="Qt4"/><category scheme="http://www.blogger.com/atom/ns#" term="Resources"/><category scheme="http://www.blogger.com/atom/ns#" term="Symbian"/><title type='text'>How to Add Resources to Project in Qt</title><content type='html'>Its very simple, follow up these steps.&lt;br /&gt;&lt;br /&gt;Create new Qrc file.&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiq1W0JeruLf_PatfeGIjSZtPo8KZNDOdU-92x4S4kbEbEazraLVceg8V581O-afYi0TZHVR9pzoMWS3RNsliDQT7EKTbf9cXxu1DuWQfYK0Sy-PZsKQ5B3bE7Z9M7DfxPRGZf-6g3lyo4/s1600/first_addfile.jpg&quot;&gt;&lt;img style=&quot;TEXT-ALIGN: center; MARGIN: 0px auto 10px; WIDTH: 320px; DISPLAY: block; HEIGHT: 180px; CURSOR: pointer&quot; id=&quot;BLOGGER_PHOTO_ID_5482175715542607138&quot; border=&quot;0&quot; alt=&quot;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiq1W0JeruLf_PatfeGIjSZtPo8KZNDOdU-92x4S4kbEbEazraLVceg8V581O-afYi0TZHVR9pzoMWS3RNsliDQT7EKTbf9cXxu1DuWQfYK0Sy-PZsKQ5B3bE7Z9M7DfxPRGZf-6g3lyo4/s320/first_addfile.jpg&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEht0JI-dZD6sgJakZMRB3oeUrcRlffONlZA-I55iRofxb5pKNuzfscs4D8fmXfacPqygISWmhuwSXPJjcp0AjEHtxmna28N_XtQP6IxBROhZqV47ymSTiEDE-pWEQOwOcOavjCAeGQmvn8/s1600/New+Qrc.jpg&quot;&gt;&lt;img style=&quot;TEXT-ALIGN: center; MARGIN: 0px auto 10px; WIDTH: 320px; DISPLAY: block; HEIGHT: 180px; CURSOR: pointer&quot; id=&quot;BLOGGER_PHOTO_ID_5482175720417058290&quot; border=&quot;0&quot; alt=&quot;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEht0JI-dZD6sgJakZMRB3oeUrcRlffONlZA-I55iRofxb5pKNuzfscs4D8fmXfacPqygISWmhuwSXPJjcp0AjEHtxmna28N_XtQP6IxBROhZqV47ymSTiEDE-pWEQOwOcOavjCAeGQmvn8/s320/New+Qrc.jpg&quot; /&gt;&lt;/a&gt;&lt;br /&gt;New Qrc file looks like this&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjEmkzlhMXfqN1xF5xdhMcy9QAz4hnJjDMuTmITDrykl8tPQz9VYUTgbM2J_6c7nSFACuA0Gmcxla3JHps2V5SwrZlKm0gxCFd-KzM7r243nHsI_p9bOpusurlHT6utsppWQ8gyHYN2nY/s1600/Qrcfile.jpg&quot;&gt;&lt;img style=&quot;TEXT-ALIGN: center; MARGIN: 0px auto 10px; WIDTH: 320px; DISPLAY: block; HEIGHT: 180px; CURSOR: pointer&quot; id=&quot;BLOGGER_PHOTO_ID_5482175729313922322&quot; border=&quot;0&quot; alt=&quot;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjEmkzlhMXfqN1xF5xdhMcy9QAz4hnJjDMuTmITDrykl8tPQz9VYUTgbM2J_6c7nSFACuA0Gmcxla3JHps2V5SwrZlKm0gxCFd-KzM7r243nHsI_p9bOpusurlHT6utsppWQ8gyHYN2nY/s320/Qrcfile.jpg&quot; /&gt;&lt;/a&gt;&lt;br /&gt;Add the file to Qrc.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh72_I5v3Fya_KLsRV7WJrkM0rIDGfYwgyX9gbcOSDL0xlMV4pa-vmSL9iGUMsSkwSLdZ7j7NvOS79c4ZUNKZtB942ybl93Use3rq7-5uSZOXDlyxj3dDaQvwKggfkfZi-8rd2cNdkec88/s1600/addedFile.png&quot;&gt;&lt;img style=&quot;TEXT-ALIGN: center; MARGIN: 0px auto 10px; WIDTH: 320px; DISPLAY: block; HEIGHT: 180px; CURSOR: pointer&quot; id=&quot;BLOGGER_PHOTO_ID_5482175730705814066&quot; border=&quot;0&quot; alt=&quot;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh72_I5v3Fya_KLsRV7WJrkM0rIDGfYwgyX9gbcOSDL0xlMV4pa-vmSL9iGUMsSkwSLdZ7j7NvOS79c4ZUNKZtB942ybl93Use3rq7-5uSZOXDlyxj3dDaQvwKggfkfZi-8rd2cNdkec88/s320/addedFile.png&quot; /&gt;&lt;/a&gt;&lt;br /&gt;using the Resource file in project.&lt;br /&gt;&lt;br /&gt;&lt;pre style=&quot;BORDER-BOTTOM: rgb(204,204,204) 1px dashed; TEXT-ALIGN: left; BORDER-LEFT: rgb(204,204,204) 1px dashed; PADDING-BOTTOM: 0px; LINE-HEIGHT: 20px; PADDING-LEFT: 0px; WIDTH: 99%; PADDING-RIGHT: 0px; FONT-FAMILY: arial; BACKGROUND: url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTm8t8is7Mn0rzCuZX6DRdgM1tErEKyVA7BJwC3BvTP8TP6LJ6cvJsuuPIL6rZZzZlVGK2UCkGFlPJY8tkSBC_OhofvJTYm6qi51I0Ryj_0Fn2LnkwuLJRG9DQSFDWqzQKnBUIOOShBtRb/s320/codebg.gif) rgb(240,240,240); HEIGHT: auto; COLOR: rgb(0,0,0); FONT-SIZE: 12px; OVERFLOW: auto; BORDER-TOP: rgb(204,204,204) 1px dashed; BORDER-RIGHT: rgb(204,204,204) 1px dashed; PADDING-TOP: 0px; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial&quot;&gt;&lt;code style=&quot;COLOR: rgb(0,0,0)&quot;&gt; &quot;:/new/prefix1/icon/Smiley.bmp&quot;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;for example,&lt;/p&gt;&lt;p&gt; &lt;pre style=&quot;font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%&quot;&gt;&lt;code&gt;QIcon icon;&lt;br /&gt;icon.load(&amp;quot;:/new/prefix1/icon/Smiley.bmp&amp;quot;);&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;&lt;p&gt;Note:- Prefix of icon can be changed to your wish.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://qt-articles.blogspot.com/feeds/139083590088897420/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://qt-articles.blogspot.com/2010/06/how-to-add-resources-to-project-in-qt.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5570325845627933731/posts/default/139083590088897420'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5570325845627933731/posts/default/139083590088897420'/><link rel='alternate' type='text/html' href='http://qt-articles.blogspot.com/2010/06/how-to-add-resources-to-project-in-qt.html' title='How to Add Resources to Project in Qt'/><author><name>Contributor</name><uri>http://www.blogger.com/profile/03464211634349148049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiq1W0JeruLf_PatfeGIjSZtPo8KZNDOdU-92x4S4kbEbEazraLVceg8V581O-afYi0TZHVR9pzoMWS3RNsliDQT7EKTbf9cXxu1DuWQfYK0Sy-PZsKQ5B3bE7Z9M7DfxPRGZf-6g3lyo4/s72-c/first_addfile.jpg" height="72" width="72"/><thr:total>0</thr:total></entry></feed>