Results 1 to 3 of 3

Thread: undeclared method - GUI Styles

  1. #1
    Join Date
    Oct 2006
    Location
    San Francisco, USA
    Posts
    14
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Windows

    Default undeclared method - GUI Styles

    Hi,

    I am getting the following error with the style() method.

    error: `drawItemText' has not been declared

    Do I need to configure Qt 4 (on win32 platform) with an option to get the GUI style libraries to configure correctly (I believe that may be the problem)?

    Thanks,
    Amanda

    Code excerpts:

    Qt Code:
    1. class StatusLabel : public QLabel
    2. { Q_OBJECT
    3. public:
    4. StatusLabel(QWidget *parent=0, const char *name=0);
    5.  
    6. protected:
    7. virtual void paintEvent(QPaintEvent *);
    8. };
    9.  
    10.  
    11. void StatusLabel:: paintEvent(QPaintEvent *)
    12. {
    13. QPixmap buffer(size());
    14. buffer.fill(paletteBackgroundColor());
    15. QPainter p(&buffer);
    16. QRect cr = contentsRect();
    17. style().drawItemText(&p, cr, alignment(), colorGroup(), isEnabled(), pixmap(), text());
    18. bitBlt(this, 0, 0, &buffer);
    19. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by wysota; 19th November 2006 at 08:41. Reason: missing [code] tags

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,369
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: undeclared method - GUI Styles

    style() returns a pointer to a style, so the code is surely incorrect because you should use "->" instead of "."

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: undeclared method - GUI Styles

    Also make sure you have #include <QStyle>

Similar Threads

  1. variable in method not initialized?!
    By frosch in forum Qt Programming
    Replies: 10
    Last Post: 3rd September 2006, 14:09
  2. use qpsql
    By raphaelf in forum Installation and Deployment
    Replies: 34
    Last Post: 22nd August 2006, 12:52
  3. Qt 4.1.4 plugin QPSQL
    By jcr in forum Installation and Deployment
    Replies: 4
    Last Post: 22nd June 2006, 22:55
  4. Unable to execute in Debug Mode
    By Kapil in forum Installation and Deployment
    Replies: 38
    Last Post: 5th April 2006, 07:27
  5. lQtGuid4 error - Compiler setting problem
    By Kapil in forum Installation and Deployment
    Replies: 7
    Last Post: 10th February 2006, 09:30

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.