Results 1 to 6 of 6

Thread: ui_....h issue

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,372
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: ui_....h issue

    Wow... hmm... strange solution... how about:

    Qt Code:
    1. #ifndef __FRAME_H
    2. #define __FRAME_H
    3. #include <QFrame>
    4. class FramePrivate;
    5. class Frame : public QFrame {
    6. public:
    7. Frame(QWidget *parent=0);
    8. ~Frame();
    9. private:
    10. FramePrivate *d;
    11. };
    12. #endif
    To copy to clipboard, switch view to plain text mode 
    Qt Code:
    1. #include "frame.h"
    2. #include "ui_frame.h"
    3. struct FramePrivate {
    4. Ui::Frame ui;
    5. };
    6.  
    7. Frame::Frame(QWidget *parent) : QFrame(parent), d(new FramePrivate){
    8. d->ui.setupUi(this);
    9. }
    10.  
    11. Frame::~Frame(){ delete d; }
    To copy to clipboard, switch view to plain text mode 

    This way the only place where you include the ui_xxx.h file is the implementation file and only the private class (P-IMPL) that is defined there needs the Ui component.

  2. The following user says thank you to wysota for this useful post:

    stevey (27th November 2007)

Similar Threads

  1. Qt layout issue
    By bunjee in forum Qt Programming
    Replies: 6
    Last Post: 15th August 2007, 19:43
  2. QSocketNotifier Issue
    By TheGrimace in forum Qt Programming
    Replies: 6
    Last Post: 18th July 2007, 21:29
  3. qt3 to qt4 - uic issue
    By hvengel in forum Qt Programming
    Replies: 10
    Last Post: 4th March 2007, 02:59
  4. Database access issue
    By Gayathri in forum Newbie
    Replies: 3
    Last Post: 23rd November 2006, 07:41
  5. Replies: 5
    Last Post: 22nd September 2006, 08:04

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.