QT6 源(153)模型视图架构里的表格窗体视图 QTableWidget 篇三:源码及其元素 QTableWidgetItem 的源代码带注释

(14)本源代码定义于头文件 qtablewidget . h 头文件

#ifndef QTABLEWIDGET_H
#define QTABLEWIDGET_H#include <QtWidgets/qtableview.h>
#include <QtWidgets/qtwidgetsglobal.h>
#include <QtCore/qlist.h>
#include <QtCore/qvariant.h>QT_REQUIRE_CONFIG(tablewidget);QT_BEGIN_NAMESPACEclass QTableWidgetSelectionRange
{
public:QTableWidgetSelectionRange() = default;QTableWidgetSelectionRange(int top, int left, int bottom, int right): m_top(top), m_left(left), m_bottom(bottom), m_right(right){}inline int topRow() const { return m_top; }inline int bottomRow() const { return m_bottom; }inline int leftColumn() const { return m_left; }inline int rightColumn() const { return m_right; }inline int rowCount() const { return m_bottom - m_top + 1; }inline int columnCount() const { return m_right - m_left + 1; }
private:int m_top = -1, m_left = -1, m_bottom = -2, m_right = -2;
};class QTableWidget;
class QTableModel;
class QWidgetItemData;
class QTableWidgetItemPrivate;/*
The QTableWidgetItem class provides an item for use with the QTableWidget class.Detailed Description :
表格项用于存储表格小部件的信息。项目通常包含文本、图标或复选框。
QTableWidgetltem类是一个方便的类,它在Qt 3中替换了QTableWidgetltem类。
它提供了一个可以与QTableWidgetltem类一起使用的项目。
顶级项目在没有父项的情况下构建,然后根据行号和列号指定的位置插入:QTableWidgetItem * newItem = new QTableWidgetItem(tr("%1").arg(pow(row, column+1)));tableWidget->setItem(row, column, newItem);每个项目都可以有自己的背景画笔,这通过`setBackground()、函数来设置。
当前的背景画笔可以通过background ()、函数来获取。
每个项目的文本标签可以使用其特定的字体和画笔来呈现,这通过`setFont ()'和setForeground)函数进行指定,
并通过`font()`和`foreground()'函数来读取。默认情况下,项是启用的,可编辑的,可选择的,可检查的,并且既可以作为拖放操作的源,也可以作为落点目标。
每个项的标记可以通过调用setFlags()函数并传入相应的值(见Qt:ItemFlags)来更改。
可检查的项可以通过setCheckState()函数进行检查和取消检查。
对应的checkState()函数则指示该项当前是否被检查过。Subclassing :
当子类化 QTableWidgetltem 以提供自定义项时,可以为它们定义新类型,以便它们可以与标准项区分开来.
需要此功能的子类的构造函数需要使用等于或大于 UserType 的新类型值调用基类构造函数。*/class Q_WIDGETS_EXPORT QTableWidgetItem
{friend class QTableWidget;friend class QTableModel;
private:QTableModel * tableModel() const;private: //可见,表格里的条目还有丰富的数据成员,以描述条目里的数据与属性int                       rtti     ;QList<QWidgetItemData>    values   ; //包含了条目里的数据QTableWidget            * view     ; //本条目属于哪个表格窗体。QTableWidgetItemPrivate * d        ;Qt::ItemFlags             itemFlags; //本条目的编辑属性。public:enum ItemType { Type = 0, UserType = 1000 };//Constructs a table item of the specified type that does not belong to any table.//形参 type会赋值给本类的私有数据成员 rtti,以保存本条目的类型。explicit   QTableWidgetItem(int type = Type); //默认类型是 0inline int type() const { return rtti; }//Returns the type passed to the QTableWidgetItem constructor.//Constructs a table item with the given text.explicit   QTableWidgetItem(const QString & text, int type = Type); //有参构造函数explicit   QTableWidgetItem(const QIcon   & icon,const QString & text, int type = Type);QTableWidgetItem(const QTableWidgetItem & other); //copy构造函数QTableWidgetItem & operator=(const QTableWidgetItem & other);//copy赋值运算符函数virtual ~QTableWidgetItem(); //析构函数virtual bool operator< (const QTableWidgetItem & other) const; //无注释virtual QTableWidgetItem * clone() const; //Creates a copy of the item.//Returns the table widget that contains the item.inline  QTableWidget     * tableWidget() const { return view; }inline int row   () const{   return (view ? view->row(this)    : -1); }inline int column() const{   return (view ? view->column(this) : -1); }//Returns the row of the item in the table.//If the item is not in a table, this function will return -1.virtual void read (QDataStream & in )      ; //Reads  the item from stream in .virtual void write(QDataStream & out) const; //Writes the item to   stream out.//Returns true if the item is selected, otherwise returns false.bool  isSelected() const;void setSelected(bool select); //Sets the selected state of the item to select./*enum Qt::ItemFlag {NoItemFlags = 0,ItemIsSelectable = 1,ItemIsEditable = 2,ItemIsDragEnabled = 4,ItemIsDropEnabled = 8,ItemIsUserCheckable = 16,ItemIsEnabled = 32,ItemIsAutoTristate = 64,ItemNeverHasChildren = 128,ItemIsUserTristate = 256};Q_DECLARE_FLAGS(ItemFlags, ItemFlag)Q_DECLARE_OPERATORS_FOR_FLAGS(ItemFlags)*/inlineQt::ItemFlags        flags() const { return itemFlags; } //返回条目具有的属性void              setFlags(Qt::ItemFlags flags);virtual QVariant     data(int role) const;               //读写条目里具有的数据。virtual void      setData(int role, const QVariant &value);//以下依次是读写条目里各角色对应的数据。inline QString       text() const         //角色 0{   return data(Qt::DisplayRole).toString(); }inline void       setText(const QString & text){   setData(Qt::DisplayRole, text); }inline QIcon         icon() const         //角色 1{   return qvariant_cast<QIcon>(data(Qt::DecorationRole)); }inline void       setIcon(const QIcon & icon){   setData(Qt::DecorationRole, icon); }inline QString       toolTip() const      //角色 3{ return data(Qt::ToolTipRole).toString(); }inline void       setToolTip(const QString & toolTip){ setData(Qt::ToolTipRole, toolTip); }inline QString       statusTip() const    //角色 4{   return data(Qt::StatusTipRole).toString(); }inline void       setStatusTip(const QString &statusTip){   setData(Qt::StatusTipRole, statusTip); }inline QString       whatsThis() const    //角色 5{   return data(Qt::WhatsThisRole).toString(); }inline void       setWhatsThis(const QString & whatsThis){   setData(Qt::WhatsThisRole, whatsThis); }inline QFont         font() const         //角色 6{   return qvariant_cast<QFont>(data(Qt::FontRole)); }inline void       setFont(const QFont & font){   setData(Qt::FontRole, font); }inline int           textAlignment() const//角色 7{   return data(Qt::TextAlignmentRole).toInt(); }inline void       setTextAlignment(int alignment){   setData(Qt::TextAlignmentRole, alignment); }inline QBrush        background() const   //角色 8{   return qvariant_cast<QBrush>(data(Qt::BackgroundRole)); }inline void       setBackground(const QBrush & brush){   setData(Qt::BackgroundRole,brush.style() != Qt::NoBrush ? QVariant(brush) : QVariant()); }//QBrush(Qt::GlobalColor color, Qt::BrushStyle bs = Qt::SolidPattern);inline QBrush        foreground() const   //角色 9{   return qvariant_cast<QBrush>(data(Qt::ForegroundRole)); }inline void       setForeground(const QBrush &brush){   setData(Qt::ForegroundRole,brush.style() != Qt::NoBrush ? QVariant(brush) : QVariant()); }inline  //enum Qt::CheckState { Unchecked, PartiallyChecked, Checked };Qt::CheckState       checkState() const   //角色 10{   return static_cast<Qt::CheckState>(data(Qt::CheckStateRole).toInt()); }inlinevoid              setCheckState(Qt::CheckState state){   setData(Qt::CheckStateRole, state); }inline QSize         sizeHint() const     //角色 13{   return qvariant_cast<QSize>(data(Qt::SizeHintRole)); }inline void       setSizeHint(const QSize & size){   setData(Qt::SizeHintRole, size.isValid() ? QVariant(size) : QVariant()); }}; //完结 class QTableWidgetItem#ifndef QT_NO_DATASTREAMQ_WIDGETS_EXPORT QDataStream & operator>>(QDataStream &in , QTableWidgetItem       &item);
Q_WIDGETS_EXPORT QDataStream & operator<<(QDataStream &out, const QTableWidgetItem &item);#endifclass QTableWidgetPrivate;/*
The QTableWidget class provides an item-based table view with a default model.Detailed Description :
表格小部件为应用程序提供标准的表格显示功能。QTableWidgetltem中的项目由 QTableWidgetltem 提供。如果你想使用自己的数据模型来创建表格,你应该使用QTableView而不是这个类。表格小部件可以使用所需数量的行和列进行构建:tableWidget = new QTableWidget(12, 3, this);Alternatively, tables can be constructed without a given size and resized later:tableWidget = new QTableWidget(this);tableWidget->setRowCount(10);tableWidget->setColumnCount(5);项目在表之外创建(没有父控件)并使用设置方法插入到表中。QTableWidgetItem * newItem = new QTableWidgetItem(tr("%1").arg((row+1)*(column+1)));tableWidget->setItem(row, column, newItem);如果您想在表格控件中启用排序功能,详细信息,请参阅setltem()方法.
请在填充内容后执行此操作,否则排序可能会影响插入顺序.表格可以同时拥有横向和纵向标题。创建标题的最简单方法是向`setHorizontalHeaderLabels()和
`setVerticalHeaderLabels('函数提供一系列字符串。
这些函数将为表格的列和行提供简单的文本标题。
更复杂的标题可以由现有的表格项生成,而这些表格项通常是在表格之外构建的。
例如,我们可以构建一个带有图标和对齐文本的表格项,并将其用作特定列的标题:QTableWidgetItem *cubesHeaderItem = new QTableWidgetItem(tr("Cubes"));cubesHeaderItem->setIcon(QIcon(QPixmap(":/Images/cubed.png")));cubesHeaderItem->setTextAlignment(Qt::AlignVCenter);The number of rows in the table can be found with rowCount(),
and the number of columns with columnCount().
The table can be cleared with the clear() function.
表格中的行数可以通过rowCount()找到,列数通过columncount()找到。
表格可以通过clear()函数清空。*/class Q_WIDGETS_EXPORT QTableWidget : public QTableView
{Q_OBJECT//This property holds the number of columns / rows in the table.//By default, for a table constructed without row and column counts,//  this property contains a value of 0.Q_PROPERTY(int    rowCount READ    rowCount WRITE    setRowCount)Q_PROPERTY(int columnCount READ columnCount WRITE setColumnCount)friend class QTableModel; //这是 Qt3 里的老类,已被模型视图架构替代了。注释文档里这么说的。private:void setModel(QAbstractItemModel * model) override; //私有,不再被调用了。Q_DECLARE_PRIVATE(QTableWidget)Q_DISABLE_COPY(QTableWidget)Q_PRIVATE_SLOT(d_func(), void _q_sort())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))public://Creates a new table view with the given parent.explicitQTableWidget(                       QWidget * parent = nullptr);  //有参构造函数QTableWidget(int rows, int columns, QWidget * parent = nullptr); //有参构造函数//Creates a new table view with the given rows and columns, and with the given parent.~QTableWidget();  //析构函数//Q_PROPERTY(int    rowCount    READ    rowCount    WRITE    setRowCount)int             rowCount() const;void         setRowCount(int rows);//Q_PROPERTY(int    columnCount READ    columnCount WRITE    setColumnCount)int             columnCount() const;void         setColumnCount(int columns);/*  这是表格窗体视图的基类表格视图里的构建表头的代码方法。
class QTableView : public QAbstractItemView
{
public :QHeaderView *     horizontalHeader() const;void           setHorizontalHeader(QHeaderView * header);QHeaderView *     verticalHeader  () const;void           setVerticalHeader  (QHeaderView * header);
}
*///Returns the horizontal header item for column, column, if one has been set;//  otherwise returns nullptr.QTableWidgetItem *      horizontalHeaderItem(int column) const;void                 setHorizontalHeaderItem(int column, QTableWidgetItem * item);//Sets the horizontal header item for column column to item.//If necessary, the column count is increased to fit the item.//The previous header item (if there was one) is deleted.之前的旧标题元素会被删除。QTableWidgetItem *  takeHorizontalHeaderItem(int column);//Removes the horizontal header item at column from the header without deleting it.QTableWidgetItem *        verticalHeaderItem(int row) const;void                   setVerticalHeaderItem(int row, QTableWidgetItem * item);QTableWidgetItem *    takeVerticalHeaderItem(int row);//Sets the vertical header labels using labels.void                   setVerticalHeaderLabels(const QStringList & labels);void                 setHorizontalHeaderLabels(const QStringList & labels);//Returns the item for the given row and column if one has been set;//  otherwise returns nullptr.QTableWidgetItem *        item(int row, int column) const;void                   setItem(int row, int column, QTableWidgetItem * item);//Sets the item for the given row and column to item.//表格接管了该项的所有权。//请注意,如果已启用排序(参见`sortingEnabled`),且列是当前排序列,//  则该行将被移动到由`item`确定的已排序位置。//如果您想设置某一行中的多个项(例如,通过循环调用setltem()),可能需要在操作前关闭排序功能,//然后在操作后重新开启;这样您就可以为同一行中的所有项使用相同的行参数(即,setltem()不会移动该行)。QTableWidgetItem *    takeItem(int row, int column);//Removes the item at row and column from the table without deleting it.//Returns a list of pointers to the items contained in the data object.//If the object was not created by a QTreeWidget in the same process, the list is empty.QList<QTableWidgetItem *> items(const QMimeData * data) const;//Returns the row / column for the item.int    row(const QTableWidgetItem * item) const;int column(const QTableWidgetItem * item) const;//Returns the QModelIndex associated with the given item.条目索引与指针之间的相互转换。QModelIndex      indexFromItem         (const QTableWidgetItem * item ) const;QTableWidgetItem *        itemFromIndex(const QModelIndex      & index) const;//Returns a pointer to the QTableWidgetItem associated with the given index.//Returns the row / Column of the current item.int                     currentRow   () const;int                     currentColumn() const;QTableWidgetItem *      currentItem  () const;void                 setCurrentItem(QTableWidgetItem * item); //以代码的方式选择条目。//Sets the current item to item.//Unless the selection mode is NoSelection, the item is also selected.void                 setCurrentItem(QTableWidgetItem * item,QItemSelectionModel::SelectionFlags command);void                 setCurrentCell(int row, int column);     //直接用行列下标设定条目void                 setCurrentCell(int row, int column,      //这样更好。QItemSelectionModel::SelectionFlags command);bool    isSortingEnabled() const;       //默认,表格排序是被禁止的。void   setSortingEnabled(bool enable);  //无注释void      sortItems(int column, Qt::SortOrder order = Qt::AscendingOrder);//Sorts all the rows in the table widget based on column and order.//按某列排序,影响的不仅仅本列,而是所有的行。整行都因为某列的排序而移动了。int visualRow   (int logicalRow   ) const; //返回逻辑索引与视觉索引的对应关系int visualColumn(int logicalColumn) const; //隐藏并不会改变视觉索引。//Returns the widget displayed in the cell in the given row and column.//Note: The table takes ownership of the widget.//测试说明,这个窗体组件,不属于表中元素,不是先天就存在的。未设置前,是 nullptr。QWidget *       cellWidget(int row, int column) const;void         setCellWidget(int row, int column, QWidget * widget);inline    //Removes the widget set on the cell indicated by row and column.void      removeCellWidget(int row, int column){   setCellWidget(row, column, nullptr); }QList<QTableWidgetItem *>         selectedItems () const; //处理多选用这个就够//Returns a list of all selected ranges.QList<QTableWidgetSelectionRange> selectedRanges() const;void setRangeSelected(const QTableWidgetSelectionRange & range, bool select);//Selects or deselects the range depending on select.//QModelIndex QAbstractItemView::indexAt(const QPoint & point)基类里还有这个成员函数//Returns a pointer to the item at the given point,//  or returns nullptr if point is not covered by an item in the table widget.QTableWidgetItem * itemAt(const QPoint & p) const;inlineQTableWidgetItem * itemAt(int x,     int y) const //采用了表格自己的坐标系。{   return itemAt(QPoint(x, y)); }//Returns the item at the position equivalent to QPoint(ax, ay) in the//  table widget's coordinate system,QList<QTableWidgetItem *> findItems(const QString & text, Qt::MatchFlags flags) const;//Finds items that matches the text using the given flags./*//This enum describes the type of matches that can be//  used when searching for items in a model.enum Qt::MatchFlag { //本枚举量用于组合框的条目搜索。本枚举量指定了搜索方式MatchExactly           = 0, //Performs QVariant-based matching.MatchContains          = 1, //The search term is contained in the item.MatchStartsWith        = 2, //The search term matches the start of the item.MatchEndsWith          = 3, //The search term matches the   end of the item.MatchRegularExpression = 4,MatchWildcard          = 5,MatchFixedString       = 8,MatchTypeMask      = 0x0F,MatchCaseSensitive = 16,    //The search is case sensitive.MatchWrap          = 32,MatchRecursive     = 64     //Searches the entire hierarchy.};Q_DECLARE_FLAGS(MatchFlags, MatchFlag)Q_DECLARE_OPERATORS_FOR_FLAGS(MatchFlags)*/const  //Returns the item prototype used by the table.QTableWidgetItem *    itemPrototype() const; //似乎在继承 QTableWidgetltem时才用得上void               setItemPrototype(const QTableWidgetItem *item);// Sets the item prototype for the table to the specified item.//该表格小部件在需要创建新的表格项时,将使用项原型克隆函数。//例如,当用户在空单元格中进行编辑时。这非常有用,//尤其是在您有 QTableWidgetltem 子类并且希望确保 QTableWidget 创建您的子类实例的情况下。//表格接管原型的所有权。//返回某个单元格的位置信息QRect visualItemRect(const QTableWidgetItem * item) const; //无注释using  QAbstractItemView::isPersistentEditorOpen;/*class QAbstractItemView {bool      isPersistentEditorOpen(const QModelIndex & index) const;void    openPersistentEditor    (const QModelIndex & index);void   closePersistentEditor    (const QModelIndex & index);}*///Returns whether a persistent editor is open for item item.bool    isPersistentEditorOpen(QTableWidgetItem * item) const; //函数重载,参数类型不一样//Starts editing the item if it is editable.void                editItem  (QTableWidgetItem * item); //打开的是普通易失编辑框void  openPersistentEditor    (QTableWidgetItem * item); //打开持久型编辑框//Opens an editor for the give item. The editor remains open after editing.void closePersistentEditor    (QTableWidgetItem * item); //只有调用本函数才可以关闭持久框//Closes the persistent editor for item.protected:bool     event(QEvent     * e    ) override;void dropEvent(QDropEvent * event) override;virtual QStringList        mimeTypes() const;virtual QMimeData   *      mimeData(const QList<QTableWidgetItem *> & items) const;virtual bool           dropMimeData(int row, int column,const QMimeData * data, Qt::DropAction action);virtual Qt::DropActions supportedDropActions() const;//Returns the drop actions supported by this view./*enum Qt::DropAction { //本枚举类用于描述模型视图里的拖动操作的语义:复制、剪切或超链接。CopyAction       = 0x   1, //Copy the data to the target.MoveAction       = 0x   2, //Move the data from the source to the target.LinkAction       = 0x   4, //Create a link from the source to the target.ActionMask       = 0x  ff,TargetMoveAction = 0x8002, //在 Windows上,当 D&D数据的所有权应被目标应用程序接管时,//即源应用程序不应删除这些数据时,会使用此值。//在X11上,此值用于执行移动操作。Mac上不使用TargetMoveAction。IgnoreAction     = 0x   0  //Ignore the action (do nothing with the data).};Q_DECLARE_FLAGS(DropActions, DropAction)Q_DECLARE_OPERATORS_FOR_FLAGS(DropActions)*/public Q_SLOTS://Scrolls the view if necessary to ensure that the item is visible.//The hint parameter specifies more precisely where the//  item should be located after the operation.void   scrollToItem(const QTableWidgetItem * item,QAbstractItemView::ScrollHint hint = EnsureVisible);/*enum QAbstractItemView::ScrollHint {EnsureVisible   , //Scroll to ensure that the item is visible.PositionAtTop   , //Scroll to position the item at the top    of the viewport.PositionAtBottom, //Scroll to position the item at the bottom of the viewport.PositionAtCenter  //Scroll to position the item at the center of the viewport.};Q_ENUM(ScrollHint)    //滚动屏幕到条目 index处,并指明了 index条目的新的位置virtual void QAbstractItemView::scrollTo(const QModelIndex & index,ScrollHint hint = EnsureVisible) = 0;*///Inserts an empty row into the table at row.void insertRow   (int row   ); //在行 row ,列 column处插入一行或一列。void insertColumn(int column);void removeRow(int row);void removeColumn(int column); //删除第 row行或第 column列。//Removes the column column and all its items from the table.//Removes all items in the view. This will also remove all selections and headers.//If you don't want to remove the headers, use QTableWidget::clearContents().//The table dimensions stay the same.void clear        (); //行列框架        还会保存,表头数据没有了,改成了123数字void clearContents(); //行列框架和表头数据都会保存,只清除表体中的数据,置为空。//Removes all items not in the headers from the view.//This will also remove all selections. The table dimensions stay the same.Q_SIGNALS:void itemEntered(QTableWidgetItem * item);void cellEntered(int row,     int column);void itemPressed(QTableWidgetItem * item);void cellPressed(int row,     int column);void itemClicked(QTableWidgetItem * item);void cellClicked(int row,     int column);//This signal is emitted when the specified item has been activatedvoid itemActivated(QTableWidgetItem * item);void cellActivated(int row,     int column);void itemDoubleClicked(QTableWidgetItem * item);void cellDoubleClicked(int row,     int column);//This signal is emitted whenever the data of item has changed.void itemChanged(QTableWidgetItem * item); //当条目里的数据改变时,触发本信号void cellChanged(int row,     int column);//This signal is emitted whenever the current item changes.//The previous item is the item that previously had the focus,//  current is the new current item.       //当焦点切换时触发本信号函数。// 经测试发现,本信号函数里的 previous 形参不要使用。否则程序会闪退。void currentItemChanged(QTableWidgetItem * current, QTableWidgetItem * previous);void currentCellChanged(int  currentRow, int  currentColumn,int previousRow, int previousColumn);void itemSelectionChanged(); //当焦点选择变化时触发本信号,但没有形参。//This signal is emitted whenever the selection changes.}; //完结 class QTableWidget : public QTableViewQT_END_NAMESPACE#endif // QTABLEWIDGET_H

(15)

谢谢

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若转载,请注明出处:http://www.pswp.cn/bicheng/87930.shtml
繁体地址,请注明出处:http://hk.pswp.cn/bicheng/87930.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

SSL证书是网络安全的一把利刃

SSL证书&#xff08;安全套接层证书&#xff0c;现普遍升级为TLS证书&#xff09;确实是网络安全领域中一把至关重要的“利刃”&#xff0c;它在保护数据传输安全、建立用户信任、防范网络攻击等方面发挥着不可替代的作用。以下是其核心价值与作用的详细分析&#xff1a;一、SS…

Apache 配置文件提权的实战思考

在 Linux 系统中&#xff0c;如果普通用户被授予以 sudo 执行 Apache 并加载自定义配置文件的权限&#xff08;如 sudo apache2 -f /home/user/user.conf&#xff09;&#xff0c;那么该权限极可能被滥用为本地提权路径。 虽然 Apache 默认采用了更严格的权限限制机制&#xff…

代码随想录算法训练营第四十四天|动态规划part11

1143.最长公共子序列 题目链接&#xff1a;1143. 最长公共子序列 - 力扣&#xff08;LeetCode&#xff09; 文章讲解:代码随想录 思路&#xff1a; 其实就是求两个字符串的最长公共子序列的长度 与公共子数组的区别是可以不连续 &#xff0c;顺序对就可以 状态转移方程不一样 …

部署mysql

# 环境: 操作系统window11 安装了vagrant 通过vagrant部署、启动虚拟机(centos7) # 准备安装mysql8 # 添加 MySQL 官方 YUM 源 sudo rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-el7-7.noarch.rpm # 安装 MySQL Server sudo yum install -y mysql-s…

SQL分析与打印-p6spy组件

有性能消耗&#xff0c;只推荐在非生产环境下使用 SpringBoot3MybatisPlushttps://baomidou.com/guides/p6spy/ MyBatis-Plus提供了SQL分析与打印的功能&#xff0c;通过集成p6spy组件&#xff0c;可以方便地输出SQL语句及其执行时长。本功能适用于MyBatis-Plus 3.1.0及以上版本…

FLUX.1-Kontext 高效训练 LoRA:释放大语言模型定制化潜能的完整指南

在人工智能领域&#xff0c;尤其是大型语言模型&#xff08;LLM&#xff09;的应用浪潮中&#xff0c;高效、低成本地定制模型行为已成为关键需求。LoRA&#xff08;Low-Rank Adaptation&#xff09;技术以其参数高效、资源节省的特性脱颖而出。而 FLUX.1-Kontext 作为一款创新…

群晖 DS3617xs DSM 6.1.7 解决 PhotoStation 安装失败问题 PHP7.0

群晖 DS3617xs DSM 6.1.7 解决 PhotoStation 安装失败问题 PHP7.0问题描述解决方案1. 准备所需文件2. 检查当前 PHP 版本3. 安装 PHP 版本5. 查询已安装好的套件6. 升级 PHP 版本7. 手动安装套件PhotoStation注意事项总结问题描述 在群晖 DS3617xs DSM 6.1.7-15284 版本中&…

pnpm 升级

pnpm 的安装源太多了&#xff0c;感觉系统变量都有引入顺序。 今天踩坑记录&#xff1a; pnpm &#xff0c;如果最初用npm 装的&#xff0c;可以用npm 升级&#xff1b; 如果最初用brew 装的&#xff0c;得用brew 升级&#xff1b; 如果最初是用corepack 装的得用corepack 升级…

[C#] WPF - 资源URI

一、组成 1、资源URI总共包括4个部分(当前程序集可以省略前3个)&#xff1a; ①&#xff1a;pack://application:,,, ②&#xff1a;/[程序集名称] ③&#xff1a;;Component ④&#xff1a;/[资源路径] 二、举例 项目结构如下图所示&#xff1a; 1、MainWindow.xaml 文件…

【Mysql系列】Mysql 多级隔离级别揭秘

目录 一、什么是隔离级别 1.1、为什么复合操作需要事务&#xff1f; 1.2、事务的 ACID 特性如何保障操作可靠性&#xff1f; 1.3、隔离性通过隔离级别来控制 二、为什么用多级隔离级别 2.1、事务并发执行时可能引发以下问题 2.1.1、脏读&#xff08;Dirty Read&#xff…

odoo17 警示: selection attribute will be ignored as the field is related

在 Odoo 17 中&#xff0c;当使用 related 字段时&#xff0c;直接在 fields.Selection 中指定选择列表会被忽略&#xff08;因为选择项会从关联字段继承&#xff09;。wtd_fuwlx fields.Selection(服务类型 , relatedwtd_id.fuwlx, storeTrue)遇到了一个警告&#xff0c;提示…

gemma-3n-E2B多模态模型使用案例:支持文本、图像、语音输入

参考&#xff1a; https://developers.googleblog.com/en/introducing-gemma-3n-developer-guide/下载&#xff1a; https://modelscope.cn/models/google/gemma-3n-E2B-it 模型下载 运行代码&#xff1a; https://github.com/huggingface/huggingface-gemma-recipes 微调&…

计算机网络实验——互联网安全实验

实验1. OSPF路由项欺骗攻击和防御实验一、实验目的验证路由器OSPF配置过程。验证OSPF建立动态路由项过程。验证OSPF路由项欺骗攻击过程。验证OSPF源端鉴别功能的配置过程。验证OSPF防路由项欺骗攻击功能的实现过程。二、实验任务使用自己的语言简述该实验原理。如图1所示的网络…

Pytorch中torch.where()函数详解和实战示例

torch.where() 是 PyTorch 中非常常用的一个函数&#xff0c;功能类似于 NumPy 的 where&#xff0c;用于条件筛选或三元选择操作。在深度学习训练、掩码操作、损失函数处理等场景中非常常见。一、基本语法 torch.where(condition, x, y)condition&#xff1a;一个布尔张量&…

基于Hadoop的公共自行车数据分布式存储和计算平台的设计与实现

文章目录 有需要本项目的代码或文档以及全部资源&#xff0c;或者部署调试可以私信博主项目介绍&#xff1a;基于Hadoop的公共自行车数据分布式存储与计算平台设计与实现数据介绍数据预处理 Hadoop 集群的几个主要节点介绍1. NameNode&#xff08;主节点&#xff09;2. DataNod…

Java项目:基于SSM框架实现的程序设计课程可视化教学系统【ssm+B/S架构+源码+数据库+毕业论文】

摘 要 使用旧方法对程序设计课程可视化教学信息进行系统化管理已经不再让人们信赖了&#xff0c;把现在的网络信息技术运用在程序设计课程可视化教学信息的管理上面可以解决许多信息管理上面的难题&#xff0c;比如处理数据时间很长&#xff0c;数据存在错误不能及时纠正等问题…

Unity 实现 NPC 随机漫游行为的完整指南

在游戏开发中&#xff0c;NPC&#xff08;非玩家角色&#xff09;的行为逻辑对于营造真实、沉浸式的游戏世界至关重要。一个常见但又极具表现力的需求是&#xff1a;让 NPC 在场景中自然地随机移动&#xff0c;仿佛它们有自己的意识和目的地。 本文将详细介绍如何使用 Unity 的…

重新学习Vue中的按键监听和鼠标监听

文章目录按键事件1. 使用 keyup.enter 修饰符2. 使用 v-on 监听键盘事件3. 在组件上监听原生事件Vue 2Vue 34. 全局监听键盘事件注意事项鼠标事件1. 基本鼠标事件监听常用鼠标事件2. 事件修饰符3. 鼠标按键检测4. 鼠标位置信息5. 自定义指令监听鼠标事件6. 组合鼠标事件7. 性能…

vue2启动问题以及解决方案

vue2启动时&#xff1a;ERROR Invalid options in vue.config.js: "typescript.validate.enable" is not allowed如果需要在 VSCode 中控制 TypeScript 验证&#xff1a;在项目根目录创建 .vscode/settings.json 文件&#xff08;如不存在&#xff09;添加以下配置&a…

Vue响应式系统:从原理到核心API全解析

响应式原理 响应式机制的主要功能就是&#xff0c;可以把普通的JavaScript对象封装成为响应式对象&#xff0c;拦截数据的读取和设置操作&#xff0c;实现依赖数据的自动化更新。 Q: 如何才能让JavaScript对象变成响应式对象&#xff1f; 首先需要认识响应式数据和副作用函数…