Public feed #887151

Something

public text v1 · immutable
Raw Edit
·published 2008-02-01 04:00 UTC
rendered paste body
########################################
In th file kremenu.h 
########################################

typedef Q3ValueList <Menu>::Iterator MenuId;


class Menu
{
public:
        // Methods

        Menu( void );
        Menu( const Menu &m );
        ~Menu( void );
        void addButton( KreMenuButton *button );
        Menu& operator=( const Menu &m );

        // Variables

        QMap <KreMenuButton*, int> positionList; // Stores the indexes for the widgets
        QMap <int, KreMenuButton*> widgetList; // Stores the widgets for each position (just the inverse mapping)
        KreMenuButton* activeButton; // Indicates which button is highlighted
        int childPos;
        int widgetNumber;
private:
        // Methods
        void copyMap( QMap <int, KreMenuButton*> &destMap, const QMap <int, KreMenuButton*> &origMap );
        void copyMap( QMap <KreMenuButton*, int> &destMap, const QMap <KreMenuButton*, int> &origMap );
};



########################################
In the file kremenu.cpp
########################################


KreMenuButton::KreMenuButton( KreMenu *parent, KrePanel _panel, MenuId id, const char *name ) : QWidget( parent, name, Qt::WNoAutoErase ), panel( _panel )
{
        highlighted = false;
        text = QString::null;

        if ( id == 0 )
                menuId = parent->mainMenu();
        else
                menuId = id;

        subMenuId = 0; // By default it's not a submenu button

        resize( parent->size().width(), 55 );
        connect ( parent, SIGNAL( resized( int, int ) ), this, SLOT( rescale() ) );
        connect( this, SIGNAL( clicked() ), this, SLOT( forwardClicks() ) );
        setCursor( QCursor( Qt::PointingHandCursor ) );
}