Uploaded image for project: 'Qt Visual Studio Tools'
  1. Qt Visual Studio Tools
  2. QTVSADDINBUG-914

New UI classes are generated incorrectly

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Not Evaluated
    • None
    • 2.7.1 (rev.15)
    • General
    • None
    • Windows

    Description

      When you generate a new UI class in Visual Studio it creates a class that uses this format...

      #include <QDialog>
      #include "ui_DialogTest.h"
      
      class DialogTest : public QDialog
      {	
          Q_OBJECT 
      public:	
          DialogTest(QWidget *parent = Q_NULLPTR);	
          ~DialogTest(); 
      private:	
          Ui::DialogTest ui;
      };

      This makes it so the class can not be exported and used in other parts of your application because the "ui_DialogTest.h" file cannot be found. 

      If you create the same class in Creator then it uses this format...

      #include <QDialog>
      
      namespace Ui { 
          class DialogTest;
      }
      
      class DialogTest : public QDialog
      { 
          Q_OBJECT
      public: 
          DialogTest(QWidget *parent = Q_NULLPTR); 
          ~DialogTest();
      private: 
          Ui::DialogTest *ui;
      };
      

      It then includes "ui_DialogTest.h" in the cpp and initializes the ui pointer in the constructor. 

      This allows the header to be included in other parts of your code without an error and the class to be used as expected. The VS Tools templates should use the same format. 

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            mecfc Miguel Costa
            dan203 Dan Haddix
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes