执行QT程序没有界面出现
为什么执行QT程序没有界面出现呢,编辑都没有问题,但就是没有界面。请高手指点。
#include <QtGui/QApplication>
#include "gotocelldialog.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
GoToCellDialog w;
w.show();
return a.exec();
}
#ifndef GOTOCELLDIALOG_H
#define GOTOCELLDIALOG_H
#include <QWidget>
#include "ui_gotocelldialog.h"
namespace Ui {
class GoToCellDialog;
}
class GoToCellDialog : public QWidget,public Ui::GoToCellDialog
{
Q_OBJECT
public:
explicit GoToCellDialog(QWidget *parent = 0);
~GoToCellDialog();
private:
Ui::GoToCellDialog *ui;
private slots:
void on_lineEdit_textChanged(QString );
};
#endif // GOTOCELLDIALOG_H
#include "gotocelldialog.h"
#include "ui_gotocelldialog.h"
#include <QtGui>
GoToCellDialog::GoToCellDialog(QWidget *parent) :
QWidget(parent),
ui(new Ui::GoToCellDialog)
{
ui->setupUi(this);
QRegExp regExp("[A-Za-z][1-9][0-9]{0,2}");
lineEdit->setValidator(new QRegExpValidator(regExp,this));
connect(okButton,SIGNAL(clicked()),this,SLOT(accept()));
connect(cancelButton,SIGNAL(clicked()),this,SLOT(reject()));
}
GoToCellDialog::~GoToCellDialog()
{
delete ui;
}
void GoToCellDialog::on_lineEdit_textChanged(QString )
{
okButton->setEnabled(lineEdit->hasAcceptableInput());
}
main.cpp#include <QtGui/QApplication>
#include "gotocelldialog.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
GoToCellDialog w;
w.show();
return a.exec();
}
.h#ifndef GOTOCELLDIALOG_H
#define GOTOCELLDIALOG_H
#include <QWidget>
#include "ui_gotocelldialog.h"
namespace Ui {
class GoToCellDialog;
}
class GoToCellDialog : public QWidget,public Ui::GoToCellDialog
{
Q_OBJECT
public:
explicit GoToCellDialog(QWidget *parent = 0);
~GoToCellDialog();
private:
Ui::GoToCellDialog *ui;
private slots:
void on_lineEdit_textChanged(QString );
};
#endif // GOTOCELLDIALOG_H
.cpp#include "gotocelldialog.h"
#include "ui_gotocelldialog.h"
#include <QtGui>
GoToCellDialog::GoToCellDialog(QWidget *parent) :
QWidget(parent),
ui(new Ui::GoToCellDialog)
{
ui->setupUi(this);
QRegExp regExp("[A-Za-z][1-9][0-9]{0,2}");
lineEdit->setValidator(new QRegExpValidator(regExp,this));
connect(okButton,SIGNAL(clicked()),this,SLOT(accept()));
connect(cancelButton,SIGNAL(clicked()),this,SLOT(reject()));
}
GoToCellDialog::~GoToCellDialog()
{
delete ui;
}
void GoToCellDialog::on_lineEdit_textChanged(QString )
{
okButton->setEnabled(lineEdit->hasAcceptableInput());
}
...全文
相关推荐
QT下键盘界面程序
QT(Qt)是一种广泛应用的跨平台应用程序开发框架,由Trolltech公司(现为The Qt Company)开发,现已被诺基亚和Digia等公司收购。
使用QT制作的主界面滑动窗口
QT5是一种广泛应用于桌面和移动平台的跨平台应用程序开发框架,由Trolltech公司(现为The Qt Company)开发,采用C++语言编写,并提供了一套丰富的API来简化UI设计和系统交互。
c++可视化 QT程序打包演示 示例工程
QT是一个功能强大的跨平台应用程序开发框架,支持Windows、Linux、macOS等多个操作系统。在C++中使用QT,我们可以利用其丰富的库和工具来快速创建美观且功能丰富的界面。
通过在Qt中调用cmd命令来执行sql数据库备份
总的来说,利用Qt调用CMD执行MySQL的备份命令是一种常见的做法,尤其在没有图形化界面或者需要自动化备份的场景下。这种方式灵活且高效,但需要注意处理好命令行参数和权限问题,确保数据安全。
QT5.拼图游戏源码加可执行程序
从压缩包的文件名来看,"puzzle_deploy"可能是一个包含了编译后的可执行程序和必要的库文件,使得用户可以直接在没有开发环境的情况下运行游戏。


