Results 1 to 4 of 4

Thread: unable to drawButton using Q3Button

  1. #1
    Join Date
    Jan 2007
    Posts
    92
    Thanks
    14
    Thanked 1 Time in 1 Post

    Default unable to drawButton using Q3Button

    unable to drawButton using Q3Button

    CMenuButtons::EnableButtons( int pIndex )
    {
    1. // QButton *menuButton;

    =============//Replaced Line no 1. QButton with QAbstractButton in Qt 4==================

    1. // QAbstractButton *menuButton;


    2. int i;

    3. for (i = 0; i < menuButton; i++)
    {
    4. menuButton = tButtonGroup->find( button[ index ] );

    5. if ( menuButton != NULL )
    {
    if ( pIndex )
    {
    menuButton->show();
    }
    else
    {
    menuButton->hide();
    }
    }
    }
    }


    As mentioned in documentation , QAbstractButton has no equivalent for the Q3Button::drawButton(QPainter *) virtual function. I am just confused Where i need to call drawButton( ) function to draw button. After porting code to Qt 4 , I am not able to draw button at all.

    but if I replace with QButton with Q3Button I am getting error at Line 4

    saying error C2440: '=' : cannot convert from 'QAbstractButton *' to 'Q3Button .

  2. #2
    Join Date
    Sep 2006
    Posts
    339
    Thanks
    15
    Thanked 21 Times in 16 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: unable to drawButton using Q3Button

    Please use
    Qt Code:
    1. ...
    To copy to clipboard, switch view to plain text mode 
    tags. It makes code more understable. And if possible provide more information about what you are looking for.

  3. #3
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: unable to drawButton using Q3Button

    I am not aware much of Qt 3 ... but i guess u needed to override some drawButton function/.... u are trying the same using Q3Button...

    but in Qt 4 I guess the buttons are drawn automatically and u dont need too override any of the functions.... also check the QPushButton, QToolButton... u might be looking for them... if u want them to be checable, use the function setChecable(true)...

    hope this helps

  4. #4
    Join Date
    Sep 2006
    Posts
    339
    Thanks
    15
    Thanked 21 Times in 16 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: unable to drawButton using Q3Button

    From QtAssistance-->

    The solution is to reimplement QWidget:aintEvent() in your QAbstractButton subclass as follows:
    void MyButton:aintEvent(QPaintEvent *)
    {
    QPainter painter(this);
    drawButton(&painter);
    }
    Hope it heps

Similar Threads

  1. QSQLITE Unable to fetch row in create
    By xgoan in forum Newbie
    Replies: 3
    Last Post: 18th October 2006, 14:39

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.