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

网站怎么添加管理员建设网站是做手机版好还是pc版好

网站怎么添加管理员,建设网站是做手机版好还是pc版好,网站建设实例教程,商务网页设计与制作 百度百科(1)本类的继承关系如下 : 在本篇之前,已经阅读与注释了抽象的模型基类,列表模型,表格模型,抽象的视图基类,表格视图,表格窗体,列表模型。所以,对…

(1)本类的继承关系如下

在这里插入图片描述

++ 在本篇之前,已经阅读与注释了抽象的模型基类,列表模型,表格模型,抽象的视图基类,表格视图,表格窗体,列表模型。所以,对于此列表窗体,就不详细注释了。只对新的知识点添加注释与测试。
++ 开始本类的属性阅读

在这里插入图片描述

++ 另一个属性

在这里插入图片描述

++测试一下

在这里插入图片描述

++ 补充 :排序,升序降序都可以的,有成员函数支持排序操作

在这里插入图片描述

(2)接着开始本类的 public 成员函数的学习,跟二维表窗体 QTableWidget 类似的管理条目的成员函数,就不再注释了 :

在这里插入图片描述

++既然有了上面的函数,还有必要使用选择模型 么?

在这里插入图片描述

++

在这里插入图片描述

++至此,本类的 public 权限的成员函数,就学习完毕了。

(3)接着学习本类的 槽函数与信号函数

在这里插入图片描述

++信号函数

在这里插入图片描述

++测试结果

在这里插入图片描述

(4)本类的源代码定义于头文件 qlistwidget . h

class QListWidgetPrivate;/*
The QListWidget class provides an item-based list widget.QListWidget是一个方便的类,它提供的列表视图类似于 QListView提供的列表视图,
但具有用于添加和删除项目的经典基于项目的界面。
QListWidget 使用内部模型来管理列表中的每个QListWidgetltem。
为了实现更灵活的列表视图小部件,请使用带有标准模型的QListView类。
列表小部件的构建方式与其他小部件相同:QListWidget *listWidget = new QListWidget(this);列表控件的`selectionMode()、属性决定了列表中同时可被选中的项数量,以及是否支持创建复杂的项选择。
这可以通过`setSelectionMode()'函数进行设置。
添加项目到列表有两种方式:它们可以以列表控件作为其父控件来构建,
或者可以没有父控件,然后在稍后阶段添加到列表中。
如果在构建项目时列表控件已经存在,那么第一种方法使用起来更为便捷:new QListWidgetItem(tr("Oak"), listWidget);如果您需要在列表中的特定位置插入一个新项,
那么该新项应被构造为没有父项控件。然后应使用函数将其放置在列表中。
列表控件将取得该项的拥有权。QListWidgetItem * newItem = new QListWidgetItem;newItem->setText(itemText);listWidget->insertItem(row, newItem);对于多个项目,可以使用insertltems()。列表中的项目数量可以通过count()函数找到。
要从列表中移除项目,请使用takeltem()。列表中的当前项可以通过、currentltem()函数找到,并通过`setCurrentltem()、函数进行更改。
用户还可以通过键盘导航或点击不同的项来更改当前项。
当当前项发生变化时,会发出`currentltemChanged()、信号,其中包含新的当前项以及之前处于当前状态的项。*/class Q_WIDGETS_EXPORT QListWidget : public QListView
{Q_OBJECT//This property holds the number of items in the list including any hidden items.Q_PROPERTY(int            count        READ   count) //会计算隐藏的条目在内//This property holds the row of the current item.//Depending on the current selection mode, the row may also be selected.Q_PROPERTY(int            currentRowREAD          currentRowWRITE      setCurrentRowNOTIFY        currentRowChangedUSER          true)/*enum QAbstractItemView::SelectionMode { //定义在基类。NoSelection,SingleSelection,MultiSelection,ExtendedSelection,  //此项功能最强ContiguousSelection};*///此属性表示是否启用排序。默认值为false。经测试,这个排序只有一种,强制从上到下的增序排序。//如果此属性为真,则在列表中启用排序;如果属性为假,则不启用排序。Q_PROPERTY(bool sortingEnabled READ isSortingEnabled WRITE setSortingEnabled)friend class QListWidgetItem;friend class QListModel;private:void setModel(QAbstractItemModel * model) override; //本表格窗体不需要模型了Qt::SortOrder sortOrder() const; //无法从外部调用了,只有增序一个结果,不必查询了。Q_DECLARE_PRIVATE(QListWidget)Q_DISABLE_COPY(QListWidget)Q_PRIVATE_SLOT(d_func(), void _q_emitItemEntered(const QModelIndex & index))Q_PRIVATE_SLOT(d_func(), void _q_emitItemPressed(const QModelIndex & index))Q_PRIVATE_SLOT(d_func(), void _q_emitItemClicked(const QModelIndex & index))Q_PRIVATE_SLOT(d_func(), void _q_emitItemDoubleClicked(const QModelIndex & index))Q_PRIVATE_SLOT(d_func(), void _q_emitItemActivated(const QModelIndex & index))Q_PRIVATE_SLOT(d_func(), void _q_emitItemChanged(const QModelIndex & index))Q_PRIVATE_SLOT(d_func(), void _q_emitCurrentItemChanged(const QModelIndex & previous,const QModelIndex & current))Q_PRIVATE_SLOT(d_func(), void _q_dataChanged(const QModelIndex & topLeft,const QModelIndex & bottomRight))Q_PRIVATE_SLOT(d_func(), void _q_sort())public://Constructs an empty QListWidget with the given parent.explicit QListWidget(QWidget * parent = nullptr);~QListWidget();//Reimplements: QAbstractItemView::s//               etSelectionModel(QItemSelectionModel * selectionModel).void setSelectionModel(QItemSelectionModel * selectionModel) override;//   Q_PROPERTY(int   count    READ   count) //会计算隐藏的条目在内int   count() const;// //This property holds the row of the current item.
// //Depending on the current selection mode, the row may also be selected.
//   Q_PROPERTY(int          currentRow
//              READ         currentRow
//              WRITE     setCurrentRow
//              NOTIFY       currentRowChanged
//              USER         true)int          currentRow(  ) const;void      setCurrentRow(int row);void      setCurrentRow(int row,QItemSelectionModel::SelectionFlags command);
Q_SIGNALS:void         currentRowChanged(int currentRow);public:
// //此属性表示是否启用排序。默认值为false。经测试,这个排序只有一种,强制从上到下的增序排序。
// //如果此属性为真,则在列表中启用排序;如果属性为假,则不启用排序。
//   Q_PROPERTY(bool        sortingEnabled
//              READ      isSortingEnabled
//              WRITE    setSortingEnabled)bool      isSortingEnabled() const;void     setSortingEnabled(bool enable);QListWidgetItem *                item (int row) const;int row(const QListWidgetItem *  item) const;void                       insertItem (int row,       QListWidgetItem * item  );void                       insertItem (int row, const QString         & label );void                       insertItems(int row, const QStringList     & labels);inlinevoid                          addItem (const QString         & label ){   insertItem(count(), label); }inlinevoid                          addItem (      QListWidgetItem * item  ){   insertItem(count(), item); }inlinevoid                          addItems(const QStringList     & labels){   insertItems(count(), labels); }QListWidgetItem *            takeItem (int row);QListWidgetItem *                itemAt(const QPoint & p) const;inlineQListWidgetItem *                itemAt(int x,     int y) const{   return itemAt(QPoint(x, y)); }QRect                      visualItemRect(const QListWidgetItem * item) const;QListWidgetItem *         currentItem() const;void                   setCurrentItem(QListWidgetItem * item);void                   setCurrentItem(QListWidgetItem * item,QItemSelectionModel::SelectionFlags command);void                         sortItems(Qt::SortOrder order = Qt::AscendingOrder);QList<QListWidgetItem *>         items(const QMimeData * data) const;QModelIndex             indexFromItem         (const QListWidgetItem * item ) const;QListWidgetItem *                itemFromIndex(const QModelIndex     & index) const;//Returns a list of all selected items in the list widget.//测试发现,多选后,即使失去光标焦点,表格窗体也依然会维持多选的状态。QList<QListWidgetItem *> selectedItems() const; //本函数没有使用选择模型QList<QListWidgetItem *>     findItems( const QString & text,Qt::MatchFlags  flags) const;//Returns the widget displayed in the given item.QWidget *                        itemWidget(QListWidgetItem * item) const;void                          setItemWidget(QListWidgetItem * item, QWidget * widget);//Sets the widget to be displayed in the given item.//此函数只能用于在列表小部件项目的位置显示静态内容。//如果要显示自定义动态内容或实现自定义编辑器窗口小部件,//  请改用QListView和子类QStyledltemDelegate。inline void                removeItemWidget(QListWidgetItem * item){   setItemWidget(Item, nullptr);  }//Removes the widget set on the given item.//To remove an item (row) from the list entirely,//  either delete the item or use takeItem().//Starts editing the item if it is editable.void                         editItem(QListWidgetItem * item);using  QAbstractItemView::isPersistentEditorOpen;//bool QAbstractItemView::isPersistentEditorOpen(QModelIndex & index) const;bool                      isPersistentEditorOpen(QListWidgetItem * item) const;void                    openPersistentEditor    (QListWidgetItem * item);void                   closePersistentEditor    (QListWidgetItem * item);protected:virtual Qt::DropActions supportedDropActions() const;bool     event(QEvent *e) override;void dropEvent(QDropEvent *event) override;virtual QStringList        mimeTypes() const;virtual QMimeData   *      mimeData(const QList<QListWidgetItem *> & items) const;virtual bool           dropMimeData(int index, const QMimeData * data,Qt::DropAction action);public Q_SLOTS://Scrolls the view if necessary to ensure that the item is visible.//hint specifies where the item should be located after the operation.void   scrollToItem(const QListWidgetItem * item,QAbstractItemView::ScrollHint hint = EnsureVisible);void clear();   //Removes all items and selections in the view.//Warning: All items will be permanently deleted.Q_SIGNALS:void itemEntered  (QListWidgetItem * item); //这几个信号函数关注于鼠标点击的信号void itemPressed  (QListWidgetItem * item);void itemClicked  (QListWidgetItem * item);void itemDoubleClicked(QListWidgetItem * item);void itemActivated(QListWidgetItem * item);//This signal is emitted whenever the data of item has changed.void        itemChanged(QListWidgetItem * item);   //当本条目的内容变化时,调用本函数。void currentTextChanged(const QString & currentText);//This signal is emitted whenever the current item changes.//currentText is the text data in the current item.//If there is no current item, the currentText is invalid.void currentRowChanged (int currentRow);//This signal is emitted whenever the current item changes.//currentRow is the row of the current item.//If there is no current item, the currentRow is -1.void currentItemChanged(QListWidgetItem * current, QListWidgetItem * previous);void itemSelectionChanged();//This signal is emitted whenever the selection changes.}; //完结 class QListWidget : public QListView

(5)

谢谢

http://www.dtcms.com/wzjs/831439.html

相关文章:

  • 网站模板修改器店铺运营
  • 台州网站建设公司wordpress注册 邮件
  • angular做门户网站大型地方门户网站源码
  • 小学网站建设情况说明番禺网站开发
  • 购物网站开发django建筑工程网校排行榜
  • 有账号密码网站怎么建设商城网站建设基础设计
  • 建设一个展示商品的网站做网站怎么去进行链接
  • 电商网站的模块网站建设需解决问题
  • 能力天空的网站建设优劣势wordpress 心理
  • 大型旅行社自建网站开发公司技术科总结
  • vs做的网站项目可以改名字吗湖北建设执业注册中心网站
  • 免费推广网站在线wordpress手机文章列表
  • 上海定制网站建设费用手机移动端网站建设宣传
  • 苏州网站建设需要多少钱网站死链接查询
  • 贵州省建设厅考证官方网站网站如何做伪静态
  • 大连网站建设培训班网站空间怎么弄
  • 宁波市住房和城乡建设局网站卡一卡二卡三入口2021
  • 北京做网站建设价格河源抖音seo讯息
  • 如何增加网站的外链校园网站设计与实现
  • 哪个网站做线上家教比较好建设企业网站进去无法显示
  • 怎么样做一个自己的网站针织衫技术支持东莞网站建设
  • 建设部网站首页django做的网站源码
  • 湛江建设局网站建设个读书网站大约需要投入多少钱
  • 黑别人网站网页制作公司专业
  • 掼蛋网站建设wordpress数据表大学
  • 邢台网站设计厂家企业营销型网站费用
  • 软件开发人员工资标准资深seo顾问
  • 网站建设找至尚网络什么是网站分析
  • 网站制作完成后如何发布广西江荣建设工程有限责任公司网站
  • 浙江建设职业技术学院尔雅网站杭州网络科技公司有哪些