×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    118

    a confusion of QMaeoListPickSelector

    when i use QMaemo5ValueButton , i need to add a QMaemoListPickSelector in order to show another string on the same button,
    but QMaemoListPickSelector need to add a QStringListModel to show the string list.
    i only need QMaemoListPickSelector to show the string, and don't need to show the string list when i press the button, how to handle the press event and hide the string list?

  2. #2
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: a confusion of QMaeoListPickSelector

    Quote Originally Posted by fily_love View Post
    when i use QMaemo5ValueButton , i need to add a QMaemoListPickSelector in order to show another string on the same button
    You don't need QMaemo5ListPickSelector to show value text.
    Last edited by divanov; 2010-03-26 at 08:54.

  3. #3
    Registered User
    Join Date
    Mar 2009
    Posts
    118

    Re: a confusion of QMaeoListPickSelector

    Quote Originally Posted by divanov View Post
    You don't need QMaemoListPickSelector to show value text.
    does there have something else method??

  4. #4
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: a confusion of QMaeoListPickSelector

    Quote Originally Posted by fily_love View Post
    does there have something else method??
    http://qt.nokia.com/doc/qt-maemo-4.6...valueText-prop

  5. #5
    Registered User
    Join Date
    Mar 2009
    Posts
    118

    Re: a confusion of QMaeoListPickSelector

    thank you for your help. but i had used this function , i also want the text's color was blue.
    i don't know how to do that.

  6. #6
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: a confusion of QMaeoListPickSelector

    Quote Originally Posted by fily_love View Post
    i also want the text's color was blue
    It will definitely break Maemo styles, but:

    Code:
    #ifndef COLOUREDBUTTON_H
    #define COLOUREDBUTTON_H
    
    #include <QMaemo5ValueButton>
    
    class ColouredButton : public QMaemo5ValueButton
    {
        Q_OBJECT
    public:
        explicit ColouredButton(QWidget *parent = 0);
    
    protected:
        void paintEvent(QPaintEvent *event);
    };
    
    #endif //COLOUREDBUTTON_H
    Code:
    #include <QStylePainter>
    #include <QStyleOptionMaemo5ValueButton>
    
    #include "colouredbutton.h"
    
    ColouredButton::ColouredButton(QWidget *parent) : QMaemo5ValueButton(parent)
    {
    }
    
    void ColouredButton::paintEvent(QPaintEvent *)
    {
        ValueLayout layout = valueLayout();
        QStylePainter p(this);
        QStyleOptionButton button;
        initStyleOption(&button);
        QStyleOptionMaemo5ValueButton option;
        initStyleOption(&option);
        option.value = valueText();
        option.styles = (layout == ValueBesideText) ? QStyleOptionMaemo5ValueButton::ValueBesideText
                                                    : QStyleOptionMaemo5ValueButton::ValueUnderText;
        option.styles |= QStyleOptionMaemo5ValueButton::PickButton;
        if (layout == ValueUnderTextCentered)
            option.styles |= QStyleOptionMaemo5ValueButton::Centered;
    
        p.drawControl(QStyle::CE_PushButtonBevel, button);
        option.rect = style()->subElementRect(QStyle::SE_PushButtonContents, &button, this);
        p.drawControl(QStyle::CE_PushButtonLabel, option);
    }

Similar Threads

  1. Confusion about R class creation
    By haykey in forum Symbian
    Replies: 10
    Last Post: 2008-10-30, 16:43
  2. Confusion about file paths in N73
    By devang86 in forum Mobile Java General
    Replies: 0
    Last Post: 2008-03-14, 18:21
  3. Confusion on Some Symbian defined Classes
    By symbiUser in forum Symbian
    Replies: 4
    Last Post: 2008-02-26, 05:44
  4. Replies: 1
    Last Post: 2007-12-31, 16:56
  5. Directory confusion on Carbide C++ Pro
    By nroyer in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 3
    Last Post: 2006-12-20, 23:20

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×