Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/139.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 如何将.ui完全转换为c++;头文件和源文件_C++_Qt_Qmake_Uic - Fatal编程技术网

C++ 如何将.ui完全转换为c++;头文件和源文件

C++ 如何将.ui完全转换为c++;头文件和源文件,c++,qt,qmake,uic,C++,Qt,Qmake,Uic,我用Qt Creator设计工具创建了一些东西。 通过这样做,我得到了一个.ui、一个.h和两个.cpp(mainwindow.cpp和main.cpp)文件,其中包含以下内容: main window.ui: <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> <class>MainWindow</class> <widget class="QMainWindow" nam

我用Qt Creator设计工具创建了一些东西。 通过这样做,我得到了一个
.ui
、一个
.h
和两个
.cpp
mainwindow.cpp
main.cpp
)文件,其中包含以下内容:

main window.ui

<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>MainWindow</class>
 <widget class="QMainWindow" name="MainWindow">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>819</width>
    <height>634</height>
   </rect>
  </property>
  <property name="minimumSize">
   <size>
    <width>580</width>
    <height>400</height>
   </size>
  </property>
  <property name="windowTitle">
   <string>MainWindow</string>
  </property>
  <widget class="QWidget" name="centralwidget">
   <layout class="QGridLayout" name="gridLayout" rowstretch="1,4,4,0" columnstretch="2,0" rowminimumheight="1,1,10,1" columnminimumwidth="1,1">
    <property name="topMargin">
     <number>0</number>
    </property>
    <property name="bottomMargin">
     <number>0</number>
    </property>
    <property name="verticalSpacing">
     <number>6</number>
    </property>
    <item row="0" column="1">
     <widget class="QFrame" name="selectColonyFrame">
      <property name="minimumSize">
       <size>
        <width>150</width>
        <height>40</height>
       </size>
      </property>
      <property name="layoutDirection">
       <enum>Qt::RightToLeft</enum>
      </property>
      <property name="frameShape">
       <enum>QFrame::StyledPanel</enum>
      </property>
      <property name="frameShadow">
       <enum>QFrame::Raised</enum>
      </property>
      <widget class="QPushButton" name="selectColonyButton">
       <property name="geometry">
        <rect>
         <x>80</x>
         <y>0</y>
         <width>150</width>
         <height>40</height>
        </rect>
       </property>
       <property name="minimumSize">
        <size>
         <width>150</width>
         <height>40</height>
        </size>
       </property>
       <property name="maximumSize">
        <size>
         <width>150</width>
         <height>50</height>
        </size>
       </property>
       <property name="font">
        <font>
         <pointsize>11</pointsize>
         <weight>75</weight>
         <bold>true</bold>
        </font>
       </property>
       <property name="text">
        <string>Andere Kolonie ...</string>
       </property>
      </widget>
     </widget>
    </item>
    <item row="0" column="0">
     <widget class="QFrame" name="currentColonyFrame">
      <property name="sizePolicy">
       <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
        <horstretch>0</horstretch>
        <verstretch>0</verstretch>
       </sizepolicy>
      </property>
      <property name="minimumSize">
       <size>
        <width>0</width>
        <height>25</height>
       </size>
      </property>
      <property name="frameShape">
       <enum>QFrame::StyledPanel</enum>
      </property>
      <property name="frameShadow">
       <enum>QFrame::Raised</enum>
      </property>
      <widget class="QLabel" name="currentColonyLabel">
       <property name="geometry">
        <rect>
         <x>10</x>
         <y>10</y>
         <width>301</width>
         <height>16</height>
        </rect>
       </property>
       <property name="minimumSize">
        <size>
         <width>220</width>
         <height>15</height>
        </size>
       </property>
       <property name="maximumSize">
        <size>
         <width>460</width>
         <height>25</height>
        </size>
       </property>
       <property name="font">
        <font>
         <pointsize>10</pointsize>
        </font>
       </property>
       <property name="text">
        <string>Aktuelle Kolonie: Lithium-Stollen 13-A</string>
       </property>
      </widget>
     </widget>
    </item>
    <item row="3" column="1">
     <widget class="QFrame" name="missionControlsFrame">
      <property name="sizePolicy">
       <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
        <horstretch>8</horstretch>
        <verstretch>8</verstretch>
       </sizepolicy>
      </property>
      <property name="maximumSize">
       <size>
        <width>300</width>
        <height>180</height>
       </size>
      </property>
      <property name="frameShape">
       <enum>QFrame::WinPanel</enum>
      </property>
      <property name="frameShadow">
       <enum>QFrame::Raised</enum>
      </property>
      <layout class="QVBoxLayout" name="verticalLayout">
       <item>
        <widget class="QLabel" name="misisonControlsLabel">
         <property name="font">
          <font>
           <pointsize>11</pointsize>
          </font>
         </property>
         <property name="text">
          <string>Missionsablauf</string>
         </property>
         <property name="alignment">
          <set>Qt::AlignCenter</set>
         </property>
        </widget>
       </item>
       <item>
        <layout class="QGridLayout" name="missionControlsGridLayout">
         <property name="leftMargin">
          <number>15</number>
         </property>
         <property name="topMargin">
          <number>20</number>
         </property>
         <property name="rightMargin">
          <number>15</number>
         </property>
         <property name="bottomMargin">
          <number>0</number>
         </property>
         <property name="horizontalSpacing">
          <number>20</number>
         </property>
         <property name="verticalSpacing">
          <number>10</number>
         </property>
         <item row="0" column="0">
          <widget class="QPushButton" name="startButton">
           <property name="minimumSize">
            <size>
             <width>80</width>
             <height>30</height>
            </size>
           </property>
           <property name="maximumSize">
            <size>
             <width>130</width>
             <height>50</height>
            </size>
           </property>
           <property name="font">
            <font>
             <pointsize>12</pointsize>
            </font>
           </property>
           <property name="text">
            <string>Start</string>
           </property>
          </widget>
         </item>
         <item row="0" column="1">
          <widget class="QPushButton" name="abortButton">
           <property name="minimumSize">
            <size>
             <width>80</width>
             <height>30</height>
            </size>
           </property>
           <property name="maximumSize">
            <size>
             <width>130</width>
             <height>50</height>
            </size>
           </property>
           <property name="font">
            <font>
             <pointsize>12</pointsize>
            </font>
           </property>
           <property name="layoutDirection">
            <enum>Qt::LeftToRight</enum>
           </property>
           <property name="text">
            <string>Abbruch</string>
           </property>
           <property name="autoDefault">
            <bool>false</bool>
           </property>
           <property name="default">
            <bool>false</bool>
           </property>
           <property name="flat">
            <bool>false</bool>
           </property>
          </widget>
         </item>
         <item row="1" column="0">
          <widget class="QPushButton" name="singleStepButton">
           <property name="minimumSize">
            <size>
             <width>80</width>
             <height>30</height>
            </size>
           </property>
           <property name="maximumSize">
            <size>
             <width>130</width>
             <height>50</height>
            </size>
           </property>
           <property name="font">
            <font>
             <pointsize>12</pointsize>
            </font>
           </property>
           <property name="text">
            <string>Einzelschritt</string>
           </property>
          </widget>
         </item>
         <item row="1" column="1">
          <widget class="QPushButton" name="autoButton">
           <property name="minimumSize">
            <size>
             <width>80</width>
             <height>30</height>
            </size>
           </property>
           <property name="maximumSize">
            <size>
             <width>130</width>
             <height>50</height>
            </size>
           </property>
           <property name="font">
            <font>
             <pointsize>12</pointsize>
            </font>
           </property>
           <property name="layoutDirection">
            <enum>Qt::LeftToRight</enum>
           </property>
           <property name="text">
            <string>Automatik</string>
           </property>
           <property name="autoDefault">
            <bool>false</bool>
           </property>
           <property name="default">
            <bool>false</bool>
           </property>
           <property name="flat">
            <bool>false</bool>
           </property>
          </widget>
         </item>
         <item row="2" column="1">
          <widget class="QPushButton" name="pauseButton">
           <property name="minimumSize">
            <size>
             <width>80</width>
             <height>30</height>
            </size>
           </property>
           <property name="maximumSize">
            <size>
             <width>130</width>
             <height>50</height>
            </size>
           </property>
           <property name="font">
            <font>
             <pointsize>12</pointsize>
            </font>
           </property>
           <property name="layoutDirection">
            <enum>Qt::LeftToRight</enum>
           </property>
           <property name="text">
            <string>Anhalten</string>
           </property>
           <property name="autoDefault">
            <bool>false</bool>
           </property>
           <property name="default">
            <bool>false</bool>
           </property>
           <property name="flat">
            <bool>false</bool>
           </property>
          </widget>
         </item>
        </layout>
       </item>
      </layout>
     </widget>
    </item>
    <item row="1" column="1" rowspan="2">
     <widget class="QFrame" name="botControlsFrame">
      <property name="sizePolicy">
       <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
        <horstretch>4</horstretch>
        <verstretch>4</verstretch>
       </sizepolicy>
      </property>
      <property name="minimumSize">
       <size>
        <width>160</width>
        <height>120</height>
       </size>
      </property>
      <property name="maximumSize">
       <size>
        <width>320</width>
        <height>240</height>
       </size>
      </property>
      <property name="frameShape">
       <enum>QFrame::WinPanel</enum>
      </property>
      <property name="frameShadow">
       <enum>QFrame::Raised</enum>
      </property>
      <layout class="QGridLayout" name="gridLayout_2" rowstretch="0,2,1,1">
       <item row="1" column="0" rowspan="3">
        <layout class="QGridLayout" name="botControlsGridLayout" rowstretch="0,0,0" columnstretch="0,0,0">
         <property name="sizeConstraint">
          <enum>QLayout::SetMinimumSize</enum>
         </property>
         <item row="2" column="1">
          <widget class="QPushButton" name="downButton">
           <property name="minimumSize">
            <size>
             <width>30</width>
             <height>30</height>
            </size>
           </property>
           <property name="maximumSize">
            <size>
             <width>50</width>
             <height>50</height>
            </size>
           </property>
           <property name="layoutDirection">
            <enum>Qt::LeftToRight</enum>
           </property>
           <property name="text">
            <string/>
           </property>
           <property name="icon">
            <iconset resource="grafics.qrc">
             <normaloff>:/grafics/grafics/pfeile/pfeil_unten.tga</normaloff>:/grafics/grafics/pfeile/pfeil_unten.tga</iconset>
           </property>
           <property name="iconSize">
            <size>
             <width>50</width>
             <height>50</height>
            </size>
           </property>
          </widget>
         </item>
         <item row="0" column="1">
          <widget class="QPushButton" name="upButton">
           <property name="minimumSize">
            <size>
             <width>30</width>
             <height>30</height>
            </size>
           </property>
           <property name="maximumSize">
            <size>
             <width>50</width>
             <height>50</height>
            </size>
           </property>
           <property name="sizeIncrement">
            <size>
             <width>0</width>
             <height>0</height>
            </size>
           </property>
           <property name="text">
            <string/>
           </property>
           <property name="icon">
            <iconset resource="grafics.qrc">
             <normaloff>:/grafics/grafics/pfeile/pfeil_oben.tga</normaloff>:/grafics/grafics/pfeile/pfeil_oben.tga</iconset>
           </property>
           <property name="iconSize">
            <size>
             <width>50</width>
             <height>50</height>
            </size>
           </property>
          </widget>
         </item>
         <item row="1" column="1">
          <widget class="QPushButton" name="waitButton">
           <property name="minimumSize">
            <size>
             <width>30</width>
             <height>30</height>
            </size>
           </property>
           <property name="maximumSize">
            <size>
             <width>50</width>
             <height>50</height>
            </size>
           </property>
           <property name="font">
            <font>
             <family>MS Shell Dlg 2</family>
             <pointsize>15</pointsize>
            </font>
           </property>
           <property name="contextMenuPolicy">
            <enum>Qt::DefaultContextMenu</enum>
           </property>
           <property name="text">
            <string>W</string>
           </property>
           <property name="icon">
            <iconset theme="&amp;#9664">
             <normaloff>.</normaloff>.</iconset>
           </property>
          </widget>
         </item>
         <item row="1" column="0">
          <widget class="QPushButton" name="leftButton">
           <property name="minimumSize">
            <size>
             <width>30</width>
             <height>30</height>
            </size>
           </property>
           <property name="maximumSize">
            <size>
             <width>50</width>
             <height>50</height>
            </size>
           </property>
           <property name="text">
            <string/>
           </property>
           <property name="icon">
            <iconset resource="grafics.qrc">
             <normaloff>:/grafics/grafics/pfeile/pfeil_links.tga</normaloff>:/grafics/grafics/pfeile/pfeil_links.tga</iconset>
           </property>
           <property name="iconSize">
            <size>
             <width>50</width>
             <height>50</height>
            </size>
           </property>
          </widget>
         </item>
         <item row="0" column="2">
          <widget class="QPushButton" name="deleteButton">
           <property name="minimumSize">
            <size>
             <width>30</width>
             <height>30</height>
            </size>
           </property>
           <property name="maximumSize">
            <size>
             <width>50</width>
             <height>50</height>
            </size>
           </property>
           <property name="font">
            <font>
             <pointsize>15</pointsize>
            </font>
           </property>
           <property name="text">
            <string>&lt;</string>
           </property>
          </widget>
         </item>
         <item row="1" column="2">
          <widget class="QPushButton" name="rightButton">
           <property name="minimumSize">
            <size>
             <width>30</width>
             <height>30</height>
            </size>
           </property>
           <property name="maximumSize">
            <size>
             <width>50</width>
             <height>50</height>
            </size>
           </property>
           <property name="sizeIncrement">
            <size>
             <width>0</width>
             <height>0</height>
            </size>
           </property>
           <property name="text">
            <string/>
           </property>
           <property name="icon">
            <iconset resource="grafics.qrc">
             <normaloff>:/grafics/grafics/pfeile/pfeil_rechts.tga</normaloff>:/grafics/grafics/pfeile/pfeil_rechts.tga</iconset>
           </property>
           <property name="iconSize">
            <size>
             <width>50</width>
             <height>50</height>
            </size>
           </property>
          </widget>
         </item>
        </layout>
       </item>
       <item row="0" column="0" colspan="2">
        <widget class="QLabel" name="botControlsLabel">
         <property name="font">
          <font>
           <pointsize>11</pointsize>
          </font>
         </property>
         <property name="text">
          <string>Programmieren</string>
         </property>
         <property name="alignment">
          <set>Qt::AlignCenter</set>
         </property>
        </widget>
       </item>
       <item row="1" column="1">
        <widget class="QComboBox" name="repeatDropdown">
         <property name="minimumSize">
          <size>
           <width>80</width>
           <height>30</height>
          </size>
         </property>
         <property name="maximumSize">
          <size>
           <width>130</width>
           <height>50</height>
          </size>
         </property>
         <property name="font">
          <font>
           <pointsize>15</pointsize>
           <weight>75</weight>
           <italic>false</italic>
           <bold>true</bold>
          </font>
         </property>
         <property name="focusPolicy">
          <enum>Qt::WheelFocus</enum>
         </property>
         <property name="layoutDirection">
          <enum>Qt::LeftToRight</enum>
         </property>
         <property name="currentText">
          <string>1</string>
         </property>
         <property name="insertPolicy">
          <enum>QComboBox::NoInsert</enum>
         </property>
         <property name="frame">
          <bool>true</bool>
         </property>
         <item>
          <property name="text">
           <string>1</string>
          </property>
         </item>
         <item>
          <property name="text">
           <string>2</string>
          </property>
         </item>
         <item>
          <property name="text">
           <string>3</string>
          </property>
         </item>
         <item>
          <property name="text">
           <string>4</string>
          </property>
         </item>
         <item>
          <property name="text">
           <string>5</string>
          </property>
         </item>
        </widget>
       </item>
       <item row="2" column="1">
        <widget class="QFrame" name="frame_6">
         <property name="frameShape">
          <enum>QFrame::StyledPanel</enum>
         </property>
         <property name="frameShadow">
          <enum>QFrame::Raised</enum>
         </property>
        </widget>
       </item>
       <item row="3" column="1">
        <widget class="QFrame" name="botCommandFrame">
         <property name="minimumSize">
          <size>
           <width>100</width>
           <height>80</height>
          </size>
         </property>
         <property name="maximumSize">
          <size>
           <width>130</width>
           <height>16777215</height>
          </size>
         </property>
         <property name="frameShape">
          <enum>QFrame::StyledPanel</enum>
         </property>
         <property name="frameShadow">
          <enum>QFrame::Raised</enum>
         </property>
         <widget class="QTextEdit" name="botCommandTextEdit">
          <property name="geometry">
           <rect>
            <x>0</x>
            <y>16</y>
            <width>108</width>
            <height>50</height>
           </rect>
          </property>
          <property name="sizePolicy">
           <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
            <horstretch>130</horstretch>
            <verstretch>50</verstretch>
           </sizepolicy>
          </property>
          <property name="minimumSize">
           <size>
            <width>80</width>
            <height>30</height>
           </size>
          </property>
          <property name="maximumSize">
           <size>
            <width>130</width>
            <height>50</height>
           </size>
          </property>
          <property name="font">
           <font>
            <pointsize>15</pointsize>
           </font>
          </property>
          <property name="verticalScrollBarPolicy">
           <enum>Qt::ScrollBarAlwaysOff</enum>
          </property>
          <property name="horizontalScrollBarPolicy">
           <enum>Qt::ScrollBarAlwaysOn</enum>
          </property>
          <property name="lineWrapMode">
           <enum>QTextEdit::NoWrap</enum>
          </property>
          <property name="readOnly">
           <bool>true</bool>
          </property>
          <property name="placeholderText">
           <string>Textfeld</string>
          </property>
         </widget>
        </widget>
       </item>
      </layout>
     </widget>
    </item>
    <item row="1" column="0" rowspan="3">
     <widget class="QFrame" name="mapFrame">
      <property name="sizePolicy">
       <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
        <horstretch>0</horstretch>
        <verstretch>0</verstretch>
       </sizepolicy>
      </property>
      <property name="minimumSize">
       <size>
        <width>120</width>
        <height>120</height>
       </size>
      </property>
      <property name="frameShape">
       <enum>QFrame::StyledPanel</enum>
      </property>
      <property name="frameShadow">
       <enum>QFrame::Raised</enum>
      </property>
      <layout class="QGridLayout" name="gridLayout_6">
       <property name="spacing">
        <number>0</number>
       </property>
       <item row="0" column="0">
        <widget class="QLabel" name="label">
         <property name="sizePolicy">
          <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
           <horstretch>0</horstretch>
           <verstretch>0</verstretch>
          </sizepolicy>
         </property>
         <property name="minimumSize">
          <size>
           <width>0</width>
           <height>0</height>
          </size>
         </property>
         <property name="frameShape">
          <enum>QFrame::Box</enum>
         </property>
         <property name="text">
          <string>Umgebungskarte</string>
         </property>
         <property name="alignment">
          <set>Qt::AlignCenter</set>
         </property>
        </widget>
       </item>
       <item row="0" column="1">
        <widget class="QScrollBar" name="verticalScrollBar">
         <property name="orientation">
          <enum>Qt::Vertical</enum>
         </property>
        </widget>
       </item>
       <item row="1" column="0">
        <widget class="QScrollBar" name="horizontalScrollBar">
         <property name="sizePolicy">
          <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
           <horstretch>0</horstretch>
           <verstretch>0</verstretch>
          </sizepolicy>
         </property>
         <property name="orientation">
          <enum>Qt::Horizontal</enum>
         </property>
        </widget>
       </item>
      </layout>
     </widget>
    </item>
   </layout>
  </widget>
  <widget class="QMenuBar" name="menubar">
   <property name="geometry">
    <rect>
     <x>0</x>
     <y>0</y>
     <width>819</width>
     <height>20</height>
    </rect>
   </property>
  </widget>
  <widget class="QStatusBar" name="statusbar"/>
 </widget>
 <resources>
  <include location="grafics.qrc"/>
 </resources>
 <connections/>
</ui>
main window.cpp

#include "mainwindow.h"
#include "ui_mainwindow.h"

#include "QMessageBox"

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
}

MainWindow::~MainWindow()
{
    delete ui;
}


void MainWindow::on_upButton_clicked()
{
    QMessageBox::information(this, "button", "up");
}

void MainWindow::on_rightButton_clicked()
{
    QMessageBox::information(this, "button", "right");
}

void MainWindow::on_downButton_clicked()
{
    QMessageBox::information(this, "button", "down");
}

void MainWindow::on_leftButton_clicked()
{
    QMessageBox::information(this, "button", "left");
}

void MainWindow::on_waitButton_clicked()
{
    QMessageBox::information(this, "button", "wait");
}

void MainWindow::on_deleteButton_clicked()
{
    QMessageBox::information(this, "button", "delete");
}

void MainWindow::on_selectColonyButton_clicked()
{
    QMessageBox::information(this, "button", ui->selectColonyButton->text());
}

void MainWindow::on_startButton_clicked()
{
    QMessageBox::information(this, "button", ui->startButton->text());
}

void MainWindow::on_abortButton_clicked()
{
    QMessageBox::information(this, "button", ui->abortButton->text());
}

void MainWindow::on_singleStepButton_clicked()
{
    QMessageBox::information(this, "button", ui->singleStepButton->text());
}

void MainWindow::on_autoButton_clicked()
{
    QMessageBox::information(this, "button", ui->autoButton->text());
}

void MainWindow::on_pauseButton_clicked()
{
    QMessageBox::information(this, "button", ui->pauseButton->text());
}
main.cpp

#include "mainwindow.h"

#include <QApplication>

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    MainWindow w;
    w.show();
    return app.exec();
}
#包括“mainwindow.h”
#包括
int main(int argc,char*argv[])
{
QApplication应用程序(argc、argv);
主窗口w;
w、 show();
返回app.exec();
}
现在我想要的是一个
.cpp
文件,它不仅包含我手动创建的信号和插槽,还包含所有内容。我用设计器添加的每个布局、每个标签、每个按钮。据我所知,有一种方法可以实现这一点:
qmake
uic

现在的问题是:我如何实际使用其中一个

我尝试过通过命令提示符使用
uic
,打开所有这些文件所在的文件夹并执行以下操作:
uic-o mainwindow.h mainwindow.ui
(谷歌搜索了一下,发现了这一点)

但我得到的错误是这样的:“uic”命令要么写错了,要么找不到。(试图用我的语言翻译)


关于如何解决问题的任何想法,或者关于如何实现我需要的任何不同想法?

使用qmake,以下是所有基本解释的链接:

对于.ui文件,可以将其添加到.pro文件,如下所示:

FORMS += foo.ui

你在用什么操作系统?您使用的是什么编译器?您是如何安装qt的?@thomas我下载了
qt-unified-windows-x86-3.1.1-online.exe
,当选择qt的verison和其他东西时,我选择了“qt 5.12.6”->“MSVC 2017 64位”和“qt 5.12.6”->“MinGW 7.3.0 64位”如果您在windows上,请确保使用所需的qt工具包中的命令提示符(即开始菜单->Qt->版本->套件->命令提示).
uic
应该在那里可用。很抱歉这么晚才回答,但我上床睡觉了。所以我现在得到了头文件,但要得到.cpp文件,我应该使用以下内容:
uic-I headerfile.h-o newName.cpp uiFile.ui
,但如果我使用它,它会说:
uic:Unknown选项“I”。
想法?我已经尝试过了,但我已经放弃了我想我的
路径
变量出了问题。我需要向
路径
变量添加什么确切路径才能使用
qmake
?我知道某些文件夹的路径是我的电脑特有的,但我不知道必须添加哪个文件夹/文件能够使用
qmake
FORMS += foo.ui