24,860
社区成员




#-------------------------------------------------
#
# Project created by QtCreator 2017-01-07T23:34:45
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = gotocellx
TEMPLATE = app
# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += main.cpp\
gotocelldialog.cpp
HEADERS += gotocelldialog.h
FORMS += gotocelldialog.ui
DISTFILES += \
gotocellx.pro.user
#ifndef GOTOCELLDIALOG_H
#define GOTOCELLDIALOG_H
#include <QDialog>
#include "ui_gotocelldialog.h"
namespace Ui {
class gotocelldialog;
}
class gotocelldialog : public QDialog, public Ui::gotocelldialog
{
Q_OBJECT
public:
explicit gotocelldialog(QWidget *parent = 0);
~gotocelldialog();
private:
Ui::gotocelldialog *ui;
void on_lineEdit_textChanged();
};
#endif // GOTOCELLDIALOG_H
#include "gotocelldialog.h"
#include "ui_gotocelldialog.h"
gotocelldialog::gotocelldialog(QWidget *parent) :
QDialog(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(){
okButton->setEnabled(lineEdit->hasAcceptableInput());
}
//main.cpp//
#include "gotocelldialog.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
gotocelldialog *dialog=new gotocelldialog;
dialog->show();
return a.exec();
}