-2
槽的Qt槽被調用 我有一個對MI ClassA.ui沒有連接被稱爲未連接
,並在頭文件ClassA.h命名btnStart QPushButton:
private slots:
void on_btnQuit_clicked();
,當我點擊按鈕btnStart在槽on_btnQuit_clicked()上輸入,但我不連接任何東西。
classA.h
class classA : public QDialog
{
Q_OBJECT
public:
classA(QWidget *parent = 0);
~classA();
private:
Ui::classA* m_ui;
private slots:
void on_btnStart_clicked();
};
classA.cpp
#include "ClassA.h"
#include "ui_ClassA.h"
ClassA::ClassA(QWidget *parent):
QDialog(parent),
m_ui(new Ui::classA)
{
m_ui->setupUi(this);
}
ClassA::~ClassA()
{
SWT_DENULL(m_ui);
}
void ClassA::on_btnStart_clicked()
{
//here
}
classA.ui
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>classA</class>
<widget class="QDialog" name="classA">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>667</width>
<height>433</height>
</rect>
</property>
<property name="windowTitle">
<string>title</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QPushButton" name="btnStart">
<property name="text">
<string>Start title</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>
提供代碼! – Claudio 2014-10-07 13:25:18
您可能已將其連接到您的QML文件中。 – Zeta 2014-10-07 13:28:25