日志
-
2015-11-27 21:48
-
//HexSpinBox.cpp
阅读全文»分类:C++GUIQt4|回复:0|浏览:1083
#ifndef HEXSPINBOX_H
#define HEXSPINBOX_H
#include <QSpinBox>
class HexSpinBox : public QSpinBox
{
Q_OBJECT
public:
explicit HexSpinBox(QWidget *parent = 0);
protected:
QValidator::State validate(QString &input, int &pos) const;
int valueFromText(const QString &text) const;
QString textFromValue(int val) const;
signals:
public slots:
private:
..
-
2015-11-27 14:00
-
#include <QApplication>
阅读全文»分类:C++GUIQt4|回复:0|浏览:797
#include <QUiLoader>
#include <QFile>
#include <QWidget>
#include <QPushButton>
int main(int argc,char** argv)
{
QApplication app(argc,argv);
QUiLoader loader;
QFile file("Extension.ui");
file.open(QFile::ReadOnly);
QWidget* pWidget = loader.load(&file);
//findChild<>() 模板函数, 通过 类型和objectName() 获取指针
QPushButt ..
-
2015-11-27 13:41
-
//UIStackedDialog.h
阅读全文»分类:C++GUIQt4|回复:0|浏览:783
#ifndef UISTACKDIALOG_H
#define UISTACKDIALOG_H
#include <QDialog>
#include <QStackedWidget>
#include <QListWidget>
#include <QLabel>
class UIStackedDialog : public QDialog
{
Q_OBJECT
public:
explicit UIStackedDialog(QWidget *parent=0,Qt::WindowFlags f=0);
private:
QLabel *m_pLabel1;
QLabel *m_pLabel2;
..
-
2015-11-27 13:14
-
//UISortDialog.h
阅读全文»分类:C++GUIQt4|回复:0|浏览:727
#ifndef UISORTDIALOG_H
#define UISORTDIALOG_H
#include <QDialog>
namespace Ui {
class UISortDialog;
}
class UISortDialog : public QDialog
{
Q_OBJECT
public:
explicit UISortDialog(QWidget *parent = 0);
~UISortDialog();
void setColumnRange(QChar first, QChar last);
private:
Ui::UISortDialog *ui;
};
#endif // UISORTDIALOG_H
//UISortDi ..
-
2015-11-27 09:59
-
//UIGoToCellDialog.h
阅读全文»分类:C++GUIQt4|回复:0|浏览:754
#ifndef UIGOTOCELLDIALOG_H
#define UIGOTOCELLDIALOG_H
#include <QDialog>
#include "ui_UIGoToCellDialog.h"
//多继承
class UIGoToCellDialog : public QDialog,
public Ui::UIGoToCellDialog
{ ..
-
2015-11-27 09:54
-
bool QObject::connect(const QObject *sender, //发出信号的对象
阅读全文»分类:C++GUIQt4|回复:1|浏览:777
const char *signal, //信号
..
-
2015-11-26 19:00
-
//UIFindDialog.h
阅读全文»分类:C++GUIQt4|回复:0|浏览:874
#ifndef UIFINDDIALOG
#define UIFINDDIALOG
#include <QDialog>
//类的前置声明
//对于该类中的所有私有变量来说前置声明是可行的
//前置声明告知编译器类的存在,而不需要提供类的实现细节
//可以加快编译速度
class QLabel;
class QCheckBox;
class QLineEdit;
class QPushButton;
class UIFindDialog : public QDialog
{
//对于所有定义了信号和槽的类
//都必须在类定义的开始处声明宏 Q_OBJECT
Q_OBJECT
public:
..
-
2015-11-26 18:33
-
#include <QApplication>
阅读全文»分类:C++GUIQt4|回复:0|浏览:615
#include <QHBoxLayout>
#include <QSlider>
#include <QSpinBox>
int main(int argc, char** argv)
{
QApplication app(argc, argv);
QWidget *pWindow = new QWidget;
pWindow->setWindowTitle(QObject::tr("Enter Your Age"));
QSpinBox *pSpinBox = new QSpinBox;
//设置spinBox控件的取值范围
..
-
2015-11-26 18:16
-
#include <QApplication>
阅读全文»分类:C++GUIQt4|回复:0|浏览:896
#include <QPushButton>
int main(int argc, char** argv)
{
QApplication app(argc, argv);
QPushButton button(QObject::tr("Quit"));
button.show();
//信号槽链接,当button对象被点击时发射clicked()信号,
//app对象接收到信号后,执行槽函数quit()
QObject::connect(&button, SIGNAL(clicked()), &app, SLO ..