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

外贸网站如何选择域名百度世界500强排名

外贸网站如何选择域名,百度世界500强排名,高大上的公司网站,青岛房产信息网QListWidget常用成员函数 1、成员函数介绍2、例子显示图片和按钮的例子 1、成员函数介绍 1)QListWidget(QWidget *parent nullptr) 构造函数,创建一个新的QListWidget对象。 2)void addItem(const QString &label) 在列表末尾添加一个项目,项目标…

QListWidget常用成员函数

    • 1、成员函数介绍
    • 2、例子
      • 显示图片和按钮的例子

1、成员函数介绍

1)QListWidget(QWidget *parent = nullptr)
构造函数,创建一个新的QListWidget对象。

2)void addItem(const QString &label)
在列表末尾添加一个项目,项目标签为label。

3)void addItem(QListWidgetItem *item)
在列表末尾添加一个项目,项目为item。

4)void insertItem(int row, const QString &label)
在指定的行插入一个项目,项目标签为label。

5)void insertItem(int row, QListWidgetItem *item)
在指定的行插入一个项目,项目为item。

6)void removeItemWidget(QWidget *widget)
从列表中移除指定的widget。

7)int rowCount() const
返回列表中的行数。

8)QListWidgetItem *item(int row) const
返回指定行的项目。

9)QListWidgetItem *takeItem(int row)
移除并返回指定行的项目。

10)int currentRow() const
返回当前选中的行的索引。

11)void setCurrentRow(int row)
设置当前选中的行。

12)QListWidgetItem *currentItem() const
返回当前选中的项目。

13)void setCurrentItem(QListWidgetItem *item)
设置当前选中的项目。

14)void sortItems(Qt::SortOrder order = Qt::AscendingOrder)
按照指定的顺序对列表中的项目进行排序。

15)void clear()
移除列表中的所有项目。

16)void setSelectionMode(QAbstractItemView::SelectionMode mode)
设置列表的选择模式。

17)QAbstractItemView::SelectionMode selectionMode() const
返回列表的当前选择模式。

注意,对于大部分函数来说,如果列表为空或者索引超出范围,它们将不会有任何效果。此外,对列表的更改可能会触发一些信号,如itemChanged、itemClicked等,你可以通过连接这些信号来响应用户的交互。

2、例子

显示图片和按钮的例子

QListWidget中显示图片和按钮,你需要创建自定义的列表项。QListWidget本身并不直接支持这种功能,但是你可以通过创建自定义的QWidget,然后将它们添加到QListWidget中来实现。

#include <QApplication>  
#include <QListWidget>  
#include <QListWidgetItem>  
#include <QPushButton>  
#include <QLabel>  
#include <QHBoxLayout>  
#include <QWidget>  
#include <QVBoxLayout>  
#include <QPixmap>  class CustomItem : public QWidget {  
public:  CustomItem(const QString& text, const QPixmap& pixmap, QWidget* parent = nullptr)   : QWidget(parent), textLabel(new QLabel(text, this)), pixmapLabel(new QLabel(this)), button(new QPushButton("Button", this)) {  QHBoxLayout* layout = new QHBoxLayout(this);  layout->addWidget(textLabel);  layout->addWidget(pixmapLabel);  layout->addWidget(button);  setLayout(layout);  pixmapLabel->setPixmap(pixmap);  }  private:  QLabel* textLabel;  QLabel* pixmapLabel;  QPushButton* button;  
};  int main(int argc, char *argv[])  
{  QApplication app(argc, argv);  QListWidget listWidget;  QPixmap pixmap("path_to_your_image.jpg"); // Replace with the actual path to your image.  listWidget.addItem(new QListWidgetItem(new CustomItem("Item 1", pixmap)));  listWidget.addItem(new QListWidgetItem(new CustomItem("Item 2", pixmap)));  listWidget.addItem(new QListWidgetItem(new CustomItem("Item 3", pixmap)));  listWidget.show();  return app.exec();  
}

在这个例子中,我创建了一个名为CustomItem的自定义QWidget类,它包含一个QLabel用于显示文本,一个QLabel用于显示图片,以及一个QPushButton。然后,我创建了一个QListWidget,并使用这个自定义的部件创建了三个列表项。

http://www.zhongyajixie.com/news/29949.html

相关文章:

  • 顺德手机网站设计信息域名注册商
  • 政府门户网站建设深圳网络推广优化
  • vue大型网站怎么做路由建站平台哪个好
  • 自己做网站服务器的备案方法方象科技的企业愿景
  • crm系统免费肇庆seo按天计费
  • 网店网站建设策划书案例做个公司网站一般需要多少钱
  • 做网站公司怎么推销2022年明星百度指数排行
  • wordpress 自定义投稿怎么优化网站关键词排名
  • 网站建设公司运营经验seo优化必备技巧
  • wordpress单栏简洁seo的优点
  • 用自己照片做衣服 杯子的是哪个网站网络营销的工作内容包括哪些
  • 武安网站建设百度一下一下你就知道
  • 东莞网站制作多少钱万网app下载
  • 阿里云服务器创建多个网站吗网站优化是什么意思
  • 网站开发用什么技术做好seo的中文含义是
  • wordpress通用型大气简洁企业主题seo网站关键词
  • wordpress时间中文版如何优化搜索关键词
  • 营销网站的例子项目平台
  • 刚做网站做什么网站好点企业排名优化公司
  • 中科院网站做的好的院所全渠道营销成功案例
  • 网站建设中倒计时模板下载网络技术推广服务
  • 没网站做cpa青岛seo网络优化公司
  • 怎么在网站上做链接系统优化软件
  • wordpress腾讯云新的seo网站优化排名 网站
  • 专做外贸的网站自助建站系统个人网站
  • 标识设计公司网站seo最新优化技术
  • 杭州网站定制开发电商数据网站
  • 机械网站精选百度搜索排行seo
  • 网上做论文的网站有哪些内容收录批量查询
  • vs做的本地网站seo技术交流