[Qt-interest] Vertical tabs with icons instead text, tables with buttons, animated pictures on buttons

Malyushytsky, Alex alex at wai.com
Sat Mar 26 03:03:34 CET 2011


If you need to get access to protected members you need to subclass (C++).

For example you can make properties you need acce3ssible to public for your subclass:

class ExpandableTabWidget : public QTabWidget
{
    Q_OBJECT;
    Q_PROPERTY( bool expanding_tabs READ isExpanding WRITE setExpanding );

public:
    ExpandableTabWidget( QWidget *parent = NULL ) : QTabWidget( parent )
    {
    }

    bool isExpanding() const
    {
        return tabBar()->expanding();
    }

    void setTabsExpanding( bool expanding = true )
    {
        tabBar()->setExpanding( expanding );
    }
};

Just before you asked another question, if you subclass QTabWidget
You will need either to make plug-in or "promote" feature, if you want it to be used from designer.
Promotion feature needs less work, but most of the properties has to be set in code (not in the designer ).

Alex




-----Original Message-----
From: Nicholas Shatokhin [mailto:n.shatokhin at gmail.com]
Sent: Friday, March 25, 2011 6:41 PM
To: qt-interest at qt.nokia.com; Malyushytsky, Alex
Subject: Re: [Qt-interest] Vertical tabs with icons instead text, tables with buttons, animated pictures on buttons

/usr/include/qt4/QtGui/qtabwidget.h:167: error: ‘QTabBar*
QTabWidget::tabBar() const’ is protected

Sat, 26 Mar 2011 01:24:35 +0200 було написано Malyushytsky, Alex
<alex at wai.com>:

> According to documentation the following should work:
>
> QTabWidget* tabWidget =.......
>
> tabWidget->tabBar ()->setExpanding ( true );
>
>
> Regards,
>    Alex
>
> -----Original Message-----
> From: Nicholas Shatokhin [mailto:n.shatokhin at gmail.com]
> Sent: Friday, March 25, 2011 3:38 PM
> To: qt-interest at qt.nokia.com; Malyushytsky, Alex
> Subject: Re: [Qt-interest] Vertical tabs with icons instead text, tables
> with buttons, animated pictures on buttons
>
> How to resize tabs in QTabWidget?
>
> Now I have:
>
> ----------------------
> | Tab1 | Tab2 | Tab3 |
> ------------------------------------------------------
> |                                                    |
> |                                                    |
> |                                                    |
> |                                                    |
> |                                                    |
> |                                                    |
> |                                                    |
> ------------------------------------------------------
>
> But I need:
>
> ------------------------------------------------------
> |      Tab1      |       Tab2      |       Tab3      |
> ------------------------------------------------------
> |                                                    |
> |                                                    |
> |                                                    |
> |                                                    |
> |                                                    |
> |                                                    |
> |                                                    |
> ------------------------------------------------------
>
> How can I do this?
>
> Fri, 25 Mar 2011 23:23:07 +0200 було написано Malyushytsky, Alex
> <alex at wai.com>:
>
>> First I would recommend to use e-mail with English letters for English
>> speaking mailing lists.
>>
>>>> Where can I read about all this questions? What classes can I use for
>>>> it?
>>
>> Documentation. Before asking questions it is a good idea to read
>> documentation,
>> so trivial tasks are solved by you. Study all the available widgets.
>> Ask question only if you could not find answer yourself.
>> Qt has great documentation, use it.
>>
>> Example:
>>
>>>> 1. Vertical tabs with icons on them. When I click on tab, Icon must
>>>> change (better if it change when mouse cursor on it too - it good for
>> netbooks)
>>
>> Trivial use of QTabWidget. Check setTabPosition () const to set
>> orientation. Connect your slot to signal void currentChanged ( int index
>> ) and change icons there.
>>
>>>> 2. Buttons with icons instead text. When I click or drag mouse icon
>>>> change too. On some buttons animations starts when I press it (i.e.
>> button "Update", when I click start animation, button disabling. When
>> update finished button enables, animation stopping). And it better if
>> buttons will be flat - it must looks like as picture.
>>
>> Trivial use of QPushButton ( check its parent class - QAbstractButton
>> for inherited functionality). You can handle changing of the icon as a
>> reaction on appropriate signals. QPushButton::setFlat ( bool ) makes it
>> flat.
>> Animation could be done in several ways. One of the way I could suggest
>> http://doc.qt.nokia.com/4.7-snapshot/animation-overview.html
>>
>>
>>>> 3. Table with text and buttons in row (i.e. list of news: Author's
>>>> Name, News Name, button Delete). When I click on row (not on button)
>>>> must emit signal.
>>
>> QTableWidget / QTableView
>>
>>>> 4. How can I get html text of web page and cut a piece of it (I need
>>>> download page with news, cut news (delete advertisement, coments, site
>>>> logo and site style), set my style for it and show it in program).
>>
>> You can certainly download specific page. Since I don't have experience
>> with modifications you mentioned, I will refer you to documentations
>> which might help you :
>> http://doc.qt.nokia.com/4.7-snapshot/qtwebkit.html
>>
>>
>> Alex
>>
>>
>>
>>
>> -----Original Message-----
>> From: qt-interest-bounces+alex=wai.com at qt.nokia.com
>> [mailto:qt-interest-bounces+alex=wai.com at qt.nokia.com] On Behalf Of
>> ??????? ???????
>> Sent: Friday, March 25, 2011 10:20 AM
>> To: Yuvraaj Kelkar
>> Cc: qt-interest at qt.nokia.com
>> Subject: Re: [Qt-interest] Vertical tabs with icons instead text, tables
>> with buttons, animated pictures on buttons
>>
>> Where can I read about all this questions? What classes can I use for
>> it?
>>
>> 2011/3/25 Yuvraaj Kelkar <yuvraaj at gmail.com>:
>>> Yes to all questions.
>>>
>>> On Friday, March 25, 2011, Николай Шатохин <n.shatokhin at gmail.com>
>>> wrote:
>>>> Hello,
>>>>
>>>> I'm developing Qt application for tablet PC and I need that it looks
>>>> like as other apps for this tablet.
>>>>
>>>> So, how can I create:
>>>>
>>>> 1. Vertical tabs with icons on them. When I click on tab, Icon must
>>>> change (better if it change when mouse cursor on it too - it good for
>>>> netbooks)
>>>> 2. Buttons with icons instead text. When I click or drag mouse icon
>>>> change too. On some buttons animations starts when I press it (i.e.
>>>> button "Update", when I click start animation, button disabling. When
>>>> update finished button enables, animation stopping). And it better if
>>>> buttons will be flat - it must looks like as picture.
>>>> 3. Table with text and buttons in row (i.e. list of news: Author's
>>>> Name, News Name, button Delete). When I click on row (not on button)
>>>> must emit signal.
>>>> 4. How can I get html text of web page and cut a piece of it (I need
>>>> download page with news, cut news (delete advertisement, coments, site
>>>> logo and site style), set my style for it and show it in program).
>>>>
>>>> Is it possible to do these things in Qt4?
>>>>
>>>> Best regards,
>>>> Nick.
>>>> _______________________________________________
>>>> Qt-interest mailing list
>>>> Qt-interest at qt.nokia.com
>>>> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>>>>
>>>
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at qt.nokia.com
>> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>>
>>
>> ---------------------------------------------------------------------------------------------------
>> Weidlinger Associates, Inc. made the following annotations.
>>
>> “This message and any attachments are solely for the intended recipient
>> and may contain confidential or privileged information. If you are not
>> the intended recipient, any disclosure, copying, use, or distribution of
>> the information included in this message and any attachments is
>> prohibited. If you have received this communication in error, please
>> notify us by reply e-mail and immediately and permanently delete this
>> message and any attachments. Thank you.”
>>
>> “Please consider our environment before printing this email.”
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at qt.nokia.com
>> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>
>
> --
> За використання революційного клієнта електронної пошти Opera:
> http://www.opera.com/mail/
>
> “This message and any attachments are solely for the intended recipient
> and may contain confidential or privileged information. If you are not
> the intended recipient, any disclosure, copying, use, or distribution of
> the information included in this message and any attachments is
> prohibited. If you have received this communication in error, please
> notify us by reply e-mail and immediately and permanently delete this
> message and any attachments. Thank you.”
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest


--
За використання революційного клієнта електронної пошти Opera:
http://www.opera.com/mail/

“This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you.”


More information about the Qt-interest-old mailing list