文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>QT系列_001

QT系列_001

时间:2010-10-23  来源:mo451583183

 


    1。 信号(signals);   //发送消息[宏]
    2。 槽  (slots);     //接受消息         //系统的有 quit(); close();
    3。 布局(layouts).  
    widget  : 
          1. QPushButton;
          2. QLabel;
          3. QFont("Times", 18, QFont::Bold);
          4. QObject::connect(); --每个Qt对象可以有信号(发送消息)与槽(接受消息).
          5. QApplication::setFont()--改变整个应用程序的默认字体
          6. QSlider;--拖动范围条
          7. QSpinBox;--输入范围盒子
          8. QWidget;--界面元素基类
          9. QHBoxLayout;--布局;
          10. QLineEdit;
          11. QCheckBox
          12.
         --------
         1. tr(" ");
         2. setBuddy();
         3. emit [发送消息]

 ----------------------------------------------------------------昏割线--------------------------------------------------------------------

但是用Designer时,发现不能使用自己定义的槽. --自动生成使用的是组合使用ui

#ifndef GOTOCELLDIALOG_H
#define GOTOCELLDIALOG_H

#include <QtGui/QDialog>
#include "ui_gotocelldialog.h"

class GotoCelldialog : public QDialog
{
        Q_OBJECT

public:
        GotoCelldialog(QWidget *parent = 0, Qt::WFlags flags = 0);
        ~GotoCelldialog();

private:
        Ui::GoToCellDialogl ui;
};

#endif // GOTOCELLDIALOG_H

 --------------------------------------------------------------昏哥线--------------------------------------------------------------

---于是C++ Gui 就提出使用多继承来使用ui.

#ifndef GOTOCELLDIALOG_H
#define GOTOCELLDIALOG_H

#include <QtGui/QDialog>
#include "ui_gotocelldialog.h"

class GotoCelldialog : public QDialog, public Ui::GoToCellDialogl
{
        Q_OBJECT

public:
        GotoCelldialog(QWidget *parent = 0, Qt::WFlags flags = 0);
        ~GotoCelldialog();

        private slots:
                void on_lineEdit_textChanged();

};

#endif // GOTOCELLDIALOG_H

 ---------------------------------------------------------华丽分割线-------------------------------------------------------------

使用生成的ui_采用的是组合#include "gotocelldialog.h"  GotoCelldialog::GotoCelldialog(QWidget *parent, Qt::WFlags flags)  : QDialog(parent, flags) {      setupUi(this);  //TODO      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()));         connect(lineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(on_lineEdit_textChanged())); }  GotoCelldialog::~GotoCelldialog() {  }  void GotoCelldialog::on_lineEdit_textChanged() {         okButton->setDisabled(!lineEdit->hasAcceptableInput()); } 

 


 


 

相关阅读 更多 +
排行榜 更多 +
雷电觉醒安卓版

雷电觉醒安卓版

飞行射击 下载
3D幻影飞车最新版

3D幻影飞车最新版

飞行射击 下载
星河一号战队

星河一号战队

飞行射击 下载