修改pressPos未赋值问题
This commit is contained in:
parent
42a09e95fd
commit
90157f6306
|
@ -92,8 +92,9 @@ void KListView::mouseMoveEvent(QMouseEvent *e)
|
|||
|
||||
void KListView::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
if ((this->indexAt(event->pos()).isValid()) && event->button() == Qt::LeftButton) {
|
||||
m_pressApp = m_listmodel->data(this->indexAt(event->pos()), Qt::DisplayRole);
|
||||
m_pressPos = event->pos();
|
||||
if ((this->indexAt(m_pressPos).isValid()) && event->button() == Qt::LeftButton) {
|
||||
m_pressApp = m_listmodel->data(this->indexAt(m_pressPos), Qt::DisplayRole);
|
||||
}
|
||||
return QListView::mousePressEvent(event);
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ public:
|
|||
int module = 0;
|
||||
double m_transparency;
|
||||
QVariant m_pressApp;
|
||||
QPoint m_pressPos;
|
||||
UkuiMenuInterface *m_ukuiMenuInterface = nullptr;
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *e);
|
||||
|
|
|
@ -50,7 +50,6 @@ ListView::~ListView()
|
|||
void ListView::initWidget()
|
||||
{
|
||||
setAttribute(Qt::WA_TranslucentBackground);
|
||||
this->setAcceptDrops(true);
|
||||
viewport()->setAttribute(Qt::WA_TranslucentBackground);
|
||||
viewport()->setAutoFillBackground(false);
|
||||
this->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
|
|
|
@ -57,8 +57,6 @@ private:
|
|||
int h = 0;
|
||||
int m_preRowCount;
|
||||
bool m_scrollbarState = true;
|
||||
QPoint m_pressPos;
|
||||
|
||||
|
||||
private Q_SLOTS:
|
||||
void onClicked(QModelIndex index);//点击item
|
||||
|
|
Loading…
Reference in New Issue