当前位置: 首页 > news >正文

钦州电商网站建设wordpress图片自动分页

钦州电商网站建设,wordpress图片自动分页,广告网站建设及推广,建设公司网站需要多少天系列文章目录 文章目录 系列文章目录前言一、加入图片资源二、代码 前言 以前用的Qt5.15.2之前的版本#xff0c;QtCreator默认的工程文件是*.pro#xff0c;现在用5.15.2创建工程默认的工程文件是CMameList.txt,当然在创建项目时#xff0c;仍然可以使用pro工程文件用QtCr…系列文章目录 文章目录 系列文章目录前言一、加入图片资源二、代码 前言 以前用的Qt5.15.2之前的版本QtCreator默认的工程文件是*.pro现在用5.15.2创建工程默认的工程文件是CMameList.txt,当然在创建项目时仍然可以使用pro工程文件用QtCreator打开CMakeList.txt 以前用习惯了pro文件现在改成CMakeList很不习惯现在我们在CMakeList.txt中加入资源文件 一、加入图片资源 1.首先在Qt项目里创建一个目录image然后将图片资源放image目录中 2.在Qt creator中创建resource file 鼠标右键项目listWidgetSplitter Add New… Qt Qt Resource File 输入文件名Resources-next 3.新建资源文件.qrc 4.创建资源文件名Resources.qrc 5.把资源文件加入到你的工程中 6.并在CMakeLists.txt加入Resources.qrc并保存control s),这时左侧项目工程会自动生成Resources.qrs 7.左侧右键点击Resources.qrs文件添加前缀 8.添加图片关联到此前缀来 右键·Resources.qrc Open in Editor 选中Add Files 从打开的文件选择器中选择icon1.png,icon2.png,padfsplit.ico,se_center.png 9.添加图片复制图片路径 在代码中加入图片路径 二、代码 头文件 #ifndef LISTCONTROL_H #define LISTCONTROL_H#include QWidget #include QListWidget #include QListWidgetItem #include QMenu #include QSplitter #include QGridLayout #include QVBoxLayout #include QHBoxLayout #include QLabel #include QPixmap #include QImage #include QIcon #include QMessageBox #include QPushButton #include QAction #include QMouseEventclass listControl : public QWidget {Q_OBJECT public:explicit listControl(QWidget *parent nullptr);QListWidget* _listWgtLeft;QListWidget* _listWgtRight;QSplitter* _splitterMain;QMenu* _popMenuLeft;QMenu* _menuRight; private:void initUI();signals:private slots:void onMenuPopSlot(const QPoint pos); };#endif // LISTCONTROL_H 实现文件 #include listControl.hlistControl::listControl(QWidget *parent): QWidget{parent} {initUI(); }void listControl::initUI() {_splitterMain new QSplitter(Qt::Horizontal, 0); //新建主分割窗口水平分割_listWgtLeft new QListWidget(_splitterMain);//设置样式直接在函数中设置_listWgtLeft-setStyleSheet(QListWidget{border:1px solid gray; color:black; }QListWidget::Item{padding-top:1px; padding-bottom:4px; }QListWidget::Item:hover{background:skyblue; }QListWidget::item:selected{background:lightgray; color:red; }QListWidget::item:selected:!active{border-width:0px; background:lightgreen; });// _listWgtLeft-setResizeMode(QListView::Adjust); //适应布局调整_listWgtLeft-setViewMode(QListView::ListMode);_listWgtLeft-setMovement(QListView::Free);_listWgtLeft-setContextMenuPolicy(Qt::CustomContextMenu);_listWgtRight new QListWidget(_splitterMain);// QWidget* itemWgt new QWidget(_listWgtLeft);QGridLayout* itemMainLyt new QGridLayout;QHBoxLayout* itemContentLyt new QHBoxLayout;QListWidgetItem *item1 new QListWidgetItem(_listWgtLeft);item1-setFlags(item1-flags() | Qt::ItemIsEditable); // 设置item可编辑QWidget *widget new QWidget(_listWgtLeft);QHBoxLayout *layout new QHBoxLayout(widget);QLabel* lbl01 new QLabel();QImage* image01 new QImage;image01-load(:/images/icon/pdfsplit.ico);lbl01-setPixmap(QPixmap::fromImage(*image01));lbl01-setScaledContents(true);QPixmap pixMapOgi01(:/images/icon/icon1.png);QLabel *lbl02 new QLabel(u8卫星轨道1测试);QPushButton* btn01 new QPushButton;int btnWidth btn01-width();int btnHeight btn01-height();QPixmap pixmapFit pixMapOgi01.scaled(btnWidth, btnHeight, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);btn01-setIcon(pixmapFit);btn01-setStyleSheet(QString(QPushButton {background-color: transparent; }));btn01-setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);layout-addWidget(lbl01, 0, Qt::AlignVCenter | Qt::AlignLeft);layout-addWidget(lbl02);layout-addWidget(btn01, 0, Qt::AlignVCenter | Qt::AlignRight);widget-setLayout(layout);item1-setSizeHint(widget-sizeHint()); // 设置item大小// item5-setData(Qt::UserRole, 1);_listWgtLeft-setItemWidget(item1, widget); // 设置item控件_splitterMain-setStretchFactor(0, 4);_splitterMain-setStretchFactor(1, 6);_splitterMain-setWindowTitle(tr(test splitter));itemMainLyt-addWidget(_splitterMain);setLayout(itemMainLyt);//右键弹出菜单_popMenuLeft new QMenu(_listWgtLeft);QAction* addAct new QAction(tr(add));QAction* resetHidAct new QAction(tr(reset hide));QAction* cutAct new QAction(tr(cut));QAction* copyAct new QAction(tr(copy));QAction* delAct new QAction(tr(delete));_popMenuLeft-addAction(addAct);_popMenuLeft-addAction(resetHidAct);_popMenuLeft-addAction(cutAct);_popMenuLeft-addAction(copyAct);_popMenuLeft-addAction(delAct);connect(_listWgtLeft, QListView::customContextMenuRequested, this, listControl::onMenuPopSlot); }void listControl::onMenuPopSlot(const QPoint pos) {// _popMenuLeft-exec(QCursor::pos());_popMenuLeft-exec(_listWgtLeft-mapToGlobal(pos)); }代码调用cpp #include MainWindow.h #include listControl.h #include QApplication #include QTextCodec #include QDebugint main(int argc, char *argv[]) {QApplication a(argc, argv);// MainWindow w;// w.show();a.setFont(QFont(Microsoft Yahei, 9));QTextCodec::setCodecForLocale(QTextCodec::codecForName(UTF-8));qDebug() 中文调试信息;QFont font(ZYSong18030 , 10);a.setFont(font);listControl* contrl new listControl;contrl-show();return a.exec(); } 运行效果 ![在这里插入图片描述](https://img-blog.csdnimg.cn/direct/df747d4c4a4a434fa832478a558def35.gif#pic_center)
http://www.hkea.cn/news/14386491/

相关文章:

  • 威联通nas 做网站广州网络营销十年乐云seo
  • 松原网站建设哪家好wordpress滑动菜单
  • 织梦做网站的教程软文写作500字
  • 足彩彩票网站建设wordpress js版
  • 网站备案号 如何添加网络营销实训个人总结
  • 单页网站编辑器北京招聘网站开发
  • 某某公司网站建设论文wordpress进入文字版
  • 无锡市太湖新城建设网站网站改版对网站优化影响最大的问题是什么
  • 网站建设 重点做网站的挣钱么
  • 苏通建设集团有限公司网站阳江网红服务区
  • 电商网站建设是做什么的网站建设代理平台怎么做
  • 河南住房和城乡建设厅网站首页企业做电商网站有哪些内容
  • 单县建设局网站深圳企业网站哪家好
  • 网站建设描述延吉市网站建设
  • 网站 业务范围公司后台的网站代理维护更新
  • 建设网站需要什么知识更改wordpress最大上传文件大小
  • 做网站源码要给客户嘛沧州 网站建设
  • 营销型网站效果设计广告图片用什么软件
  • 静态网站建设的PPT工业和信息化部电子第五研究所
  • 金融集团网站模板租房网站开发报告
  • 网站外链建设:论坛签名是否还值得做目前流行的网站分辨率做多大
  • 现在流行做网站吗如何做电影网站才不侵权
  • 企业网站开发期末报告Wordpress设置Ip不开放
  • 河南建设168工程网官方网站如何建立一个网站请简述流程
  • 网站空间密码临沂河东区建设局网站
  • 个人做网站公司手机网页设计制作网站
  • php网站制作最近三天的新闻大事
  • 做漫画网站 漫画哪找阳江招聘网站
  • 网站规划与设计论文哪个网站做美食视频
  • 开发一个大型网站多少钱慕课网网站开发背景