共 30 篇文章
显示摘要每页显示  条
在Qt标准FileDialog对话框中插入控件。在QFileDialog定义中可以发现Q_DECLARE_PRIVATE(QFileDialog),这句话就是在QFileDialog中定义了界面的联系。下面代码,在QFileDialog底部加一个Checkbox.CFileDialogWithCheck::CFileDialogWithCheck(QWidget* parent, const QString &caption, const QString &directory, const QString &fi...
QT 中数据转换QString.我自己在编程中遇到的一些数据转换,以后会慢慢积累的。。。。。。。。。。。QString data="1234";quint16 port;port=quint(data.toUint());QString data="helloworld!";QByteArray prodata;prodata.append(data);慢慢收集哦!!!!
protected: bool eventFilter(QObject *obj, QEvent *event);其中几点需要注意的地方:- watchee和watcher必须都是从QObject派生的子类实例- watcher的类必须是一个自定义的子类(因为需要重新实现虚函数, 用现成的类是不行的。)-watcher类的eventFilter函数返回true时表示该事件处理完毕,不再继续传递;返回false表示该事件仍然传递- e...
练习QPainter,运行时看不到图形,只有一个灰色窗口 QPainter::begin: Paint device returned engine == 0, type: 1QPainter::setRenderHint: Painter must be active to set rendering hintsQPainter::setPen: Painter not activeQPainter::setBrush: Painter not active上面就是你的程序运行是的提示。想要使用QPainter画图,就要继...
QStatusBar类。下面我们在QStatusBar上添加一个QLabel:首先在class的声明中添加一个私有的QLabel属性:private: QAction *openAction; QLabel *msgLabel; 然后在其构造函数中添加: msgLabel = new QLabel; msgLabel->setMinimumSize(msgLabel->sizeHint()); msgLabel->setAlignment(Qt::Ali...
//border-image为程序启动后默认的背景//pressed为按下后的图片//hover为鼠标指向时的按钮图片//当然,还有选中后的图片~这个就自行处理了ui.colorButton->setStyleSheet("QPushButton {border-image:url(pic/border-image.jpg); font-size:24px;} \ QPushButton:hover:pressed {border-image:url(pic/pressed.jpg);font-size:24px;} ...
//设置分界线的样式 QLabel *label = new QLabel(QObject::tr("TestA")); QLabel *label2 = new QLabel(QObject::tr("TestB")); mainSplitter->addWidget(label2); mainSplitter->addWidget(label); mainSplitter->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); ...
头文件: ImageWidget.hpp  #ifndef IMAGEWIDGET_HPP  #define IMAGEWIDGET_HPP  #include <QtCore>  #include <QtGui>  class ImageWidget : public QWidget  {Q_OBJECT public: ImageWidget(QWidget *parent = 0, Qt::WindowFlags f = 0);#endif CPP文件: ImageWidget.cpp  #include "ImageWidget.hp...
Qt之Tab键切换焦点顺序简介。pButton1->setStyleSheet("QPushButton:focus{border:none; background: green; color: white;}");pButton2->setStyleSheet("QPushButton:focus{border:none; background: green; color: white;}");pButton3->setStyleSheet("QPushButton:focus{border:none; background: green;...
数码相框实现遍历文件夹图片文件遍历文件夹图片文件。dir.setFilter(QDir::Dirs|QDir::Files);std::cout <<qPrintable(QString("%1 %2%3").arg(fileInfo.size(), 10).arg(fileInfo.fileName(),10).arg(fileInfo.path()))<<endl;filters<<QString("*.jpeg")<<QString("*.jpg")<<QS...
帮助 | 留言交流 | 联系我们 | 服务条款 | 下载网文摘手 | 下载手机客户端
北京六智信息技术股份有限公司 Copyright© 2005-2024 360doc.com , All Rights Reserved
京ICP证090625号 京ICP备05038915号 京网文[2016]6433-853号 京公网安备11010502030377号
返回
顶部