随笔分类 -  QT

摘要:widget.h 1 #ifndef WIDGET_H 2 #define WIDGET_H 3 4 #include <QWidget> 5 #include <QPainter> 6 #include <QPen> 7 #include <QEvent> 8 9 namespace Ui { 1 阅读全文
posted @ 2018-04-11 11:36 喵小喵~ 阅读(231) 评论(0) 推荐(0)
摘要:dialog.h 1 #ifndef DIALOG_H 2 #define DIALOG_H 3 4 #include <QDialog> 5 #include <QLabel> 6 #include <QGridLayout> 7 #include <QMouseEvent> 8 #include 阅读全文
posted @ 2018-04-11 10:17 喵小喵~ 阅读(212) 评论(0) 推荐(0)
摘要:mainwindow.h 1 #ifndef MAINWINDOW_H 2 #define MAINWINDOW_H 3 4 #include <QMainWindow> 5 #include <QTextEdit> 6 #include <QMenu> 7 #include <QMenuBar> 阅读全文
posted @ 2018-04-10 23:37 喵小喵~ 阅读(829) 评论(0) 推荐(0)
摘要:运行效果 widget布局showwidget.h 1 #ifndef SHOWWIDGET_H 2 #define SHOWWIDGET_H 3 4 #include <QWidget> 5 #include <QLabel> 6 #include <QTextEdit> 7 #include < 阅读全文
posted @ 2018-04-10 13:14 喵小喵~ 阅读(4922) 评论(0) 推荐(1)
摘要:开始画面 1 #include "widget.h" 2 #include <QApplication> 3 #include <QSplashScreen> 4 5 int main(int argc, char *argv[]) 6 { 7 QApplication a(argc, argv); 阅读全文
posted @ 2018-04-09 22:45 喵小喵~ 阅读(198) 评论(0) 推荐(0)
摘要:myclock.h 1 #ifndef MYCLOCK_H 2 #define MYCLOCK_H 3 4 #include <QObject> 5 #include <QLCDNumber> 6 #include <QWidget> 7 #include <QMouseEvent> 8 9 cla 阅读全文
posted @ 2018-04-09 22:23 喵小喵~ 阅读(229) 评论(0) 推荐(0)
摘要:dialog.h dialog.cpp 阅读全文
posted @ 2018-04-09 21:33 喵小喵~ 阅读(3422) 评论(0) 推荐(0)
摘要:1 #ifndef MAINWINDOW_H 2 #define MAINWINDOW_H 3 4 #include 5 #include 6 7 namespace Ui { 8 class MainWindow; 9 } 10 11 class MainWindow : public QMainWindow 12 { 13 Q_OBJECT 14 15 ... 阅读全文
posted @ 2018-04-09 16:29 喵小喵~ 阅读(274) 评论(0) 推荐(1)
摘要:qint64转QString 1 qint64 size = info.size(); 2 //qint64 转QString 3 QString size2 = tr("%1").arg(size); 获取文件属性 1 #include "mainwindow.h" 2 #include "ui_ 阅读全文
posted @ 2018-04-09 11:08 喵小喵~ 阅读(2284) 评论(0) 推荐(0)
摘要:1 #include "mainwindow.h" 2 #include 3 #include 4 #include 5 #include 6 7 qint64 getitall(const QString &path) 8 { 9 //构造初始化 10 QDir dir(path); 11 qint64 size = 0; 12 13 //... 阅读全文
posted @ 2018-04-09 10:46 喵小喵~ 阅读(188) 评论(0) 推荐(0)
摘要:mainwindow.h 1 #ifndef MAINWINDOW_H 2 #define MAINWINDOW_H 3 4 #include <QMainWindow> 5 #include <QFileSystemWatcher> 6 #include <QLabel> 7 8 namespac 阅读全文
posted @ 2018-04-09 10:31 喵小喵~ 阅读(126) 评论(0) 推荐(0)
摘要:1 #include "mainwindow.h" 2 #include 3 #include 4 #include 5 6 int main(int argc, char *argv[]) 7 { 8 QApplication a(argc, argv); 9 10 QFile file("1.bin"); 11 file.open(QIOD... 阅读全文
posted @ 2018-04-09 10:14 喵小喵~ 阅读(236) 评论(0) 推荐(0)
摘要:1 #include "mainwindow.h" 2 #include "ui_mainwindow.h" 3 #include 4 #include 5 #include 6 7 MainWindow::MainWindow(QWidget *parent) : 8 QMainWindow(parent), 9 ui(new Ui::MainWind... 阅读全文
posted @ 2018-04-09 10:00 喵小喵~ 阅读(356) 评论(0) 推荐(0)
摘要:文件对话框 #include<QFileDialog> 1 //文件对话框 2 void Dialog::on_pushButton_clicked() 3 { 4 //定义显示文件的类型 窗口标题 可供选择的类型 5 QString qstr = QFileDialog::getOpenFileN 阅读全文
posted @ 2018-04-08 23:09 喵小喵~ 阅读(2251) 评论(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 喵小喵~ 阅读(262) 评论(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 喵小喵~ 阅读(174) 评论(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 喵小喵~ 阅读(151) 评论(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 喵小喵~ 阅读(107) 评论(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 喵小喵~ 阅读(132) 评论(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 喵小喵~ 阅读(324) 评论(0) 推荐(0)