[Qt-interest] elide mode is not working properly with QTabBar

Santhosh Y santhosh at softjin.com
Wed Jul 1 15:32:44 CEST 2009


Hi,

I am trying to set the elidemode for the tab bar text
It is not working. Following class is sub-classed from QTabBar.

The style sheet I am using is also mentioned after the bottom of the class

Please suggest me some body, what is wrong here!
--------------------------------------------------------------------------------------
// Status Tab Bar
class StatusTabBar : public QTabBar
{
    Q_OBJECT
    public:
        StatusTabBar () : QTabBar ()
        {
            // setting shape
            setShape (QTabBar::TriangularSouth);

            // object name is useful in identifying thsi particluar tab 
bar for setting style sheet
            setObjectName ("StatusBarTabBar");

            // Adding Tabs
            QString str1 ("Name 1");
            int recipeIndex = addTab (str1);
            setTabToolTip (recipeIndex, str1);
    
            QString str2 (" Results1 For Y Kumar Santhosh");
            int inspIndex = addTab (QIcon(":/images/Arrow.png"), str2);
            setTabToolTip (inspIndex, str2);
           
            QString str3 ("new  Results for the test");
            int thirdTab = addTab (str3);
            setTabToolTip (thirdTab, str3);
             
            ///////////////////////////////////////////// text elide mode
            setElideMode ( Qt::ElideMiddle);
        }

        virtual ~StatusTabBar () {}

    protected:
       QSize tabSizeHint (int) const {  return QSize(115,27);}
};

/////////////////////////// Style sheet
    // Status Bar - Tab Bar Settings
        "QTabBar#StatusBarTabBar::tab:selected { background-image: 
url(:/images/selected.png); }"

           "QTabBar#StatusBarTabBar::tab:!selected { margin-top: 2px; \
                                                background-image: 
url(:/images/normal.png)}"

        "QTabBar#StatusBarTabBar::tab { border: 2px solid #C4C4C3; \
                                            min-width: 8ex; \
                                            padding: 2px; }"
           
        "QTabBar#StatusBarTabBar { font: bold 12px;}"

-- 
----------------------------------------------------
Y Santhosh Kumar
Senior Software Engineer
SoftJin Technologies Private Limited
Unit No. 102, Mobius Tower,
I Floor, SJR I - Park,
EPIP, White Field,
Bangalore - 560066, India
U : www.softjin.com
E : santhosh at softjin.com
T : +91-80-41779999
M : +91-9740535265
----------------------------------------------------



Business Disclaimer
____________________________________________________________
This e-mail message and any files transmitted with it are intended solely
for  the use  of the  individual or entity  to which they  are  addressed. It
may  contain confidential,  proprietary or legally  privileged  information.
If  you  are  not  the  intended recipient please be advised that you have
received  this  message in error and any use is strictly prohibited. Please
immediately  delete it  and all copies of it from your system, destroy any
hard  copies  of  it and  notify  the  sender  by return mail. You must not,
directly or indirectly, use,  disclose,  distribute, print, or copy any part of
this message if you are not the intended recipient.
___________________________________________________________





More information about the Qt-interest-old mailing list