摘要: 文件对话框 #include<QFileDialog> 1 //文件对话框 2 void Dialog::on_pushButton_clicked() 3 { 4 //定义显示文件的类型 窗口标题 可供选择的类型 5 QString qstr = QFileDialog::getOpenFileN 阅读全文
posted @ 2018-04-08 23:09 喵小喵~ 阅读(2203) 评论(0) 推荐(0) 编辑
摘要: mainwindow.h 1 #ifndef MAINWINDOW_H 2 #define MAINWINDOW_H 3 4 #include <QMainWindow> 5 #include <QTextEdit> 6 #include <QEvent> 7 #include <QtEvents> 阅读全文
posted @ 2018-04-08 21:36 喵小喵~ 阅读(251) 评论(0) 推荐(0) 编辑
摘要: mainwindow.h 1 #ifndef MAINWINDOW_H 2 #define MAINWINDOW_H 3 4 #include <QMainWindow> 5 #include <QKeyEvent> 6 7 namespace Ui { 8 class MainWindow; 9 阅读全文
posted @ 2018-04-08 21:16 喵小喵~ 阅读(169) 评论(0) 推荐(0) 编辑
摘要: 头文件 1 #include <QMouseEvent> 2 #include <QStatusBar> 3 #include <QLabel> 1 protected: 2 //鼠标按下 3 void mousePressEvent(QMouseEvent *e); 4 //鼠标移动 5 void 阅读全文
posted @ 2018-04-08 19:50 喵小喵~ 阅读(137) 评论(0) 推荐(0) 编辑
摘要: 头文件 1 #include <QHBoxLayout> 2 #include <QPushButton> 3 #include <QVBoxLayout> 4 #include <QLineEdit> 5 #include <QLabel> mainwindow.cpp 1 #include "m 阅读全文
posted @ 2018-04-08 19:09 喵小喵~ 阅读(103) 评论(0) 推荐(0) 编辑
摘要: 运行效果 关键代码: dialog.h 1 #ifndef DIALOG_H 2 #define DIALOG_H 3 4 #include <QDialog> 5 #include <QTextEdit> 6 #include <QComboBox> 7 #include <QLineEdit> 阅读全文
posted @ 2018-04-08 17:52 喵小喵~ 阅读(125) 评论(0) 推荐(0) 编辑
摘要: 1 Dialog::Dialog(QWidget *parent) : 2 QDialog(parent), 3 ui(new Ui::Dialog) 4 { 5 ui->setupUi(this); 6 7 list = new QListWidget(this); 8 list->insertItem(0,"win1"); 9 ... 阅读全文
posted @ 2018-04-08 17:37 喵小喵~ 阅读(307) 评论(0) 推荐(0) 编辑
摘要: 运行效果 包含头文件 关键代码 阅读全文
posted @ 2018-04-08 17:04 喵小喵~ 阅读(261) 评论(0) 推荐(0) 编辑
摘要: 1 int main(int argc, char *argv[]) 2 { 3 QApplication a(argc, argv); 4 //MainWindow w; 5 //w.show(); 6 //左右分割 7 QSplitter *spmain = new QSplitter(Qt::Horizontal,0); 8 ... 阅读全文
posted @ 2018-04-08 16:49 喵小喵~ 阅读(202) 评论(0) 推荐(0) 编辑
摘要: 1 MainWindow::MainWindow(QWidget *parent) : 2 QMainWindow(parent), 3 ui(new Ui::MainWindow) 4 { 5 ui->setupUi(this); 6 //设置最小大小 7 this->setMinimumSize(200,100); 8 9 ... 阅读全文
posted @ 2018-04-08 14:28 喵小喵~ 阅读(134) 评论(0) 推荐(0) 编辑
摘要: 1 //可以写任何复杂正则表达式 2 QRegExp reg("[A-Z]"); 3 ui->lineEdit->setValidator(new QRegExpValidator(reg,this)); 阅读全文
posted @ 2018-04-08 14:21 喵小喵~ 阅读(103) 评论(0) 推荐(0) 编辑
摘要: QList 1 int main1(int argc, char *argv[]) 2 { 3 QApplication a(argc, argv); 4 5 QList<int> mylist={10,20,30}; 6 mylist << 100 << 200 << 300; 7 //创建容器 阅读全文
posted @ 2018-04-08 14:03 喵小喵~ 阅读(431) 评论(0) 推荐(0) 编辑
摘要: ui mainwindow.h 1 #ifndef MAINWINDOW_H 2 #define MAINWINDOW_H 3 4 #include <QMainWindow> 5 #include <QStringData> 6 #include <QStringList> 7 #include 阅读全文
posted @ 2018-04-08 13:29 喵小喵~ 阅读(164) 评论(0) 推荐(0) 编辑
摘要: UI 关键代码 mainwindow.h 1 QStringListModel *slm; 2 QStringList *sl; mainwindow.cpp init初始化 1 //初始化combox 2 ui->comboBox->insertItem(0,"山羊座","山羊座1"); 3 ui 阅读全文
posted @ 2018-04-08 12:59 喵小喵~ 阅读(261) 评论(0) 推荐(0) 编辑